Add ability to opt-out or opt-in to emoji react notifications

merge-requests/430/head
Sean King 4 years ago
parent e84a2bd2d2
commit ac3dbaab94
No known key found for this signature in database
GPG Key ID: 510C52BACD6E7257

@ -148,7 +148,7 @@ export function dequeueNotifications() {
const excludeTypesFromSettings = getState => getSettings(getState()).getIn(['notifications', 'shows']).filter(enabled => !enabled).keySeq().toJS();
const excludeTypesFromFilter = filter => {
const allTypes = ImmutableList(['follow', 'favourite', 'reblog', 'mention', 'poll']);
const allTypes = ImmutableList(['follow', 'favourite', 'reblog', 'mention', 'poll', 'pleroma:emoji_reaction']);
return allTypes.filterNot(item => item === filter).toJS();
};

@ -56,6 +56,7 @@ export const defaultSettings = ImmutableMap({
reblog: true,
mention: true,
poll: true,
'pleroma:emoji_reaction': true,
}),
quickFilter: ImmutableMap({
@ -70,6 +71,7 @@ export const defaultSettings = ImmutableMap({
reblog: true,
mention: true,
poll: true,
'pleroma:emoji_reaction': true,
}),
sounds: ImmutableMap({
@ -78,6 +80,7 @@ export const defaultSettings = ImmutableMap({
reblog: false,
mention: false,
poll: false,
'pleroma:emoji_reaction': false,
}),
}),

@ -20,7 +20,7 @@ export default class ColumnSettings extends React.PureComponent {
}
onAllSoundsChange = (path, checked) => {
const soundSettings = [['sounds', 'follow'], ['sounds', 'favourite'], ['sounds', 'mention'], ['sounds', 'reblog'], ['sounds', 'poll']];
const soundSettings = [['sounds', 'follow'], ['sounds', 'favourite'], ['sounds', 'pleroma:emoji_reaction'], ['sounds', 'mention'], ['sounds', 'reblog'], ['sounds', 'poll']];
for (var i = 0; i < soundSettings.length; i++) {
this.props.onChange(soundSettings[i], checked);
@ -36,7 +36,7 @@ export default class ColumnSettings extends React.PureComponent {
const allSoundsStr = <FormattedMessage id='notifications.column_settings.sounds.all_sounds' defaultMessage='Play sound for all notifications' />;
const showStr = <FormattedMessage id='notifications.column_settings.show' defaultMessage='Show in column' />;
const soundStr = <FormattedMessage id='notifications.column_settings.sound' defaultMessage='Play sound' />;
const soundSettings = [['sounds', 'follow'], ['sounds', 'favourite'], ['sounds', 'mention'], ['sounds', 'reblog'], ['sounds', 'poll']];
const soundSettings = [['sounds', 'follow'], ['sounds', 'favourite'], ['sounds', 'pleroma:emoji_reaction'], ['sounds', 'mention'], ['sounds', 'reblog'], ['sounds', 'poll']];
const showPushSettings = pushSettings.get('browserSupport') && pushSettings.get('isSubscribed');
const pushStr = showPushSettings && <FormattedMessage id='notifications.column_settings.push' defaultMessage='Push notifications' />;
@ -85,6 +85,17 @@ export default class ColumnSettings extends React.PureComponent {
</div>
</div>
<div role='group' aria-labelledby='notifications-emoji-react'>
<span id='notifications-favourite' className='column-settings__section'><FormattedMessage id='notifications.column_settings.emoji_react' defaultMessage='Emoji reacts:' /></span>
<div className='column-settings__row'>
<SettingToggle prefix='notifications_desktop' settings={settings} settingPath={['alerts', 'pleroma:emoji_reaction']} onChange={onChange} label={alertStr} />
{showPushSettings && <SettingToggle prefix='notifications_push' settings={pushSettings} settingPath={['alerts', 'pleroma:emoji_reaction']} onChange={this.onPushChange} label={pushStr} />}
<SettingToggle prefix='notifications' settings={settings} settingPath={['shows', 'pleroma:emoji_reaction']} onChange={onChange} label={showStr} />
<SettingToggle prefix='notifications' settings={settings} settingPath={['sounds', 'pleroma:emoji_reaction']} onChange={onChange} label={soundStr} />
</div>
</div>
<div role='group' aria-labelledby='notifications-mention'>
<span id='notifications-mention' className='column-settings__section'><FormattedMessage id='notifications.column_settings.mention' defaultMessage='Mentions:' /></span>

@ -9,6 +9,7 @@ const tooltips = defineMessages({
boosts: { id: 'notifications.filter.boosts', defaultMessage: 'Reposts' },
polls: { id: 'notifications.filter.polls', defaultMessage: 'Poll results' },
follows: { id: 'notifications.filter.follows', defaultMessage: 'Follows' },
emoji_reacts: { id: 'notifications.filter.emoji_reacts', defaultMessage: 'Emoji reacts:' },
});
export default @injectIntl
@ -73,6 +74,13 @@ class FilterBar extends React.PureComponent {
>
<Icon id='star' fixedWidth />
</button>
<button
className={selectedFilter === 'pleroma:emoji_reaction' ? 'active' : ''}
onClick={this.onClick('pleroma:emoji_reaction')}
title={intl.formatMessage(tooltips.favourites)}
>
<Icon id='star' fixedWidth />
</button>
<button
className={selectedFilter === 'reblog' ? 'active' : ''}
onClick={this.onClick('reblog')}

Loading…
Cancel
Save