Skip to content

Commit

Permalink
Add specific message for severed relationship events with purged data
Browse files Browse the repository at this point in the history
  • Loading branch information
ClearlyClaire committed Mar 12, 2024
1 parent 0920c1c commit c5fe57a
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,18 @@ const RelationshipsSeveranceEvent = ({ event, hidden }) => {
<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) }}
/>
{ event.get('purged') ? (
<FormattedMessage
id='relationship_severance_notification.purged_data'
defaultMessage='purged by administrators'
/>
) : (
<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>
Expand Down
1 change: 1 addition & 0 deletions app/javascript/mastodon/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,7 @@
"refresh": "Refresh",
"regeneration_indicator.label": "Loading…",
"regeneration_indicator.sublabel": "Your home feed is being prepared!",
"relationship_severance_notification.purged_data": "purged by administrators",
"relationship_severance_notification.relationships": "{count, plural, one {# relationship} other {# relationships}}",
"relationship_severance_notification.types.account_suspension": "Account has been suspended",
"relationship_severance_notification.types.domain_block": "Domain has been suspended",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

class REST::RelationshipSeveranceEventSerializer < ActiveModel::Serializer
attributes :id, :type, :target_name, :created_at
attributes :id, :type, :purged, :target_name, :created_at

attribute :relationships_count, if: -> { current_user.present? }

Expand Down
27 changes: 15 additions & 12 deletions app/views/severed_relationships/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,18 @@
%tr
%td= l event.created_at
%td= t("severed_relationships.event_type.#{event.type}", target_name: event.target_name)
%td
- count = event.severed_relationships.active.where(local_account: current_account).count
- if count.zero?
= t('generic.none')
- else
= table_link_to 'download', t('severed_relationships.download', count: count), following_severed_relationship_path(event, format: :csv)
%td
- count = event.severed_relationships.passive.where(local_account: current_account).count
- if count.zero?
= t('generic.none')
- else
= table_link_to 'download', t('severed_relationships.download', count: count), followers_severed_relationship_path(event, format: :csv)
- if event.purged?
%td{ rowspan: 2 }= t('severed_relationships.purged')
- else
%td
- count = event.severed_relationships.active.where(local_account: current_account).count
- if count.zero?
= t('generic.none')
- else
= table_link_to 'download', t('severed_relationships.download', count: count), following_severed_relationship_path(event, format: :csv)
%td
- count = event.severed_relationships.passive.where(local_account: current_account).count
- if count.zero?
= t('generic.none')
- else
= table_link_to 'download', t('severed_relationships.download', count: count), followers_severed_relationship_path(event, format: :csv)
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1671,6 +1671,7 @@ en:
lost_followers: Lost followers
lost_follows: Lost follows
preamble: You may lose follows and followers when you block a domain or when your moderators decide to suspend a remote server. When that happens, you will be able to download lists of severed relationships, to be inspected and possibly imported on another server.
purged: Information about this server has been purged by your server's administrators.
type: Event
statuses:
attached:
Expand Down

0 comments on commit c5fe57a

Please sign in to comment.