Class: Mention
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Mention
- Defined in:
- app/models/mention.rb
Instance Method Summary collapse
- #notif_new_mention(mentioner) ⇒ Object
- #notif_new_mention_obj(mentioner) ⇒ Object
- #notif_new_mention_user(mentioner) ⇒ Object
Instance Method Details
#notif_new_mention(mentioner) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'app/models/mention.rb', line 11 def notif_new_mention(mentioner) case obj.class.name when 'User' notif_new_mention_user(mentioner) when 'Comment', 'Project' notif_new_mention_obj(mentioner) end end |
#notif_new_mention_obj(mentioner) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/models/mention.rb', line 32 def notif_new_mention_obj(mentioner) Notification.for_group( :admins, args: [obj], attrs: { category: :mention, type: 'new_mention', object: post, metadata: { mentioner: mentioner } } ) end |
#notif_new_mention_user(mentioner) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/models/mention.rb', line 20 def notif_new_mention_user(mentioner) Notification.create( target: obj, category: :mention, type: 'new_mention', object: post, metadata: { mentioner: mentioner } ) end |