Account move notification

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
actually-fix-tabs-bar
marcin mikołajczak 2021-06-30 13:41:06 +02:00
rodzic 58f3107151
commit ace220850d
10 zmienionych plików z 61 dodań i 6 usunięć

Wyświetl plik

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

Wyświetl plik

@ -60,6 +60,7 @@ export const defaultSettings = ImmutableMap({
reblog: true,
mention: true,
poll: true,
move: true,
'pleroma:emoji_reaction': true,
}),
@ -76,6 +77,7 @@ export const defaultSettings = ImmutableMap({
reblog: true,
mention: true,
poll: true,
move: true,
'pleroma:emoji_reaction': true,
}),
@ -86,6 +88,7 @@ export const defaultSettings = ImmutableMap({
reblog: false,
mention: false,
poll: false,
move: false,
'pleroma:emoji_reaction': false,
}),
}),

Wyświetl plik

@ -20,7 +20,7 @@ export default class ColumnSettings extends React.PureComponent {
}
onAllSoundsChange = (path, checked) => {
const soundSettings = [['sounds', 'follow'], ['sounds', 'favourite'], ['sounds', 'pleroma:emoji_reaction'], ['sounds', 'mention'], ['sounds', 'reblog'], ['sounds', 'poll']];
const soundSettings = [['sounds', 'follow'], ['sounds', 'favourite'], ['sounds', 'pleroma:emoji_reaction'], ['sounds', 'mention'], ['sounds', 'reblog'], ['sounds', 'poll'], ['sounds', 'move']];
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', 'pleroma:emoji_reaction'], ['sounds', 'mention'], ['sounds', 'reblog'], ['sounds', 'poll']];
const soundSettings = [['sounds', 'follow'], ['sounds', 'favourite'], ['sounds', 'pleroma:emoji_reaction'], ['sounds', 'mention'], ['sounds', 'reblog'], ['sounds', 'poll'], ['sounds', 'move']];
const showPushSettings = pushSettings.get('browserSupport') && pushSettings.get('isSubscribed');
const pushStr = showPushSettings && <FormattedMessage id='notifications.column_settings.push' defaultMessage='Push notifications' />;
@ -139,6 +139,17 @@ export default class ColumnSettings extends React.PureComponent {
<SettingToggle prefix='notifications' settings={settings} settingPath={['sounds', 'poll']} onChange={onChange} label={soundStr} />
</div>
</div>
<div role='group' aria-labelledby='notifications-move'>
<span id='notifications-move' className='column-settings__section'><FormattedMessage id='notifications.column_settings.move' defaultMessage='Moves:' /></span>
<div className='column-settings__row'>
<SettingToggle prefix='notifications_desktop' settings={settings} settingPath={['alerts', 'move']} onChange={onChange} label={alertStr} />
{showPushSettings && <SettingToggle prefix='notifications_push' settings={pushSettings} settingPath={['alerts', 'move']} onChange={this.onPushChange} label={pushStr} />}
<SettingToggle prefix='notifications' settings={settings} settingPath={['shows', 'move']} onChange={onChange} label={showStr} />
<SettingToggle prefix='notifications' settings={settings} settingPath={['sounds', 'move']} onChange={onChange} label={soundStr} />
</div>
</div>
</div>
);
}

Wyświetl plik

@ -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' },
moves: { id: 'notifications.filter.moves', defaultMessage: 'Moves' },
emoji_reacts: { id: 'notifications.filter.emoji_reacts', defaultMessage: 'Emoji reacts:' },
});
@ -102,6 +103,13 @@ class FilterBar extends React.PureComponent {
>
<Icon id='user-plus' fixedWidth />
</button>
<button
className={selectedFilter === 'move' ? 'active' : ''}
onClick={this.onClick('move')}
title={intl.formatMessage(tooltips.moves)}
>
<Icon id='user-plus' fixedWidth />
</button>
</div>
);
return renderedElement;

Wyświetl plik

