Class: Thredded::UserResetsPrivateTopicToUnread
- Inherits:
-
Object
- Object
- Thredded::UserResetsPrivateTopicToUnread
- Defined in:
- app/commands/thredded/user_resets_private_topic_to_unread.rb
Instance Method Summary collapse
-
#initialize(private_topic, user) ⇒ UserResetsPrivateTopicToUnread
constructor
A new instance of UserResetsPrivateTopicToUnread.
- #run ⇒ Object
Constructor Details
#initialize(private_topic, user) ⇒ UserResetsPrivateTopicToUnread
Returns a new instance of UserResetsPrivateTopicToUnread.
3 4 5 6 |
# File 'app/commands/thredded/user_resets_private_topic_to_unread.rb', line 3 def initialize(private_topic, user) @private_topic = private_topic @user = user end |
Instance Method Details
#run ⇒ Object
8 9 10 11 12 13 |
# File 'app/commands/thredded/user_resets_private_topic_to_unread.rb', line 8 def run other_users = Thredded::PrivateUser .where(private_topic: private_topic) .where.not(user_id: user.id) other_users.update_all(read: false) end |