Update emoji reaction patches

This commit is contained in:
Jeremy Kescher 2023-05-07 22:01:04 +02:00
parent 9133f5af9d
commit 7f1b0f43e9
No known key found for this signature in database
GPG key ID: 80A419A7A613DFA4
4 changed files with 24 additions and 20 deletions

View file

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

View file

@ -42,7 +42,7 @@ import { initMuteModal } from 'flavours/glitch/actions/mutes';
import { initBlockModal } from 'flavours/glitch/actions/blocks';
import { initReport } from 'flavours/glitch/actions/reports';
import { initBoostModal } from 'flavours/glitch/actions/boosts';
import { makeCustomEmojiMap, makeGetStatus, makeGetPictureInPicture } from 'flavours/glitch/selectors';
import { makeGetStatus, makeGetPictureInPicture } from 'flavours/glitch/selectors';
import ScrollContainer from 'flavours/glitch/containers/scroll_container';
import ColumnHeader from '../../components/column_header';
import StatusContainer from 'flavours/glitch/containers/status_container';
@ -57,7 +57,6 @@ import { textForScreenReader, defaultMediaVisibility } from 'flavours/glitch/com
import { Icon } from 'flavours/glitch/components/icon';
import { Helmet } from 'react-helmet';
import BundleColumnError from 'flavours/glitch/features/ui/components/bundle_column_error';
import { makeCustomEmojiMap } from '../../selectors';
const messages = defineMessages({
deleteConfirm: { id: 'confirmations.delete.confirm', defaultMessage: 'Delete' },
@ -305,11 +304,11 @@ class Status extends ImmutablePureComponent {
if (signedIn) {
dispatch(addReaction(statusId, name, url));
}
}
};
handleReactionRemove = (statusId, name) => {
this.props.dispatch(removeReaction(statusId, name));
}
};
handlePin = (status) => {
if (status.get('pinned')) {

View file

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

View file

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