Module: Talkie::Mentionable
- Extended by:
- ActiveSupport::Concern
- Included in:
- Comment
- Defined in:
- app/models/concerns/talkie/mentionable.rb
Instance Method Summary collapse
- #check_for_mentions! ⇒ Object
- #mention_tokens ⇒ Object
- #mentions? ⇒ Boolean
- #notify_mentionees! ⇒ Object
Instance Method Details
#check_for_mentions! ⇒ Object
14 15 16 17 18 |
# File 'app/models/concerns/talkie/mentionable.rb', line 14 def check_for_mentions! subscribers.each do |subscriber| self.subscriptions.build(subscriber: subscriber) end end |
#mention_tokens ⇒ Object
28 29 30 |
# File 'app/models/concerns/talkie/mentionable.rb', line 28 def mention_tokens @mention_tokens || Talkie::NilMentionTokens.new.to_s end |
#mentions? ⇒ Boolean
20 21 22 |
# File 'app/models/concerns/talkie/mentionable.rb', line 20 def mentions? mention_tokens.present? end |
#notify_mentionees! ⇒ Object
24 25 26 |
# File 'app/models/concerns/talkie/mentionable.rb', line 24 def notify_mentionees! NotificationsMailer.with(comment: self, recipients: subscribers.pluck(:email)).mentioned.deliver_now end |