gearheads
/
mastodon
Archived
2
0
Fork 0

Fix missing filtering on some notification types (#23211)

* Fix missing warning-type filtering on some notification types

* Fix missing hide-type filtering on some notification types
gh/stable
Claire 2023-01-23 13:21:50 +01:00 committed by GitHub
parent 77c2ea1f0f
commit 98779535fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 4 deletions

View File

@ -246,7 +246,11 @@ class Notification extends ImmutablePureComponent {
} }
renderStatus (notification, link) { renderStatus (notification, link) {
const { intl, unread } = this.props; const { intl, unread, status } = this.props;
if (!status) {
return null;
}
return ( return (
<HotKeys handlers={this.getHandlers()}> <HotKeys handlers={this.getHandlers()}>
@ -264,6 +268,7 @@ class Notification extends ImmutablePureComponent {
<StatusContainer <StatusContainer
id={notification.get('status')} id={notification.get('status')}
account={notification.get('account')} account={notification.get('account')}
contextType='notifications'
muted muted
withDismiss withDismiss
hidden={this.props.hidden} hidden={this.props.hidden}
@ -278,7 +283,11 @@ class Notification extends ImmutablePureComponent {
} }
renderUpdate (notification, link) { renderUpdate (notification, link) {
const { intl, unread } = this.props; const { intl, unread, status } = this.props;
if (!status) {
return null;
}
return ( return (
<HotKeys handlers={this.getHandlers()}> <HotKeys handlers={this.getHandlers()}>
@ -296,6 +305,7 @@ class Notification extends ImmutablePureComponent {
<StatusContainer <StatusContainer
id={notification.get('status')} id={notification.get('status')}
account={notification.get('account')} account={notification.get('account')}
contextType='notifications'
muted muted
withDismiss withDismiss
hidden={this.props.hidden} hidden={this.props.hidden}
@ -310,10 +320,14 @@ class Notification extends ImmutablePureComponent {
} }
renderPoll (notification, account) { renderPoll (notification, account) {
const { intl, unread } = this.props; const { intl, unread, status } = this.props;
const ownPoll = me === account.get('id'); const ownPoll = me === account.get('id');
const message = ownPoll ? intl.formatMessage(messages.ownPoll) : intl.formatMessage(messages.poll); const message = ownPoll ? intl.formatMessage(messages.ownPoll) : intl.formatMessage(messages.poll);
if (!status) {
return null;
}
return ( return (
<HotKeys handlers={this.getHandlers()}> <HotKeys handlers={this.getHandlers()}>
<div className={classNames('notification notification-poll focusable', { unread })} tabIndex='0' aria-label={notificationForScreenReader(intl, message, notification.get('created_at'))}> <div className={classNames('notification notification-poll focusable', { unread })} tabIndex='0' aria-label={notificationForScreenReader(intl, message, notification.get('created_at'))}>
@ -334,6 +348,7 @@ class Notification extends ImmutablePureComponent {
<StatusContainer <StatusContainer
id={notification.get('status')} id={notification.get('status')}
account={account} account={account}
contextType='notifications'
muted muted
withDismiss withDismiss
hidden={this.props.hidden} hidden={this.props.hidden}

View File

@ -24,7 +24,7 @@ const makeMapStateToProps = () => {
const notification = getNotification(state, props.notification, props.accountId); const notification = getNotification(state, props.notification, props.accountId);
return { return {
notification: notification, notification: notification,
status: notification.get('status') ? getStatus(state, { id: notification.get('status') }) : null, status: notification.get('status') ? getStatus(state, { id: notification.get('status'), contextType: 'notifications' }) : null,
report: notification.get('report') ? getReport(state, notification.get('report'), notification.getIn(['report', 'target_account', 'id'])) : null, report: notification.get('report') ? getReport(state, notification.get('report'), notification.getIn(['report', 'target_account', 'id'])) : null,
}; };
}; };