Class: Slk::Services::UnreadMarker
- Inherits:
-
Object
- Object
- Slk::Services::UnreadMarker
- Defined in:
- lib/slk/services/unread_marker.rb
Overview
Handles batch marking of unreads as read
Instance Method Summary collapse
-
#initialize(conversations_api:, threads_api:, client_api:, users_api:, on_debug: nil) ⇒ UnreadMarker
constructor
A new instance of UnreadMarker.
-
#mark_all(options: {}) ⇒ Hash
Mark all unreads in a workspace, return counts.
-
#mark_single_channel(channel_id) ⇒ Boolean
Mark a single channel as read.
Constructor Details
#initialize(conversations_api:, threads_api:, client_api:, users_api:, on_debug: nil) ⇒ UnreadMarker
Returns a new instance of UnreadMarker.
7 8 9 10 11 12 13 |
# File 'lib/slk/services/unread_marker.rb', line 7 def initialize(conversations_api:, threads_api:, client_api:, users_api:, on_debug: nil) @conversations = conversations_api @threads = threads_api @client = client_api @users = users_api @on_debug = on_debug end |
Instance Method Details
#mark_all(options: {}) ⇒ Hash
Mark all unreads in a workspace, return counts
18 19 20 21 22 23 24 25 26 |
# File 'lib/slk/services/unread_marker.rb', line 18 def mark_all(options: {}) counts = @client.counts { dms: mark_dms(counts['ims'] || []), channels: mark_channels(counts['channels'] || [], muted: [:muted]), threads: mark_threads } end |
#mark_single_channel(channel_id) ⇒ Boolean
Mark a single channel as read
31 32 33 |
# File 'lib/slk/services/unread_marker.rb', line 31 def mark_single_channel(channel_id) mark_conversation(channel_id) end |