Skip to content

Commit

Permalink
Fix: ローカルサーバーのスタンプ利用可否が正しく反映できない問題 (#219)
Browse files Browse the repository at this point in the history
* Fix: ローカルサーバーのスタンプ利用可否が正しく反映できない問題

* 不要な分岐を削除

* Fix: Presenterの使用を中止(どうせキャッシュしてるので)
  • Loading branch information
kmycode authored Nov 2, 2023
1 parent 86afcdb commit 3777991
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
2 changes: 0 additions & 2 deletions app/models/instance_info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ def self.emoji_reaction_available?(domain)
end

def self.fetch_emoji_reaction_available(domain)
return Setting.enable_emoji_reaction if domain.nil?

info = InstanceInfo.find_by(domain: domain)
return false if info.nil?

Expand Down
2 changes: 0 additions & 2 deletions app/presenters/status_relationships_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ def initialize(statuses, current_account_id = nil, **options)
@pins_map = {}
@filters_map = {}
@emoji_reaction_allows_map = nil
@emoji_reaction_availables_map = {}
else
statuses = statuses.compact
statuses += statuses.filter_map(&:quote)
Expand All @@ -36,7 +35,6 @@ def initialize(statuses, current_account_id = nil, **options)
@domain_blocks_map = Status.domain_blocks_map(statuses.filter_map { |status| status.account.domain }.uniq, current_account_id).merge(options[:domain_blocks_map] || {})
@pins_map = Status.pins_map(pinnable_status_ids, current_account_id).merge(options[:pins_map] || {})
@emoji_reaction_allows_map = Status.emoji_reaction_allows_map(status_ids, current_account_id).merge(options[:emoji_reaction_allows_map] || {})
@emoji_reaction_availables_map = Status.emoji_reaction_availables_map(statuses.filter_map { |status| status.account.domain }.uniq).merge(options[:emoji_reaction_availables_map] || {})
@attributes_map = options[:attributes_map] || {}
end
end
Expand Down
8 changes: 3 additions & 5 deletions app/serializers/rest/status_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,9 @@ def show_emoji_reaction?
end

def emoji_reaction_available_server
if relationships
relationships.emoji_reaction_availables_map[object.account.domain] || false
else
InstanceInfo.emoji_reaction_available?(object.account.domain)
end
return Setting.enable_emoji_reaction if object.local?

InstanceInfo.emoji_reaction_available?(object.account.domain)
end

def reactions
Expand Down

0 comments on commit 3777991

Please sign in to comment.