Class: Pageflow::CommentThreadRead Private
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Pageflow::CommentThreadRead
- Defined in:
- app/models/pageflow/comment_thread_read.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Records when a user last read a comment thread. Keyed by perma id so read state survives comment threads being copied to a new revision.
Class Method Summary collapse
- .mark(entry:, user:, comment_thread_perma_ids:, read_at: Time.current) ⇒ Object private
- .read_at_by_perma_id(entry:, user:) ⇒ Object private
Class Method Details
.mark(entry:, user:, comment_thread_perma_ids:, read_at: Time.current) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
15 16 17 18 19 20 |
# File 'app/models/pageflow/comment_thread_read.rb', line 15 def self.mark(entry:, user:, comment_thread_perma_ids:, read_at: Time.current) comment_thread_perma_ids.each do |perma_id| find_or_initialize_by(entry:, user:, comment_thread_perma_id: perma_id) .update!(read_at:) end end |
.read_at_by_perma_id(entry:, user:) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
11 12 13 |
# File 'app/models/pageflow/comment_thread_read.rb', line 11 def self.read_at_by_perma_id(entry:, user:) where(entry:, user:).pluck(:comment_thread_perma_id, :read_at).to_h end |