Skip to content

Commit

Permalink
Fix missing filtering on some notification types (mastodon#23211)
Browse files Browse the repository at this point in the history
* Fix missing warning-type filtering on some notification types

* Fix missing hide-type filtering on some notification types
  • Loading branch information
ClearlyClaire authored and Jean Bertrand committed Feb 22, 2023
1 parent 67dd0a8 commit 0471456
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,11 @@ class Notification extends ImmutablePureComponent {
}

renderStatus (notification, link) {
const { intl, unread } = this.props;
const { intl, unread, status } = this.props;

if (!status) {
return null;
}

return (
<HotKeys handlers={this.getHandlers()}>
Expand All @@ -264,6 +268,7 @@ class Notification extends ImmutablePureComponent {
<StatusContainer
id={notification.get('status')}
account={notification.get('account')}
contextType='notifications'
muted
withDismiss
hidden={this.props.hidden}
Expand All @@ -278,7 +283,11 @@ class Notification extends ImmutablePureComponent {
}

renderUpdate (notification, link) {
const { intl, unread } = this.props;
const { intl, unread, status } = this.props;

if (!status) {
return null;
}

return (
<HotKeys handlers={this.getHandlers()}>
Expand All @@ -296,6 +305,7 @@ class Notification extends ImmutablePureComponent {
<StatusContainer
id={notification.get('status')}
account={notification.get('account')}
contextType='notifications'
muted
withDismiss
hidden={this.props.hidden}
Expand All @@ -310,10 +320,14 @@ class Notification extends ImmutablePureComponent {
}

renderPoll (notification, account) {
const { intl, unread } = this.props;
const { intl, unread, status } = this.props;
const ownPoll = me === account.get('id');
const message = ownPoll ? intl.formatMessage(messages.ownPoll) : intl.formatMessage(messages.poll);

if (!status) {
return null;
}

return (
<HotKeys handlers={this.getHandlers()}>
<div className={classNames('notification notification-poll focusable', { unread })} tabIndex='0' aria-label={notificationForScreenReader(intl, message, notification.get('created_at'))}>
Expand All @@ -334,6 +348,7 @@ class Notification extends ImmutablePureComponent {
<StatusContainer
id={notification.get('status')}
account={account}
contextType='notifications'
muted
withDismiss
hidden={this.props.hidden}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const makeMapStateToProps = () => {
const notification = getNotification(state, props.notification, props.accountId);
return {
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,
};
};
Expand Down

0 comments on commit 0471456

Please sign in to comment.