mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-28 00:11:37 +01:00
cherry-pick emoji reaction changes
This commit is contained in:
parent
738433e46a
commit
19491d2032
18 changed files with 111 additions and 18 deletions
|
@ -139,6 +139,7 @@ const excludeTypesFromFilter = filter => {
|
||||||
'follow',
|
'follow',
|
||||||
'follow_request',
|
'follow_request',
|
||||||
'favourite',
|
'favourite',
|
||||||
|
'reaction',
|
||||||
'reblog',
|
'reblog',
|
||||||
'mention',
|
'mention',
|
||||||
'poll',
|
'poll',
|
||||||
|
|
|
@ -726,6 +726,7 @@ class Status extends ImmutablePureComponent {
|
||||||
if (this.props.prepend && account) {
|
if (this.props.prepend && account) {
|
||||||
const notifKind = {
|
const notifKind = {
|
||||||
favourite: 'favourited',
|
favourite: 'favourited',
|
||||||
|
reaction: 'reacted',
|
||||||
reblog: 'boosted',
|
reblog: 'boosted',
|
||||||
reblogged_by: 'boosted',
|
reblogged_by: 'boosted',
|
||||||
status: 'posted',
|
status: 'posted',
|
||||||
|
|
|
@ -56,6 +56,14 @@ export default class StatusPrepend extends React.PureComponent {
|
||||||
values={{ name : link }}
|
values={{ name : link }}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
case 'reaction':
|
||||||
|
return (
|
||||||
|
<FormattedMessage
|
||||||
|
id='notification.reaction'
|
||||||
|
defaultMessage='{name} reacted to your post'
|
||||||
|
values={{ name: link }}
|
||||||
|
/>
|
||||||
|
);
|
||||||
case 'reblog':
|
case 'reblog':
|
||||||
return (
|
return (
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
|
@ -110,6 +118,9 @@ export default class StatusPrepend extends React.PureComponent {
|
||||||
case 'favourite':
|
case 'favourite':
|
||||||
iconId = 'star';
|
iconId = 'star';
|
||||||
break;
|
break;
|
||||||
|
case 'reaction':
|
||||||
|
iconId = 'plus';
|
||||||
|
break;
|
||||||
case 'featured':
|
case 'featured':
|
||||||
iconId = 'thumb-tack';
|
iconId = 'thumb-tack';
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -18,7 +18,6 @@ export default class StatusReactionsBar extends ImmutablePureComponent {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
statusId: PropTypes.string.isRequired,
|
statusId: PropTypes.string.isRequired,
|
||||||
reactions: ImmutablePropTypes.list.isRequired,
|
reactions: ImmutablePropTypes.list.isRequired,
|
||||||
reactionLimit: PropTypes.number.isRequired,
|
|
||||||
addReaction: PropTypes.func.isRequired,
|
addReaction: PropTypes.func.isRequired,
|
||||||
removeReaction: PropTypes.func.isRequired,
|
removeReaction: PropTypes.func.isRequired,
|
||||||
emojiMap: ImmutablePropTypes.map.isRequired,
|
emojiMap: ImmutablePropTypes.map.isRequired,
|
||||||
|
|
|
@ -116,6 +116,17 @@ export default class ColumnSettings extends React.PureComponent {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div role='group' aria-labelledby='notifications-reaction'>
|
||||||
|
<span id='notifications-reaction' className='column-settings__section'><FormattedMessage id='notifications.column_settings.reaction' defaultMessage='Reactions:' /></span>
|
||||||
|
|
||||||
|
<div className='column-settings__pillbar'>
|
||||||
|
<PillBarButton disabled={browserPermission === 'denied'} prefix='notifications_desktop' settings={settings} settingPath={['alerts', 'reaction']} onChange={onChange} label={alertStr} />
|
||||||
|
{showPushSettings && <PillBarButton prefix='notifications_push' settings={pushSettings} settingPath={['alerts', 'reaction']} onChange={this.onPushChange} label={pushStr} />}
|
||||||
|
<PillBarButton prefix='notifications' settings={settings} settingPath={['shows', 'reaction']} onChange={onChange} label={showStr} />
|
||||||
|
<PillBarButton prefix='notifications' settings={settings} settingPath={['sounds', 'reaction']} onChange={onChange} label={soundStr} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div role='group' aria-labelledby='notifications-mention'>
|
<div role='group' aria-labelledby='notifications-mention'>
|
||||||
<span id='notifications-mention' className='column-settings__section'><FormattedMessage id='notifications.column_settings.mention' defaultMessage='Mentions:' /></span>
|
<span id='notifications-mention' className='column-settings__section'><FormattedMessage id='notifications.column_settings.mention' defaultMessage='Mentions:' /></span>
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ import Icon from 'flavours/glitch/components/icon';
|
||||||
const tooltips = defineMessages({
|
const tooltips = defineMessages({
|
||||||
mentions: { id: 'notifications.filter.mentions', defaultMessage: 'Mentions' },
|
mentions: { id: 'notifications.filter.mentions', defaultMessage: 'Mentions' },
|
||||||
favourites: { id: 'notifications.filter.favourites', defaultMessage: 'Favourites' },
|
favourites: { id: 'notifications.filter.favourites', defaultMessage: 'Favourites' },
|
||||||
|
reactions: { id: 'notifications.filter.reactions', defaultMessage: 'Reactions' },
|
||||||
boosts: { id: 'notifications.filter.boosts', defaultMessage: 'Boosts' },
|
boosts: { id: 'notifications.filter.boosts', defaultMessage: 'Boosts' },
|
||||||
polls: { id: 'notifications.filter.polls', defaultMessage: 'Poll results' },
|
polls: { id: 'notifications.filter.polls', defaultMessage: 'Poll results' },
|
||||||
follows: { id: 'notifications.filter.follows', defaultMessage: 'Follows' },
|
follows: { id: 'notifications.filter.follows', defaultMessage: 'Follows' },
|
||||||
|
@ -74,6 +75,13 @@ class FilterBar extends React.PureComponent {
|
||||||
>
|
>
|
||||||
<Icon id='star' fixedWidth />
|
<Icon id='star' fixedWidth />
|
||||||
</button>
|
</button>
|
||||||
|
<button
|
||||||
|
className={selectedFilter === 'reaction' ? 'active' : ''}
|
||||||
|
onClick={this.onClick('reaction')}
|
||||||
|
title={intl.formatMessage(tooltips.reactions)}
|
||||||
|
>
|
||||||
|
<Icon id='plus' fixedWidth />
|
||||||
|
</button>
|
||||||
<button
|
<button
|
||||||
className={selectedFilter === 'reblog' ? 'active' : ''}
|
className={selectedFilter === 'reblog' ? 'active' : ''}
|
||||||
onClick={this.onClick('reblog')}
|
onClick={this.onClick('reblog')}
|
||||||
|
|
|
@ -155,6 +155,28 @@ export default class Notification extends ImmutablePureComponent {
|
||||||
unread={this.props.unread}
|
unread={this.props.unread}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
case 'reaction':
|
||||||
|
return (
|
||||||
|
<StatusContainer
|
||||||
|
containerId={notification.get('id')}
|
||||||
|
hidden={hidden}
|
||||||
|
id={notification.get('status')}
|
||||||
|
account={notification.get('account')}
|
||||||
|
prepend='reaction'
|
||||||
|
muted
|
||||||
|
notification={notification}
|
||||||
|
onMoveDown={onMoveDown}
|
||||||
|
onMoveUp={onMoveUp}
|
||||||
|
onMention={onMention}
|
||||||
|
getScrollPosition={getScrollPosition}
|
||||||
|
updateScrollBottom={updateScrollBottom}
|
||||||
|
cachedMediaWidth={this.props.cachedMediaWidth}
|
||||||
|
cacheMediaWidth={this.props.cacheMediaWidth}
|
||||||
|
onUnmount={this.props.onUnmount}
|
||||||
|
withDismiss
|
||||||
|
unread={this.props.unread}
|
||||||
|
/>
|
||||||
|
);
|
||||||
case 'reblog':
|
case 'reblog':
|
||||||
return (
|
return (
|
||||||
<StatusContainer
|
<StatusContainer
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
import inherited from 'mastodon/locales/de.json';
|
import inherited from 'mastodon/locales/de.json';
|
||||||
|
|
||||||
const messages = {
|
const messages = {
|
||||||
// No translations available.
|
'notification.reaction': '{name} hat auf deinen Beitrag reagiert',
|
||||||
|
'notifications.column_settings.reaction': 'Reaktionen:',
|
||||||
|
|
||||||
|
'tooltips.reactions': 'Reaktionen',
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Object.assign({}, inherited, messages);
|
export default Object.assign({}, inherited, messages);
|
||||||
|
|
|
@ -147,7 +147,9 @@ const messages = {
|
||||||
'home.column_settings.show_direct': 'Show DMs',
|
'home.column_settings.show_direct': 'Show DMs',
|
||||||
|
|
||||||
'notification.markForDeletion': 'Mark for deletion',
|
'notification.markForDeletion': 'Mark for deletion',
|
||||||
|
'notification.reaction': '{name} reacted to your post',
|
||||||
'notifications.clear': 'Clear all my notifications',
|
'notifications.clear': 'Clear all my notifications',
|
||||||
|
'notifications.column_settings.reaction': 'Reactions:',
|
||||||
'notifications.marked_clear_confirmation': 'Are you sure you want to permanently clear all selected notifications?',
|
'notifications.marked_clear_confirmation': 'Are you sure you want to permanently clear all selected notifications?',
|
||||||
'notifications.marked_clear': 'Clear selected notifications',
|
'notifications.marked_clear': 'Clear selected notifications',
|
||||||
|
|
||||||
|
@ -187,6 +189,8 @@ const messages = {
|
||||||
'keyboard_shortcuts.bookmark': 'to bookmark',
|
'keyboard_shortcuts.bookmark': 'to bookmark',
|
||||||
'keyboard_shortcuts.toggle_collapse': 'to collapse/uncollapse toots',
|
'keyboard_shortcuts.toggle_collapse': 'to collapse/uncollapse toots',
|
||||||
'keyboard_shortcuts.secondary_toot': 'to send toot using secondary privacy setting',
|
'keyboard_shortcuts.secondary_toot': 'to send toot using secondary privacy setting',
|
||||||
|
|
||||||
|
'tooltips.reactions': 'Reactions',
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Object.assign({}, inherited, messages);
|
export default Object.assign({}, inherited, messages);
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
import inherited from 'mastodon/locales/fr.json';
|
import inherited from 'mastodon/locales/fr.json';
|
||||||
|
|
||||||
const messages = {
|
const messages = {
|
||||||
// No translations available.
|
'notification.reaction': '{name} a réagi·e à votre message',
|
||||||
|
'notifications.column_settings.reaction': 'Réactions:',
|
||||||
|
|
||||||
|
'tooltips.reactions': 'Réactions',
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Object.assign({}, inherited, messages);
|
export default Object.assign({}, inherited, messages);
|
||||||
|
|
|
@ -37,6 +37,7 @@ const initialState = ImmutableMap({
|
||||||
follow: false,
|
follow: false,
|
||||||
follow_request: false,
|
follow_request: false,
|
||||||
favourite: false,
|
favourite: false,
|
||||||
|
reaction: false,
|
||||||
reblog: false,
|
reblog: false,
|
||||||
mention: false,
|
mention: false,
|
||||||
poll: false,
|
poll: false,
|
||||||
|
@ -60,6 +61,7 @@ const initialState = ImmutableMap({
|
||||||
follow_request: false,
|
follow_request: false,
|
||||||
favourite: true,
|
favourite: true,
|
||||||
reblog: true,
|
reblog: true,
|
||||||
|
reaction: true,
|
||||||
mention: true,
|
mention: true,
|
||||||
poll: true,
|
poll: true,
|
||||||
status: true,
|
status: true,
|
||||||
|
@ -73,6 +75,7 @@ const initialState = ImmutableMap({
|
||||||
follow_request: false,
|
follow_request: false,
|
||||||
favourite: true,
|
favourite: true,
|
||||||
reblog: true,
|
reblog: true,
|
||||||
|
reaction: true,
|
||||||
mention: true,
|
mention: true,
|
||||||
poll: true,
|
poll: true,
|
||||||
status: true,
|
status: true,
|
||||||
|
|
|
@ -24,6 +24,7 @@ class Notification < ApplicationRecord
|
||||||
'Follow' => :follow,
|
'Follow' => :follow,
|
||||||
'FollowRequest' => :follow_request,
|
'FollowRequest' => :follow_request,
|
||||||
'Favourite' => :favourite,
|
'Favourite' => :favourite,
|
||||||
|
'StatusReaction' => :reaction,
|
||||||
'Poll' => :poll,
|
'Poll' => :poll,
|
||||||
}.freeze
|
}.freeze
|
||||||
|
|
||||||
|
@ -34,6 +35,7 @@ class Notification < ApplicationRecord
|
||||||
follow
|
follow
|
||||||
follow_request
|
follow_request
|
||||||
favourite
|
favourite
|
||||||
|
reaction
|
||||||
poll
|
poll
|
||||||
update
|
update
|
||||||
admin.sign_up
|
admin.sign_up
|
||||||
|
@ -45,6 +47,7 @@ class Notification < ApplicationRecord
|
||||||
reblog: [status: :reblog],
|
reblog: [status: :reblog],
|
||||||
mention: [mention: :status],
|
mention: [mention: :status],
|
||||||
favourite: [favourite: :status],
|
favourite: [favourite: :status],
|
||||||
|
reaction: [status_reaction: :status],
|
||||||
poll: [poll: :status],
|
poll: [poll: :status],
|
||||||
update: :status,
|
update: :status,
|
||||||
'admin.report': [report: :target_account],
|
'admin.report': [report: :target_account],
|
||||||
|
@ -61,6 +64,7 @@ class Notification < ApplicationRecord
|
||||||
belongs_to :favourite, foreign_key: 'activity_id', optional: true
|
belongs_to :favourite, foreign_key: 'activity_id', optional: true
|
||||||
belongs_to :poll, foreign_key: 'activity_id', optional: true
|
belongs_to :poll, foreign_key: 'activity_id', optional: true
|
||||||
belongs_to :report, foreign_key: 'activity_id', optional: true
|
belongs_to :report, foreign_key: 'activity_id', optional: true
|
||||||
|
belongs_to :status_reaction, foreign_key: 'activity_id', optional: true
|
||||||
|
|
||||||
validates :type, inclusion: { in: TYPES }
|
validates :type, inclusion: { in: TYPES }
|
||||||
|
|
||||||
|
@ -78,6 +82,8 @@ class Notification < ApplicationRecord
|
||||||
status&.reblog
|
status&.reblog
|
||||||
when :favourite
|
when :favourite
|
||||||
favourite&.status
|
favourite&.status
|
||||||
|
when :reaction
|
||||||
|
status_reaction&.status
|
||||||
when :mention
|
when :mention
|
||||||
mention&.status
|
mention&.status
|
||||||
when :poll
|
when :poll
|
||||||
|
@ -129,6 +135,8 @@ class Notification < ApplicationRecord
|
||||||
notification.status.reblog = cached_status
|
notification.status.reblog = cached_status
|
||||||
when :favourite
|
when :favourite
|
||||||
notification.favourite.status = cached_status
|
notification.favourite.status = cached_status
|
||||||
|
when :reaction
|
||||||
|
notification.reaction.status = cached_status
|
||||||
when :mention
|
when :mention
|
||||||
notification.mention.status = cached_status
|
notification.mention.status = cached_status
|
||||||
when :poll
|
when :poll
|
||||||
|
@ -140,6 +148,8 @@ class Notification < ApplicationRecord
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
alias reaction status_reaction
|
||||||
|
|
||||||
after_initialize :set_from_account
|
after_initialize :set_from_account
|
||||||
before_validation :set_from_account
|
before_validation :set_from_account
|
||||||
|
|
||||||
|
@ -149,7 +159,7 @@ class Notification < ApplicationRecord
|
||||||
return unless new_record?
|
return unless new_record?
|
||||||
|
|
||||||
case activity_type
|
case activity_type
|
||||||
when 'Status', 'Follow', 'Favourite', 'FollowRequest', 'Poll', 'Report'
|
when 'Status', 'Follow', 'Favourite', 'StatusReaction', 'FollowRequest', 'Poll', 'Report'
|
||||||
self.from_account_id = activity&.account_id
|
self.from_account_id = activity&.account_id
|
||||||
when 'Mention'
|
when 'Mention'
|
||||||
self.from_account_id = activity&.status&.account_id
|
self.from_account_id = activity&.status&.account_id
|
||||||
|
|
|
@ -12,7 +12,7 @@ class REST::NotificationSerializer < ActiveModel::Serializer
|
||||||
end
|
end
|
||||||
|
|
||||||
def status_type?
|
def status_type?
|
||||||
[:favourite, :reblog, :status, :mention, :poll, :update].include?(object.type)
|
[:favourite, :reaction, :reblog, :status, :mention, :poll, :update].include?(object.type)
|
||||||
end
|
end
|
||||||
|
|
||||||
def report_type?
|
def report_type?
|
||||||
|
|
|
@ -14,6 +14,7 @@ class StatusReactionService < BaseService
|
||||||
|
|
||||||
json = Oj.dump(serialize_payload(reaction, ActivityPub::EmojiReactionSerializer))
|
json = Oj.dump(serialize_payload(reaction, ActivityPub::EmojiReactionSerializer))
|
||||||
if status.account.local?
|
if status.account.local?
|
||||||
|
NotifyService.new.call(status.account, :reaction, reaction)
|
||||||
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)
|
||||||
|
|
|
@ -1285,6 +1285,10 @@ de:
|
||||||
body: 'Dein Beitrag wurde von %{name} favorisiert:'
|
body: 'Dein Beitrag wurde von %{name} favorisiert:'
|
||||||
subject: "%{name} hat deinen Beitrag favorisiert"
|
subject: "%{name} hat deinen Beitrag favorisiert"
|
||||||
title: Neue Favorisierung
|
title: Neue Favorisierung
|
||||||
|
reaction:
|
||||||
|
body: '%{name} hat auf deinen Beitrag reagiert:'
|
||||||
|
subject: '%{name} hat auf deinen Beitrag reagiert'
|
||||||
|
title: Neue Reaktion
|
||||||
follow:
|
follow:
|
||||||
body: "%{name} folgt dir jetzt!"
|
body: "%{name} folgt dir jetzt!"
|
||||||
subject: "%{name} folgt dir jetzt"
|
subject: "%{name} folgt dir jetzt"
|
||||||
|
|
|
@ -1292,6 +1292,10 @@ en:
|
||||||
body: 'Your post was favourited by %{name}:'
|
body: 'Your post was favourited by %{name}:'
|
||||||
subject: "%{name} favourited your post"
|
subject: "%{name} favourited your post"
|
||||||
title: New favourite
|
title: New favourite
|
||||||
|
reaction:
|
||||||
|
body: '%{name} reacted to your post:'
|
||||||
|
subject: '%{name} reacted to your post'
|
||||||
|
title: New reaction
|
||||||
follow:
|
follow:
|
||||||
body: "%{name} is now following you!"
|
body: "%{name} is now following you!"
|
||||||
subject: "%{name} is now following you"
|
subject: "%{name} is now following you"
|
||||||
|
|
|
@ -707,6 +707,10 @@ en_GB:
|
||||||
body: 'Your status was favourited by %{name}:'
|
body: 'Your status was favourited by %{name}:'
|
||||||
subject: "%{name} favourited your status"
|
subject: "%{name} favourited your status"
|
||||||
title: New favourite
|
title: New favourite
|
||||||
|
reaction:
|
||||||
|
body: '%{name} reacted on your post with %{reaction}:'
|
||||||
|
subject: '%{name} reacted on your post'
|
||||||
|
title: New reaction
|
||||||
follow:
|
follow:
|
||||||
body: "%{name} is now following you!"
|
body: "%{name} is now following you!"
|
||||||
subject: "%{name} is now following you"
|
subject: "%{name} is now following you"
|
||||||
|
|
|
@ -1285,6 +1285,10 @@ fr:
|
||||||
body: "%{name} a ajouté votre message à ses favoris :"
|
body: "%{name} a ajouté votre message à ses favoris :"
|
||||||
subject: "%{name} a ajouté votre message à ses favoris"
|
subject: "%{name} a ajouté votre message à ses favoris"
|
||||||
title: Nouveau favori
|
title: Nouveau favori
|
||||||
|
reaction:
|
||||||
|
body: '%{name} a réagi·e à votre message:'
|
||||||
|
subject: '%{name} a réagi·e à votre message'
|
||||||
|
title: Nouvelle réaction
|
||||||
follow:
|
follow:
|
||||||
body: "%{name} vous suit !"
|
body: "%{name} vous suit !"
|
||||||
subject: "%{name} vous suit"
|
subject: "%{name} vous suit"
|
||||||
|
|
Loading…
Reference in a new issue