Skip to content

Commit

Permalink
Fix to only mark messages in threads being followed as unread (#4473)
Browse files Browse the repository at this point in the history
  • Loading branch information
hpeebles authored Oct 2, 2023
1 parent b5cfaa4 commit 5c06ec1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
8 changes: 6 additions & 2 deletions frontend/app/src/components/home/thread/Thread.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
$: readonly = client.isChatReadOnly(chat.id);
$: thread = rootEvent.event.thread;
$: loading = !initialised && $threadEvents.length === 0 && thread !== undefined;
$: isFollowedByMe = thread !== undefined && (thread.followedByMe || thread.participantIds.has(user.userId));
function createTestMessages(ev: CustomEvent<number>): void {
if (process.env.NODE_ENV === "production") return;
Expand Down Expand Up @@ -271,8 +272,11 @@
me={evt.event.sender === user.userId}
confirmed={isConfirmed($unconfirmed, evt)}
failed={isFailed($failedMessagesStore, evt)}
readByMe={evt.event.messageId === rootEvent.event.messageId ||
isReadByMe($messagesRead, evt)}
readByMe={
evt.event.messageId === rootEvent.event.messageId ||
!isFollowedByMe ||
isReadByMe($messagesRead, evt)
}
readByThem
observer={messageObserver}
focused={evt.event.kind === "message" &&
Expand Down
10 changes: 0 additions & 10 deletions frontend/openchat-client/src/openchat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2208,16 +2208,6 @@ export class OpenChat extends OpenChatAgentWorker {
return [resp.events, userIds];
}

private lastMessageIndex(events: EventWrapper<ChatEvent>[]): number | undefined {
for (let i = events.length - 1; i >= 0; i--) {
const evt = events[i].event;
if (evt.kind === "message") {
return evt.messageIndex;
}
}
return undefined;
}

removeChat(chatId: ChatIdentifier): void {
if (this._liveState.uninitializedDirectChats.has(chatId)) {
removeUninitializedDirectChat(chatId);
Expand Down

0 comments on commit 5c06ec1

Please sign in to comment.