-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WiP] Add support for relationship severance notifications to WebUI
- Loading branch information
1 parent
b76d351
commit 8241ca5
Showing
4 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
app/javascript/mastodon/features/notifications/components/relationships_severance_event.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import PropTypes from 'prop-types'; | ||
|
||
import { defineMessages, FormattedMessage, useIntl } from 'react-intl'; | ||
|
||
import ImmutablePropTypes from 'react-immutable-proptypes'; | ||
|
||
import { RelativeTimestamp } from 'mastodon/components/relative_timestamp'; | ||
|
||
// This needs to be kept in sync with app/models/relationship_severance_event.rb | ||
const messages = defineMessages({ | ||
domain_block: { id: 'relationship_severance_notification.types.domain_block', defaultMessage: 'Domain has been suspended' }, | ||
user_domain_block: { id: 'relationship_severance_notification.types.user_domain_block', defaultMessage: 'You blocked this domain' }, | ||
}); | ||
|
||
const RelationshipsSeveranceEvent = ({ event, hidden }) => { | ||
const intl = useIntl(); | ||
|
||
if (hidden || !event) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<div className='notification__report'> | ||
<div className='notification__report__details'> | ||
<div> | ||
<RelativeTimestamp timestamp={event.get('created_at')} short={false} /> | ||
{' · '} | ||
<FormattedMessage | ||
id='relationship_severance_notification.relationships' | ||
defaultMessage='{count, plural, one {# relationship} other {# relationships}}' | ||
values={{ count: event.get('relationships_count', 0) }} | ||
/> | ||
<br /> | ||
<strong>{intl.formatMessage(messages[event.get('type')])}</strong> | ||
</div> | ||
|
||
<div className='notification__report__actions'> | ||
<a href='/severed_relationships' className='button' target='_blank' rel='noopener noreferrer'> | ||
<FormattedMessage id='relationship_severance_notification.view' defaultMessage='View' /> | ||
</a> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
|
||
}; | ||
|
||
RelationshipsSeveranceEvent.propTypes = { | ||
event: ImmutablePropTypes.map, | ||
hidden: PropTypes.bool, | ||
}; | ||
|
||
export default RelationshipsSeveranceEvent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters