From 8067dd209e437cfd45d5f2c33d8c942f3951fc85 Mon Sep 17 00:00:00 2001 From: Ticruz Date: Thu, 7 Nov 2024 13:27:09 +0100 Subject: [PATCH 1/2] navigate to the correct tab from channel details --- src/app/views/ChannelsDetail.svelte | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/app/views/ChannelsDetail.svelte b/src/app/views/ChannelsDetail.svelte index e20b3ad64..a1fafad71 100644 --- a/src/app/views/ChannelsDetail.svelte +++ b/src/app/views/ChannelsDetail.svelte @@ -3,6 +3,7 @@ import {onMount, onDestroy} from "svelte" import {deriveEvents} from "@welshman/store" import {DIRECT_MESSAGE} from "@welshman/util" + import {session} from "@welshman/app" import {repository, displayProfileByPubkey, loadInboxRelaySelections} from "@welshman/app" import Channel from "src/partials/Channel.svelte" import Anchor from "src/partials/Anchor.svelte" @@ -27,6 +28,8 @@ $events => $events.filter(e => getChannelIdFromEvent(e) === channelId), ) + let isAccepted + const showPerson = pubkey => router.at("people").of(pubkey).open() const send = async (content, useNip17) => { @@ -39,6 +42,7 @@ } onMount(() => { + isAccepted = $messages.some(m => m.pubkey === $session.pubkey) markChannelRead(channelId) for (const pubkey of pubkeys) { @@ -58,7 +62,9 @@
- +
From 39381f4a67fe233a676c51d2accbf83eb4ce2b25 Mon Sep 17 00:00:00 2001 From: Ticruz Date: Thu, 7 Nov 2024 13:29:36 +0100 Subject: [PATCH 2/2] rework history on new messages --- src/app/views/ChannelsList.svelte | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/app/views/ChannelsList.svelte b/src/app/views/ChannelsList.svelte index afc4ae436..4c109ea0f 100644 --- a/src/app/views/ChannelsList.svelte +++ b/src/app/views/ChannelsList.svelte @@ -16,10 +16,6 @@ import {channels, hasNip44, hasNewMessages, markAllChannelsRead} from "src/engine" const activeTab = window.location.pathname.slice(1) === "channels" ? "conversations" : "requests" - const accepted = derived(channels, $ch => $ch.filter(c => c.last_sent > 0)) - const requests = derived(channels, $ch => - $ch.filter(c => c.last_received > 0 && c.last_sent === 0), - ) const setActiveTab = tab => { const path = tab === "requests" ? "channels/requests" : "channels" @@ -36,6 +32,8 @@ } $: tabChannels = activeTab === "conversations" ? $accepted : $requests + $: accepted = derived(channels, $ch => $ch.filter(c => c.last_sent > 0)) + $: requests = derived(channels, $ch => $ch.filter(c => c.last_received > 0 && c.last_sent === 0)) let element let limit = 20