Merge branch 'status-notification-type' into 'develop'
Support 'status' notification type See merge request soapbox-pub/soapbox-fe!1221
This commit is contained in:
commit
db7816d3e5
|
@ -98,7 +98,7 @@ export function updateNotificationsQueue(notification, intlMessages, intlLocale,
|
||||||
|
|
||||||
const isOnNotificationsPage = curPath === '/notifications';
|
const isOnNotificationsPage = curPath === '/notifications';
|
||||||
|
|
||||||
if (notification.type === 'mention') {
|
if (['mention', 'status'].includes(notification.type)) {
|
||||||
const regex = regexFromFilters(filters);
|
const regex = regexFromFilters(filters);
|
||||||
const searchIndex = notification.status.spoiler_text + '\n' + unescapeHTML(notification.status.content);
|
const searchIndex = notification.status.spoiler_text + '\n' + unescapeHTML(notification.status.content);
|
||||||
filtered = regex && regex.test(searchIndex);
|
filtered = regex && regex.test(searchIndex);
|
||||||
|
@ -170,7 +170,7 @@ export function dequeueNotifications() {
|
||||||
const excludeTypesFromSettings = getState => getSettings(getState()).getIn(['notifications', 'shows']).filter(enabled => !enabled).keySeq().toJS();
|
const excludeTypesFromSettings = getState => getSettings(getState()).getIn(['notifications', 'shows']).filter(enabled => !enabled).keySeq().toJS();
|
||||||
|
|
||||||
const excludeTypesFromFilter = filter => {
|
const excludeTypesFromFilter = filter => {
|
||||||
const allTypes = ImmutableList(['follow', 'follow_request', 'favourite', 'reblog', 'mention', 'poll', 'move', 'pleroma:emoji_reaction']);
|
const allTypes = ImmutableList(['follow', 'follow_request', 'favourite', 'reblog', 'mention', 'status', 'poll', 'move', 'pleroma:emoji_reaction']);
|
||||||
return allTypes.filterNot(item => item === filter).toJS();
|
return allTypes.filterNot(item => item === filter).toJS();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ const messages = defineMessages({
|
||||||
follows: { id: 'notifications.filter.follows', defaultMessage: 'Follows' },
|
follows: { id: 'notifications.filter.follows', defaultMessage: 'Follows' },
|
||||||
moves: { id: 'notifications.filter.moves', defaultMessage: 'Moves' },
|
moves: { id: 'notifications.filter.moves', defaultMessage: 'Moves' },
|
||||||
emoji_reacts: { id: 'notifications.filter.emoji_reacts', defaultMessage: 'Emoji reacts' },
|
emoji_reacts: { id: 'notifications.filter.emoji_reacts', defaultMessage: 'Emoji reacts' },
|
||||||
|
statuses: { id: 'notifications.filter.statuses', defaultMessage: 'Updates from people you follow' },
|
||||||
});
|
});
|
||||||
|
|
||||||
export default @injectIntl
|
export default @injectIntl
|
||||||
|
@ -79,6 +80,12 @@ class NotificationFilterBar extends React.PureComponent {
|
||||||
action: this.onClick('poll'),
|
action: this.onClick('poll'),
|
||||||
name: 'poll',
|
name: 'poll',
|
||||||
});
|
});
|
||||||
|
items.push({
|
||||||
|
text: <Icon src={require('@tabler/icons/icons/home.svg')} />,
|
||||||
|
title: intl.formatMessage(messages.statuses),
|
||||||
|
action: this.onClick('status'),
|
||||||
|
name: 'status',
|
||||||
|
});
|
||||||
items.push({
|
items.push({
|
||||||
text: <Icon src={require('@tabler/icons/icons/user-plus.svg')} />,
|
text: <Icon src={require('@tabler/icons/icons/user-plus.svg')} />,
|
||||||
title: intl.formatMessage(messages.follows),
|
title: intl.formatMessage(messages.follows),
|
||||||
|
|
|
@ -325,6 +325,41 @@ class Notification extends ImmutablePureComponent {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
renderStatus(notification) {
|
||||||
|
const { intl } = this.props;
|
||||||
|
|
||||||
|
const account = notification.get('account');
|
||||||
|
const link = this.renderLink(account);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<HotKeys handlers={this.getHandlers()}>
|
||||||
|
<div className='notification notification-status focusable' tabIndex='0' aria-label={notificationForScreenReader(intl, intl.formatMessage({ id: 'notification.status', defaultMessage: '{name} just posted' }, { name: notification.getIn(['account', 'acct']) }), notification.get('created_at'))}>
|
||||||
|
<div className='notification__message'>
|
||||||
|
<div className='notification__icon-wrapper'>
|
||||||
|
<Icon src={require('@tabler/icons/icons/home.svg')} />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<span title={notification.get('created_at')}>
|
||||||
|
<FormattedMessage id='notification.status' defaultMessage='{name} just posted' values={{ name: link }} />
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<StatusContainer
|
||||||
|
id={notification.getIn(['status', 'id'])}
|
||||||
|
account={notification.get('account')}
|
||||||
|
muted
|
||||||
|
withDismiss
|
||||||
|
hidden={this.props.hidden}
|
||||||
|
getScrollPosition={this.props.getScrollPosition}
|
||||||
|
updateScrollBottom={this.props.updateScrollBottom}
|
||||||
|
cachedMediaWidth={this.props.cachedMediaWidth}
|
||||||
|
cacheMediaWidth={this.props.cacheMediaWidth}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</HotKeys>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
renderPoll(notification) {
|
renderPoll(notification) {
|
||||||
const { intl } = this.props;
|
const { intl } = this.props;
|
||||||
|
|
||||||
|
@ -398,6 +433,8 @@ class Notification extends ImmutablePureComponent {
|
||||||
return this.renderFavourite(notification);
|
return this.renderFavourite(notification);
|
||||||
case 'reblog':
|
case 'reblog':
|
||||||
return this.renderReblog(notification);
|
return this.renderReblog(notification);
|
||||||
|
case 'status':
|
||||||
|
return this.renderStatus(notification);
|
||||||
case 'poll':
|
case 'poll':
|
||||||
return this.renderPoll(notification);
|
return this.renderPoll(notification);
|
||||||
case 'move':
|
case 'move':
|
||||||
|
|
|
@ -669,6 +669,7 @@
|
||||||
"notification.pleroma:emoji_reaction": "{name} zareagował(a) na Twój wpis",
|
"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.poll": "Głosowanie w którym brałeś(-aś) udział zakończyła się",
|
||||||
"notification.reblog": "{name} podbił(a) Twój wpis",
|
"notification.reblog": "{name} podbił(a) Twój wpis",
|
||||||
|
"notification.status": "{name} właśnie opublikował(a) wpis",
|
||||||
"notifications.clear": "Wyczyść powiadomienia",
|
"notifications.clear": "Wyczyść powiadomienia",
|
||||||
"notifications.clear_confirmation": "Czy na pewno chcesz bezpowrotnie usunąć wszystkie powiadomienia?",
|
"notifications.clear_confirmation": "Czy na pewno chcesz bezpowrotnie usunąć wszystkie powiadomienia?",
|
||||||
"notifications.clear_heading": "Wyczyść powiadomienia",
|
"notifications.clear_heading": "Wyczyść powiadomienia",
|
||||||
|
@ -700,6 +701,7 @@
|
||||||
"notifications.filter.mentions": "Wspomienia",
|
"notifications.filter.mentions": "Wspomienia",
|
||||||
"notifications.filter.moves": "Przenoszone konta",
|
"notifications.filter.moves": "Przenoszone konta",
|
||||||
"notifications.filter.polls": "Wyniki głosowania",
|
"notifications.filter.polls": "Wyniki głosowania",
|
||||||
|
"notifications.filter.statuses": "Nowe wpisy osób, które subskrybujesz",
|
||||||
"notifications.group": "{count, number} {count, plural, one {powiadomienie} few {powiadomienia} many {powiadomień} more {powiadomień}}",
|
"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}}",
|
"notifications.queue_label": "Naciśnij aby zobaczyć {count} {count, plural, one {nowe powiadomienie} few {nowe powiadomienia} many {nowych powiadomień} other {nowe powiadomienia}}",
|
||||||
"password_reset.confirmation": "Sprawdź swoją pocztę e-mail, aby potwierdzić.",
|
"password_reset.confirmation": "Sprawdź swoją pocztę e-mail, aby potwierdzić.",
|
||||||
|
|
|
@ -73,7 +73,7 @@ const isValid = notification => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mastodon can return status notifications with a null status
|
// Mastodon can return status notifications with a null status
|
||||||
if (['mention', 'reblog', 'favourite', 'poll'].includes(notification.type) && !notification.status.id) {
|
if (['mention', 'reblog', 'favourite', 'poll', 'status'].includes(notification.type) && !notification.status.id) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue