Sha256: b14cb9657b947ac9473e1015d6ac679cc6ea46eb3dfc90c4fe6b455dba4d9bfe

Contents?: true

Size: 388 Bytes

Versions: 5

Compression:

Stored size: 388 Bytes

Contents

# frozen_string_literal: true

module Thredded
  class MarkAllRead
    def self.run(user)
      unread_topics = Thredded::PrivateTopic.unread(user)
      return if unread_topics.empty?

      unread_topics.each do |topic|
        last_post = topic.posts.order_oldest_first.last

        Thredded::UserPrivateTopicReadState.touch!(user.id, topic.id, last_post)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
thredded-0.15.5 app/commands/thredded/mark_all_read.rb
thredded-0.15.4 app/commands/thredded/mark_all_read.rb
thredded-0.15.3 app/commands/thredded/mark_all_read.rb
thredded-0.15.2 app/commands/thredded/mark_all_read.rb
thredded-0.15.1 app/commands/thredded/mark_all_read.rb