Merge remote-tracking branch 'upstream/main'

This commit is contained in:
Essem 2024-04-10 17:36:38 -05:00
commit ce98ee9b00
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C
208 changed files with 3044 additions and 1060 deletions

View file

@ -22,12 +22,14 @@ import { WithRouterPropTypes } from 'flavours/glitch/utils/react_router';
import FollowRequestContainer from '../containers/follow_request_container';
import NotificationOverlayContainer from '../containers/overlay_container';
import { RelationshipsSeveranceEvent } from './relationships_severance_event';
import Report from './report';
const messages = defineMessages({
follow: { id: 'notification.follow', defaultMessage: '{name} followed you' },
adminSignUp: { id: 'notification.admin.sign_up', defaultMessage: '{name} signed up' },
adminReport: { id: 'notification.admin.report', defaultMessage: '{name} reported {target}' },
relationshipsSevered: { id: 'notification.relationships_severance_event', defaultMessage: 'Lost connections with {name}' },
});
const notificationForScreenReader = (intl, message, timestamp) => {
@ -328,6 +330,29 @@ class Notification extends ImmutablePureComponent {
);
}
renderRelationshipsSevered (notification) {
const { intl, unread, hidden } = this.props;
const event = notification.get('event');
if (!event) {
return null;
}
return (
<HotKeys handlers={this.getHandlers()}>
<div className={classNames('notification notification-severed-relationships focusable', { unread })} tabIndex={0} aria-label={notificationForScreenReader(intl, intl.formatMessage(messages.relationshipsSevered, { name: notification.getIn(['event', 'target_name']) }), notification.get('created_at'))}>
<RelationshipsSeveranceEvent
type={event.get('type')}
target={event.get('target_name')}
followersCount={event.get('followers_count')}
followingCount={event.get('following_count')}
hidden={hidden}
/>
</div>
</HotKeys>
);
}
renderAdminSignUp (notification, account, link) {
const { intl, unread } = this.props;
@ -423,6 +448,8 @@ class Notification extends ImmutablePureComponent {
return this.renderUpdate(notification);
case 'poll':
return this.renderPoll(notification);
case 'severed_relationships':
return this.renderRelationshipsSevered(notification);
case 'admin.sign_up':
return this.renderAdminSignUp(notification, account, link);
case 'admin.report':