Fix hiding emoji reactions from anonymous
This commit is contained in:
parent
ac33bc86fe
commit
d450549d14
4 changed files with 9 additions and 1 deletions
|
@ -15,6 +15,10 @@ class Api::V1::Statuses::EmojiReactionedByAccountsController < Api::BaseControll
|
|||
private
|
||||
|
||||
def load_accounts
|
||||
return [] unless Setting.enable_emoji_reaction
|
||||
return [] if current_account.nil? && @status.account.emoji_reaction_policy != :allow
|
||||
return [] if current_account.present? && !@status.account.show_emoji_reaction?(current_account)
|
||||
|
||||
scope = default_accounts
|
||||
scope = scope.where.not(account_id: current_account.excluded_from_timeline_account_ids) unless current_account.nil?
|
||||
scope.merge(paginated_emoji_reactions).to_a
|
||||
|
|
|
@ -351,6 +351,7 @@ class Status < ApplicationRecord
|
|||
|
||||
def emoji_reactions_grouped_by_name(account = nil)
|
||||
return [] if account.present? && !self.account.show_emoji_reaction?(account)
|
||||
return [] if account.nil? && self.account.emoji_reaction_policy != :allow
|
||||
|
||||
(Oj.load(status_stat&.emoji_reactions || '', mode: :strict) || []).tap do |emoji_reactions|
|
||||
if account.present?
|
||||
|
|
|
@ -65,6 +65,7 @@ class InitialStateSerializer < ActiveModel::Serializer
|
|||
store[:display_media] = Setting.display_media
|
||||
store[:reduce_motion] = Setting.reduce_motion
|
||||
store[:use_blurhash] = Setting.use_blurhash
|
||||
store[:enable_emoji_reaction] = Setting.enable_emoji_reaction
|
||||
end
|
||||
|
||||
store[:disabled_account_id] = object.disabled_account.id.to_s if object.disabled_account
|
||||
|
|
|
@ -127,7 +127,9 @@ class REST::StatusSerializer < ActiveModel::Serializer
|
|||
|
||||
def emoji_reactions_count
|
||||
if current_user&.account.nil?
|
||||
Setting.enable_emoji_reaction ? object.emoji_reactions_count : 0
|
||||
return 0 unless Setting.enable_emoji_reaction
|
||||
|
||||
object.account.emoji_reaction_policy == :allow ? object.emoji_reactions_count : 0
|
||||
else
|
||||
object.account.show_emoji_reaction?(current_user.account) ? object.emoji_reactions_count : 0
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue