Class: Thredded::NotifyPrivateTopicUsers
- Inherits:
-
Object
- Object
- Thredded::NotifyPrivateTopicUsers
- Defined in:
- app/commands/thredded/notify_private_topic_users.rb
Instance Method Summary collapse
-
#initialize(private_post) ⇒ NotifyPrivateTopicUsers
constructor
A new instance of NotifyPrivateTopicUsers.
- #private_topic_recipients ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize(private_post) ⇒ NotifyPrivateTopicUsers
Returns a new instance of NotifyPrivateTopicUsers.
4 5 6 7 |
# File 'app/commands/thredded/notify_private_topic_users.rb', line 4 def initialize(private_post) @post = private_post @private_topic = private_post.postable end |
Instance Method Details
#private_topic_recipients ⇒ Object
20 21 22 23 24 25 |
# File 'app/commands/thredded/notify_private_topic_users.rb', line 20 def private_topic_recipients members = private_topic.users - [post.user] members = (members) members = exclude_previously_notified(members) members end |
#run ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'app/commands/thredded/notify_private_topic_users.rb', line 9 def run members = private_topic_recipients return unless members.present? user_emails = members.map(&:email) PrivateTopicMailer .(private_topic.id, user_emails) .deliver_later mark_notified(members) end |