1
0

Merge commit 'refs/pull/2462/head' of https://github.com/glitch-soc/mastodon

This commit is contained in:
Noa Himesaka 2024-08-24 22:54:36 +09:00
commit bd3ef05053
3 changed files with 35 additions and 8 deletions

View File

@ -6,13 +6,27 @@ import type { NotificationGroupReaction } from 'flavours/glitch/models/notificat
import type { LabelRenderer } from './notification_group_with_status';
import { NotificationGroupWithStatus } from './notification_group_with_status';
const labelRenderer: LabelRenderer = (values) => (
<FormattedMessage
id='notification.reaction'
defaultMessage='{name} reacted to your status'
values={values}
/>
);
const labelRenderer: LabelRenderer = (displayedName, total) => {
if (total === 1)
return (
<FormattedMessage
id='notification.reaction'
defaultMessage='{name} reacted to your status'
values={{ name: displayedName }}
/>
);
return (
<FormattedMessage
id='notification.reaction.name_and_others'
defaultMessage='{name} and {count, plural, one {# other} other {# others}} reacted to your post'
values={{
name: displayedName,
count: total - 1,
}}
/>
);
};
export const NotificationReaction: React.FC<{
notification: NotificationGroupReaction;

View File

@ -56,6 +56,7 @@
"navigation_bar.misc": "Misc",
"notification.markForDeletion": "Mark for deletion",
"notification.reaction": "{name} reacted to your post",
"notification.reaction.name_and_others": "{name} and {count, plural, one {# other} other {# others}} reacted to your post",
"notification_purge.btn_all": "Select\nall",
"notification_purge.btn_apply": "Clear\nselected",
"notification_purge.btn_invert": "Invert\nselection",
@ -159,8 +160,11 @@
"status.is_poll": "This toot is a poll",
"status.local_only": "Only visible from your instance",
"status.react": "React",
<<<<<<< HEAD
"status.show_filter_reason": "Show anyway",
"status.show_less": "Show less",
"status.show_more": "Show more",
=======
>>>>>>> e3dbd2e6489b90f68b5a207c7561ebf7435f967c
"status.uncollapse": "Uncollapse"
}

View File

@ -32,7 +32,7 @@ class StatusCacheHydrator
payload[:bookmarked] = Bookmark.exists?(account_id: account_id, status_id: @status.id)
payload[:pinned] = StatusPin.exists?(account_id: account_id, status_id: @status.id) if @status.account_id == account_id
payload[:filtered] = mapped_applied_custom_filter(account_id, @status)
payload[:reactions] = serialized_reactions(account_id)
payload[:reactions] = serialized_reactions(account_id, @status)
if payload[:poll]
payload[:poll][:voted] = @status.account_id == account_id
@ -58,7 +58,11 @@ class StatusCacheHydrator
payload[:reblog][:bookmarked] = Bookmark.exists?(account_id: account_id, status_id: @status.reblog_of_id)
payload[:reblog][:pinned] = StatusPin.exists?(account_id: account_id, status_id: @status.reblog_of_id) if @status.reblog.account_id == account_id
payload[:reblog][:filtered] = payload[:filtered]
<<<<<<< HEAD
payload[:reblog][:reactions] = serialized_reactions(account_id)
=======
payload[:reblog][:reactions] = serialized_reactions(account_id, @status.reblog)
>>>>>>> e3dbd2e6489b90f68b5a207c7561ebf7435f967c
if payload[:reblog][:poll]
if @status.reblog.account_id == account_id
@ -90,8 +94,13 @@ class StatusCacheHydrator
).as_json
end
<<<<<<< HEAD
def serialized_reactions(account_id)
reactions = @status.reactions(account_id)
=======
def serialized_reactions(account_id, status)
reactions = status.reactions(account_id)
>>>>>>> e3dbd2e6489b90f68b5a207c7561ebf7435f967c
ActiveModelSerializers::SerializableResource.new(
reactions,
each_serializer: REST::ReactionSerializer,