Update emoji reaction patches

This commit is contained in:
Jeremy Kescher 2023-05-07 22:01:04 +02:00
parent f214cd2938
commit bcab2d89ca
No known key found for this signature in database
GPG key ID: 80A419A7A613DFA4
4 changed files with 23 additions and 18 deletions

View file

@ -123,7 +123,7 @@ class StatusActionBar extends ImmutablePureComponent {
handleEmojiPick = data => { handleEmojiPick = data => {
this.props.onReactionAdd(this.props.status.get('id'), data.native.replace(/:/g, ''), data.imageUrl); this.props.onReactionAdd(this.props.status.get('id'), data.native.replace(/:/g, ''), data.imageUrl);
} };
handleReblogClick = e => { handleReblogClick = e => {
const { signedIn } = this.context.identity; const { signedIn } = this.context.identity;
@ -205,7 +205,7 @@ class StatusActionBar extends ImmutablePureComponent {
this.props.onAddFilter(this.props.status); this.props.onAddFilter(this.props.status);
}; };
handleNoOp = () => {} // hack for reaction add button handleNoOp = () => {}; // hack for reaction add button
render () { render () {
const { status, intl, withDismiss, withCounters, showReplyCount, scrollKey } = this.props; const { status, intl, withDismiss, withCounters, showReplyCount, scrollKey } = this.props;

View file

@ -320,11 +320,11 @@ class Status extends ImmutablePureComponent {
if (signedIn) { if (signedIn) {
dispatch(addReaction(statusId, name, url)); dispatch(addReaction(statusId, name, url));
} }
} };
handleReactionRemove = (statusId, name) => { handleReactionRemove = (statusId, name) => {
this.props.dispatch(removeReaction(statusId, name)); this.props.dispatch(removeReaction(statusId, name));
} };
handlePin = (status) => { handlePin = (status) => {
if (status.get('pinned')) { if (status.get('pinned')) {

View file

@ -3,21 +3,21 @@
class UnreactService < BaseService class UnreactService < BaseService
include Payloadable include Payloadable
def call(account, status, emoji) def call(account, status, emoji)
name, domain = emoji.split('@') name, domain = emoji.split('@')
custom_emoji = CustomEmoji.find_by(shortcode: name, domain: domain) custom_emoji = CustomEmoji.find_by(shortcode: name, domain: domain)
reaction = StatusReaction.find_by(account: account, status: status, name: name, custom_emoji: custom_emoji) reaction = StatusReaction.find_by(account: account, status: status, name: name, custom_emoji: custom_emoji)
return if reaction.nil? return if reaction.nil?
reaction.destroy! reaction.destroy!
json = Oj.dump(serialize_payload(reaction, ActivityPub::UndoEmojiReactionSerializer)) json = Oj.dump(serialize_payload(reaction, ActivityPub::UndoEmojiReactionSerializer))
if status.account.local? if status.account.local?
ActivityPub::RawDistributionWorker.perform_async(json, status.account.id) ActivityPub::RawDistributionWorker.perform_async(json, status.account.id)
else else
ActivityPub::DeliveryWorker.perform_async(json, reaction.account_id, status.account.inbox_url) ActivityPub::DeliveryWorker.perform_async(json, reaction.account_id, status.account.inbox_url)
end
reaction
end end
reaction
end
end end

View file

@ -45,3 +45,8 @@ en:
body: "%{name} reacted to your post:" body: "%{name} reacted to your post:"
subject: "%{name} reacted to your post" subject: "%{name} reacted to your post"
title: New reaction title: New reaction
notification_mailer:
reaction:
body: "%{name} reacted to your post:"
subject: "%{name} reacted to your post"
title: New reaction