<commit_before>class Notification < ActiveRecord::Base
  belongs_to :user
  belongs_to :created_by, :class_name => "User"
  belongs_to :channel
  belongs_to :post

  scope :for_user, proc { |user|
    where(:user_id => user.id).order("notifications.id DESC")
  }
  scope :since, proc { |id| where("id > ?", id) }
  scope :read, proc { where("read = ?", true) }
  scope :unread, proc { where("read = ?", false) }
  scope :messages, proc { where(:notification_type => "message") }
  scope :mentions, proc { where(:notification_type => "mention") }
  scope :toolbar_notifications, proc { where(:notification_type => ["message", "mention"]) }
  scope :from_user, proc { |user| messages.where(:created_by_id => user.id) }

  class << self
    def mention(from, to, channel, post)<commit_msg>Fix mention invalidation<commit_after>class Notification < ActiveRecord::Base
  belongs_to :user
  belongs_to :created_by, :class_name => "User"
  belongs_to :channel
  belongs_to :post

  scope :for_user, proc { |user|
    where(:user_id => user.id).order("notifications.id DESC")
  }
  scope :since, proc { |id| where("id > ?", id) }
  scope :read, proc { where("read = ?", true) }
  scope :unread, proc { where("read = ?", false) }
  scope :messages, proc { where(:notification_type => "message") }
  scope :mentions, proc { where(:notification_type => "mention") }
  scope :toolbar_notifications, proc { where(:notification_type => ["message", "mention"]) }
  scope :from_user, proc { |user| where(:created_by_id => user.id) }

  class << self
    def mention(from, to, channel, post)
{'fraction_non_alphanumeric': 0.16073697585768743, 'fraction_numerical': 0.0, 'mean_word_length': 4.706521739130435, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7288895', 'n_tokens_mistral': 518, 'n_tokens_neox': 518, 'n_words': 131}