FEATURE: Track last_viewed_at datetime for channel members (#22294)

Whenever a user opens a channel or marks it read, we now
update the last_viewed_at datetime for that channel membership
record. This is so we will be able to show thread unread indicators
in the channel sidebar that clear independently of the main thread
unread indicators. This unread functionality will follow in another
PR.
This commit is contained in:
Martin Brennan
2023-06-29 09:22:17 +10:00
committed by GitHub
parent 58c14ba0f9
commit 1194ed10e1
6 changed files with 40 additions and 4 deletions

View File

@@ -0,0 +1,11 @@
# frozen_string_literal: true
class AddLastViewedAtToUserChatChannelMemberships < ActiveRecord::Migration[7.0]
def change
add_column :user_chat_channel_memberships,
:last_viewed_at,
:datetime,
null: false,
default: -> { "CURRENT_TIMESTAMP" }
end
end