Add mutual visibility support
This commit is contained in:
parent
9662e6ae32
commit
79062bfc2f
14 changed files with 85 additions and 9 deletions
|
@ -303,6 +303,10 @@ module AccountInteractions
|
|||
end
|
||||
end
|
||||
|
||||
def mutuals
|
||||
followers.merge(Account.where(id: following))
|
||||
end
|
||||
|
||||
def relations_map(account_ids, domains = nil, **options)
|
||||
relations = {
|
||||
blocked_by: Account.blocked_by_map(account_ids, id),
|
||||
|
|
|
@ -79,6 +79,7 @@ class Status < ApplicationRecord
|
|||
has_many :references, through: :reference_objects, class_name: 'Status', source: :target_status
|
||||
has_many :referenced_by_status_objects, foreign_key: 'target_status_id', class_name: 'StatusReference', inverse_of: :target_status, dependent: :destroy
|
||||
has_many :referenced_by_statuses, through: :referenced_by_status_objects, class_name: 'Status', source: :status
|
||||
has_many :capability_tokens, class_name: 'StatusCapabilityToken', inverse_of: :status, dependent: :destroy
|
||||
|
||||
has_and_belongs_to_many :tags
|
||||
has_and_belongs_to_many :preview_cards
|
||||
|
|
25
app/models/status_capability_token.rb
Normal file
25
app/models/status_capability_token.rb
Normal file
|
@ -0,0 +1,25 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: status_capability_tokens
|
||||
#
|
||||
# id :bigint(8) not null, primary key
|
||||
# status_id :bigint(8) not null
|
||||
# token :string
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
#
|
||||
class StatusCapabilityToken < ApplicationRecord
|
||||
belongs_to :status
|
||||
|
||||
validates :token, presence: true
|
||||
|
||||
before_validation :generate_token, on: :create
|
||||
|
||||
private
|
||||
|
||||
def generate_token
|
||||
self.token = Doorkeeper::OAuth::Helpers::UniqueToken.generate
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue