Class: Thredded::UserReadsPrivateTopic

Inherits:
Object
  • Object
show all
Defined in:
app/commands/thredded/user_reads_private_topic.rb

Instance Method Summary collapse

Constructor Details

#initialize(private_topic, user) ⇒ UserReadsPrivateTopic



3
4
5
6
# File 'app/commands/thredded/user_reads_private_topic.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
# File 'app/commands/thredded/user_reads_private_topic.rb', line 8

def run
  private_user = Thredded::PrivateUser
    .find_by(private_topic_id: private_topic.id, user_id: user.id)
  private_user.update_attributes(read: true)
end