Support 'status' notification type
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
f745c9fc97
commit
19aa4b254e
5 changed files with 19 additions and 4 deletions
|
@ -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();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,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
|
||||||
|
@ -80,6 +81,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),
|
||||||
|
|
|
@ -36,13 +36,14 @@ const buildLink = (account) => (
|
||||||
</bdi>
|
</bdi>
|
||||||
);
|
);
|
||||||
|
|
||||||
export const NOTIFICATION_TYPES = ['follow', 'mention', 'favourite', 'reblog'];
|
export const NOTIFICATION_TYPES = ['follow', 'mention', 'favourite', 'reblog', 'status'];
|
||||||
|
|
||||||
const icons = {
|
const icons = {
|
||||||
follow: require('@tabler/icons/icons/user-plus.svg'),
|
follow: require('@tabler/icons/icons/user-plus.svg'),
|
||||||
mention: require('@tabler/icons/icons/at.svg'),
|
mention: require('@tabler/icons/icons/at.svg'),
|
||||||
favourite: require('@tabler/icons/icons/heart.svg'),
|
favourite: require('@tabler/icons/icons/heart.svg'),
|
||||||
reblog: require('@tabler/icons/icons/repeat.svg'),
|
reblog: require('@tabler/icons/icons/repeat.svg'),
|
||||||
|
status: require('@tabler/icons/icons/home.svg'),
|
||||||
};
|
};
|
||||||
|
|
||||||
const messages = {
|
const messages = {
|
||||||
|
@ -62,6 +63,10 @@ const messages = {
|
||||||
id: 'notification.reblog',
|
id: 'notification.reblog',
|
||||||
defaultMessage: '{name} re-TRUTH your TRUTH',
|
defaultMessage: '{name} re-TRUTH your TRUTH',
|
||||||
},
|
},
|
||||||
|
status: {
|
||||||
|
id: 'notification.status',
|
||||||
|
defaultMessage: '{name} just posted',
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const buildMessage = (type, account) => {
|
const buildMessage = (type, account) => {
|
||||||
|
@ -153,6 +158,7 @@ const Notification = (props) => {
|
||||||
case 'favourite':
|
case 'favourite':
|
||||||
case 'mention':
|
case 'mention':
|
||||||
case 'reblog':
|
case 'reblog':
|
||||||
|
case 'status':
|
||||||
return (
|
return (
|
||||||
<StatusContainer
|
<StatusContainer
|
||||||
id={notification.getIn(['status', 'id'])}
|
id={notification.getIn(['status', 'id'])}
|
||||||
|
|
|
@ -694,6 +694,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",
|
||||||
|
@ -725,6 +726,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 a new issue