@ -321,9 +321,34 @@ class Notification extends ImmutablePureComponent {
);
}
renderMove(notification, account, targetAccount, link) {
const { intl } = this.props;
const targetLink = <bdi><Permalink className='notification__display-name' href={`/@${targetAccount.get('acct')}`} to={`/@${targetAccount.get('acct')}`}>{targetAccount.get('acct')}</Permalink></bdi>;
return (
<HotKeys handlers={this.getHandlers()}>
<div className='notification notification-move focusable' tabIndex='0' aria-label={notificationForScreenReader(intl, intl.formatMessage({ id: 'notification.move', defaultMessage: '{name} moved to {targetName}' }, { name: account.get('acct'), targetName: targetAccount.get('acct') }), notification.get('created_at'))}>
<div className='notification__message'>
<div className='notification__favourite-icon-wrapper'>
<Icon id='suitcase' fixedWidth />
</div>
<span title={notification.get('created_at')}>
<FormattedMessage id='notification.move' defaultMessage='{name} moved to {targetName}' values={{ name: link, targetName: targetLink }} />
</span>
</div>
<AccountContainer id={targetAccount.get('id')} withNote={false} hidden={this.props.hidden} />
</div>
</HotKeys>
);
}
render() {
const { notification } = this.props;
const account = notification.get('account');
const targetAccount = notification.get('target');
const displayNameHtml = { __html: account.get('display_name_html') };
const link = <bdi><Permalink className='notification__display-name' href={`/@${account.get('acct')}`} title={account.get('acct')} to={`/@${account.get('acct')}`} dangerouslySetInnerHTML={displayNameHtml} /></bdi>;
@ -340,6 +365,8 @@ class Notification extends ImmutablePureComponent {
return this.renderReblog(notification, link);
case 'poll':
return this.renderPoll(notification);
case 'move':
return this.renderMove(notification, account, targetAccount, link);
case 'pleroma:emoji_reaction':
return this.renderEmojiReact(notification, link);
case 'pleroma:chat_mention':

Wyświetl plik

@ -20,7 +20,7 @@ const makeMapStateToProps = () => {
const getStatus = makeGetStatus();
const mapStateToProps = (state, props) => {
const notification = getNotification(state, props.notification, props.accountId);
const notification = getNotification(state, props.notification, props.accountId, props.targetId);
return {
notification: notification,
status: notification.get('status') ? getStatus(state, { id: notification.get('status') }) : null,

Wyświetl plik

@ -152,6 +152,7 @@ class Notifications extends React.PureComponent {
key={item.get('id')}
notification={item}
accountId={item.get('account')}
targetId={item.get('target')}
onMoveUp={this.handleMoveUp}
onMoveDown={this.handleMoveDown}
/>

Wyświetl plik

@ -450,6 +450,7 @@
"notification.follow": "{name} zaczął(-ęła) Cię śledzić",
"notification.follow_request": "{name} poprosił(a) Cię o możliwość śledzenia",
"notification.mention": "{name} wspomniał(a) o tobie",
"notification.move": "{name} przeniósł(-osła) się na {targetName}",
"notification.pleroma:emoji_reaction": "{name} zareagował(a) na Twój wpis",
"notification.poll": "Głosowanie w którym brałeś(-aś) udział zakończyła się",
"notification.reblog": "{name} podbił(a) Twój wpis",
@ -464,6 +465,7 @@
"notifications.column_settings.follow": "Nowi śledzący:",
"notifications.column_settings.follow_request": "Nowe prośby o możliwość śledzenia:",
"notifications.column_settings.mention": "Wspomnienia:",
"notifications.column_settings.move": "Przenoszone konta:",
"notifications.column_settings.poll": "Wyniki głosowania:",
"notifications.column_settings.push": "Powiadomienia push",
"notifications.column_settings.reblog": "Podbicia:",
@ -477,6 +479,7 @@
"notifications.filter.favourites": "Ulubione",
"notifications.filter.follows": "Śledzenia",
"notifications.filter.mentions": "Wspomienia",
"notifications.filter.moves": "Przenoszone konta",
"notifications.filter.polls": "Wyniki głosowania",
"notifications.group": "{count, number} {count, plural, one {powiadomienie} few {powiadomienia} many {powiadomień} more {powiadomień}}",
"notifications.queue_label": "Naciśnij aby zobaczyć {count} {count, plural, one {nowe powiadomienie} few {nowe powiadomienia} many {nowych powiadomień} other {nowe powiadomienia}}",

Wyświetl plik

@ -44,6 +44,7 @@ const notificationToMap = notification => ImmutableMap({
id: notification.id,
type: notification.type,
account: notification.account.id,
target: notification.target ? notification.target.id : null,
created_at: notification.created_at,
status: notification.status ? notification.status.id : null,
emoji: notification.emoji,

Wyświetl plik

@ -137,8 +137,9 @@ export const makeGetNotification = () => {
return createSelector([
(_, base) => base,
(state, _, accountId) => state.getIn(['accounts', accountId]),
], (base, account) => {
return base.set('account', account);
(state, _, __, targetId) => state.getIn(['accounts', targetId]),
], (base, account, target) => {
return base.set('account', account).set('target', target);
});
};