FEATURE: Initial chat thread unread indicators (#21694)

This commit adds the thread index and individual thread
in the index list unread indicators, and wires up the message
bus events to mark the threads as read/unread when:

1. People send a new message in the thread
2. The user marks a thread as read

There are several hacky parts and TODOs to cover before
this is more functional:

1. We need to flesh out the thread scrolling and message
   visibility behaviour. Currently if you scroll to the end
   of the thread it will just mark the whole thread read
   unconditionally.
2. We need to send down the thread current user membership
   along with the last read message ID to the client and
   update that with read state.
3. We need to handle the sidebar unread dot for when threads
   are unread in the channel and clear it based on when the
   channel was last viewed.
4. We need to show some indicator of thread unreads on the
   thread indicators on original messages.
5. UI improvements to make the experience nicer and more
   like the actual design rather than just placeholders.

But, the basic premise around incrementing/decrementing the
thread overview count and showing which thread is unread
in the list is working as intended.
This commit is contained in:
Martin Brennan
2023-05-25 09:56:19 +02:00
committed by GitHub
parent eae47d82e2
commit b6c5a2da08
50 changed files with 665 additions and 167 deletions

View File

@ -2,12 +2,13 @@
module Chat
class ThreadsView
attr_reader :user, :channel, :threads
attr_reader :user, :channel, :threads, :tracking
def initialize(channel:, threads:, user:)
def initialize(channel:, threads:, user:, tracking:)
@channel = channel
@threads = threads
@user = user
@tracking = tracking
end
end
end

View File

@ -7,7 +7,7 @@ module Chat
:chat_messages,
:can_load_more_past,
:can_load_more_future,
:thread_tracking_overview,
:unread_thread_ids,
:threads,
:tracking
@ -17,7 +17,7 @@ module Chat
user:,
can_load_more_past: nil,
can_load_more_future: nil,
thread_tracking_overview: nil,
unread_thread_ids: nil,
threads: nil,
tracking: nil
)
@ -26,7 +26,7 @@ module Chat
@user = user
@can_load_more_past = can_load_more_past
@can_load_more_future = can_load_more_future
@thread_tracking_overview = thread_tracking_overview
@unread_thread_ids = unread_thread_ids
@threads = threads
@tracking = tracking
end