mirror of
https://github.com/funamitech/mastodon
synced 2024-12-16 07:38:27 +09:00
ddd30f331c
* Add silent column to mentions * Save silent mentions in ActivityPub Create handler and optimize it Move networking calls out of the database transaction * Add "limited" visibility level masked as "private" in the API Unlike DMs, limited statuses are pushed into home feeds. The access control rules between direct and limited statuses is almost the same, except for counter and conversation logic * Ensure silent column is non-null, add spec * Ensure filters don't check silent mentions for blocks/mutes As those are "this person is also allowed to see" rather than "this person is involved", therefore does not warrant filtering * Clean up code * Use Status#active_mentions to limit returned mentions * Fix code style issues * Use Status#active_mentions in Notification And remove stream_entry eager-loading from Notification
36 lines
748 B
Ruby
36 lines
748 B
Ruby
# frozen_string_literal: true
|
|
# == Schema Information
|
|
#
|
|
# Table name: mentions
|
|
#
|
|
# id :bigint(8) not null, primary key
|
|
# status_id :bigint(8)
|
|
# created_at :datetime not null
|
|
# updated_at :datetime not null
|
|
# account_id :bigint(8)
|
|
# silent :boolean default(FALSE), not null
|
|
#
|
|
|
|
class Mention < ApplicationRecord
|
|
belongs_to :account, inverse_of: :mentions
|
|
belongs_to :status
|
|
|
|
has_one :notification, as: :activity, dependent: :destroy
|
|
|
|
validates :account, uniqueness: { scope: :status }
|
|
|
|
scope :active, -> { where(silent: false) }
|
|
scope :silent, -> { where(silent: true) }
|
|
|
|
delegate(
|
|
:username,
|
|
:acct,
|
|
to: :account,
|
|
prefix: true
|
|
)
|
|
|
|
def active?
|
|
!silent?
|
|
end
|
|
end
|