Sha256: dc061ce603aea60649a64920a2b6b3e6775249a0ab67106492416693c33988e8
Contents?: true
Size: 505 Bytes
Versions: 14
Compression:
Stored size: 505 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 total_pages = topic.posts.page(1).total_pages Thredded::UserPrivateTopicReadState.touch!( user.id, topic.id, last_post, total_pages ) end end end end
Version data entries
14 entries across 14 versions & 2 rubygems