Class: Thredded::AutofollowMentionedUsers
- Inherits:
-
Object
- Object
- Thredded::AutofollowMentionedUsers
- Defined in:
- app/commands/thredded/autofollow_mentioned_users.rb
Instance Method Summary collapse
- #autofollowers ⇒ Object
-
#initialize(post) ⇒ AutofollowMentionedUsers
constructor
A new instance of AutofollowMentionedUsers.
- #run ⇒ Object
Constructor Details
#initialize(post) ⇒ AutofollowMentionedUsers
Returns a new instance of AutofollowMentionedUsers.
5 6 7 |
# File 'app/commands/thredded/autofollow_mentioned_users.rb', line 5 def initialize(post) @post = post end |
Instance Method Details
#autofollowers ⇒ Object
15 16 17 18 19 |
# File 'app/commands/thredded/autofollow_mentioned_users.rb', line 15 def autofollowers autofollowers = Thredded::AtNotificationExtractor.new(post).run autofollowers.delete(post.user) exclude_those_opting_out_of_at_notifications autofollowers end |
#run ⇒ Object
9 10 11 12 13 |
# File 'app/commands/thredded/autofollow_mentioned_users.rb', line 9 def run autofollowers.each do |user| Thredded::UserTopicFollow.create_unless_exists(user.id, post.postable_id, :mentioned) end end |