Class: Thredded::NotifyFollowingUsers

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

Instance Method Summary collapse

Constructor Details

#initialize(post) ⇒ NotifyFollowingUsers

Returns a new instance of NotifyFollowingUsers.



4
5
6
# File 'app/commands/thredded/notify_following_users.rb', line 4

def initialize(post)
  @post = post
end

Instance Method Details

#runObject



8
9
10
11
12
# File 'app/commands/thredded/notify_following_users.rb', line 8

def run
  return if targeted_users.empty?
  PostMailer.post_notification(@post.id, targeted_users.map(&:email)).deliver_now
  MembersMarkedNotified.new(@post, targeted_users).run
end

#targeted_usersObject



14
15
16
# File 'app/commands/thredded/notify_following_users.rb', line 14

def targeted_users
  @targeted_users ||= @post.postable.followers.reject { |u| u == @post.user }
end