1
0
mirror of https://github.com/funamitech/mastodon synced 2024-12-15 23:28:31 +09:00

Don't set me to true for remote reactions

When an account and a remote account reacted with a custom emoji with the same shortcode, the `me` attribute was also true for the remote reaction, despite being a different emoji.

This query should probably be optimised, but it works.

Signed-off-by: Plastikmensch <plastikmensch@users.noreply.github.com>
This commit is contained in:
Plastikmensch 2023-05-15 00:08:18 +02:00 committed by Jeremy Kescher
parent e90ab798a1
commit 51b00dd034
No known key found for this signature in database
GPG Key ID: 80A419A7A613DFA4

View File

@ -300,7 +300,7 @@ class Status < ApplicationRecord
if account.nil? if account.nil?
scope.select('name, custom_emoji_id, count(*) as count, false as me') scope.select('name, custom_emoji_id, count(*) as count, false as me')
else else
scope.select("name, custom_emoji_id, count(*) as count, exists(select 1 from status_reactions r where r.account_id = #{account.id} and r.status_id = status_reactions.status_id and r.name = status_reactions.name) as me") scope.select("name, custom_emoji_id, count(*) as count, exists(select 1 from status_reactions r where r.account_id = #{account.id} and r.status_id = status_reactions.status_id and r.name = status_reactions.name and (r.custom_emoji_id = status_reactions.custom_emoji_id or r.custom_emoji_id is null and status_reactions.custom_emoji_id is null)) as me")
end end
end end