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()
async function openDM () {
const current = (await client.findAll(chunter.class.DirectMessage, { members: accountId })).find(
(p) => p.members.length === 2
)
const res = await client.findAll(chunter.class.DirectMessage, { members: accountId })
const current = res.find((p) => p.members.includes(me) && p.members.length === 2)
if (current !== undefined) {
dispatch('dm', current._id)
} else {

View File

@ -24,7 +24,7 @@
const store = notificationClient.docUpdatesStore
$: 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>
{#if hasNotification}

View File

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

View File

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