Class: Comment
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Comment
- Includes:
- RecsysHelpers, RelationHelpers, Utils
- Defined in:
- app/models/comment.rb
Instance Method Summary collapse
Methods included from Utils
#obj_type, #reindex, #sanitize, #sanitize_content, #sanitize_description
Methods included from RelationHelpers
#clappers, #claps_count, #followers, #followers_count, #reviews_count, #saves_count
Methods included from RecsysHelpers
Instance Method Details
#frontend_link ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'app/models/comment.rb', line 20 def frontend_link if post "/post/#{post.id}" else # quick fix for orphaned comment breaking notifications # longer-term fix: don't orphan comments '/404' end end |
#notif_new_comment ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/models/comment.rb', line 30 def notif_new_comment Notification.for_group( :post_participants_except_commenter, args: [post, self], attrs: { category: :comment, type: 'new_comment', object: self, metadata: { commentor: user, post: post } } ) end |