UBER-241 UBER-244 UBER-245 UBER-246 Inbox fixes (#3256)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov 2023-05-25 16:19:33 +06:00 committed by GitHub
parent 5c4c96d3f2
commit 7233d15ba0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 25 deletions

View File

@ -115,9 +115,8 @@
const client = getClient() const client = getClient()
async function openDM () { async function openDM () {
const current = (await client.findAll(chunter.class.DirectMessage, { members: accountId })).find( const res = await client.findAll(chunter.class.DirectMessage, { members: accountId })
(p) => p.members.length === 2 const current = res.find((p) => p.members.includes(me) && p.members.length === 2)
)
if (current !== undefined) { if (current !== undefined) {
dispatch('dm', current._id) dispatch('dm', current._id)
} else { } else {

View File

@ -24,7 +24,7 @@
const store = notificationClient.docUpdatesStore const store = notificationClient.docUpdatesStore
$: docUpdate = $store.get(value._id) $: docUpdate = $store.get(value._id)
$: hasNotification = (docUpdate?.txes?.length ?? 0) > 0 && docUpdate?.hidden !== true $: hasNotification = docUpdate?.txes?.some((p) => p.isNew) && docUpdate?.hidden !== true
</script> </script>
{#if hasNotification} {#if hasNotification}

View File

@ -34,8 +34,10 @@
const client = getClient() const client = getClient()
const hierarchy = client.getHierarchy() const hierarchy = client.getHierarchy()
$: value.txes[0] && $: txRef = value.txes[value.txes.length - 1]._id
client.findOne(core.class.TxCUD, { _id: value.txes[0]._id }).then((res) => {
$: txRef &&
client.findOne(core.class.TxCUD, { _id: txRef }).then((res) => {
if (res !== undefined) { if (res !== undefined) {
tx = TxProcessor.extractTx(res) as TxCUD<Doc> tx = TxProcessor.extractTx(res) as TxCUD<Doc>
} else { } else {
@ -64,9 +66,9 @@
</script> </script>
<!-- svelte-ignore a11y-click-events-have-key-events --> <!-- svelte-ignore a11y-click-events-have-key-events -->
<div class="container cursor-pointer" class:selected> {#if doc}
<div class="notify" class:hidden={newTxes === 0} /> <div class="container cursor-pointer" class:selected>
{#if doc} <div class="notify" class:hidden={newTxes === 0} />
<div <div
class="clear-mins content bottom-divider" class="clear-mins content bottom-divider"
class:read={newTxes === 0} class:read={newTxes === 0}
@ -94,8 +96,8 @@
</div> </div>
</div> </div>
</div> </div>
{/if} </div>
</div> {/if}
<style lang="scss"> <style lang="scss">
.time { .time {

View File

@ -45,8 +45,10 @@
const client = getClient() const client = getClient()
const hierarchy = client.getHierarchy() const hierarchy = client.getHierarchy()
$: firstItem?.txes[0] && $: txRef = firstItem ? firstItem.txes[firstItem.txes.length - 1]._id : undefined
client.findOne(core.class.TxCUD, { _id: firstItem.txes[0]._id }).then((res) => {
$: txRef &&
client.findOne(core.class.TxCUD, { _id: txRef }).then((res) => {
if (res !== undefined) { if (res !== undefined) {
tx = TxProcessor.extractTx(res) as TxCUD<Doc> tx = TxProcessor.extractTx(res) as TxCUD<Doc>
} else { } else {
@ -72,16 +74,16 @@
$: if (selected && div !== undefined) div.focus() $: if (selected && div !== undefined) div.focus()
</script> </script>
<div {#if doc}
class="container cursor-pointer" <div
on:keydown class="container cursor-pointer"
class:selected on:keydown
tabindex="-1" class:selected
bind:this={div} tabindex="-1"
on:click={() => dispatch('open', value._id)} bind:this={div}
> on:click={() => dispatch('open', value._id)}
<div class="notify" class:hidden={newTxes === 0} /> >
{#if doc} <div class="notify" class:hidden={newTxes === 0} />
<!-- svelte-ignore a11y-click-events-have-key-events --> <!-- svelte-ignore a11y-click-events-have-key-events -->
<div class="clear-mins content bottom-divider" class:read={newTxes === 0}> <div class="clear-mins content bottom-divider" class:read={newTxes === 0}>
<div class="w-full"> <div class="w-full">
@ -124,8 +126,8 @@
</div> </div>
</div> </div>
</div> </div>
{/if} </div>
</div> {/if}
<style lang="scss"> <style lang="scss">
.time { .time {