Class: Thredded::NotifyFollowingUsers
- Inherits:
-
Object
- Object
- Thredded::NotifyFollowingUsers
- Defined in:
- app/commands/thredded/notify_following_users.rb
Instance Method Summary collapse
-
#initialize(post) ⇒ NotifyFollowingUsers
constructor
A new instance of NotifyFollowingUsers.
- #run ⇒ Object
- #targeted_users ⇒ Object
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
#run ⇒ Object
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_users ⇒ Object
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 |