Files
fizzy/app/models/mention.rb
T
Donal McBreen fc56ad9d7c Combine uuid-old and uuid branch changes
- Switch to binary 16 for UUID keys
- Remove AccountScopedRecord base class, all model use binary uuids now
- Fix the search sql to serialize uuids properly
- Patch the MySQL schema dumper to output binary lengths
2025-11-17 09:12:34 -05:00

25 lines
474 B
Ruby

class Mention < ApplicationRecord
include Notifiable
belongs_to :source, polymorphic: true
belongs_to :mentioner, class_name: "User"
belongs_to :mentionee, class_name: "User", inverse_of: :mentions
after_create_commit :watch_source_by_mentionee
delegate :card, to: :source
def self_mention?
mentioner == mentionee
end
def notifiable_target
source
end
private
def watch_source_by_mentionee
source.watch_by(mentionee)
end
end