Welcome to mirror list, hosted at ThFree Co, Russian Federation.

mention.rb « models « app - github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f882e727c5a35f65558c4650b065b3abd93c38a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true

#   Copyright (c) 2010-2011, Diaspora Inc.  This file is
#   licensed under the Affero General Public License version 3 or later.  See
#   the COPYRIGHT file.

class Mention < ApplicationRecord
  belongs_to :mentions_container, polymorphic: true
  belongs_to :person

  scope :local, -> {
    joins(:person).where.not(people: {owner_id: nil})
  }

  after_destroy :delete_notification

  def delete_notification
    Notification.where(target_type: self.class.name, target_id: id).destroy_all
  end
end