diff --git a/client/coral-admin/src/components/AccountHistory.css b/client/coral-admin/src/components/AccountHistory.css index 09b324f08..fbd1027d1 100644 --- a/client/coral-admin/src/components/AccountHistory.css +++ b/client/coral-admin/src/components/AccountHistory.css @@ -15,6 +15,10 @@ } } +.username { + word-break: break-all; +} + .headerRowItem { color: #595959; font-weight: bold; diff --git a/client/coral-admin/src/components/AccountHistory.js b/client/coral-admin/src/components/AccountHistory.js index 52f3af92d..a16b334ca 100644 --- a/client/coral-admin/src/components/AccountHistory.js +++ b/client/coral-admin/src/components/AccountHistory.js @@ -5,7 +5,10 @@ import styles from './AccountHistory.css'; import cn from 'classnames'; import flatten from 'lodash/flatten'; import orderBy from 'lodash/orderBy'; +import has from 'lodash/has'; import moment from 'moment'; +import t from 'coral-framework/services/i18n'; +import { Icon } from 'coral-ui'; const buildUserHistory = (userState = {}) => { return orderBy( @@ -29,31 +32,39 @@ const readableDuration = (startDate, endDate) => { const durAsHours = dur.asHours().toFixed(0); return durAsHours > 23 - ? `${durAsDays} ${durAsDays > 1 ? 'days' : 'day'}` - : `${durAsHours} ${durAsHours > 1 ? 'hours' : 'hour'}`; + ? durAsDays > 1 + ? t('suspenduser.days', durAsDays) + : t('suspenduser.day', durAsDays) + : durAsHours > 1 + ? t('suspenduser.hours', durAsHours) + : t('suspenduser.hour', durAsHours); }; const buildActionResponse = (typename, created_at, until, status) => { switch (typename) { case 'UsernameStatusHistory': - return `Username ${status}`; + return t('account_history.username_status', status); case 'BannedStatusHistory': - return status ? 'User banned' : 'Ban removed'; + return status + ? t('account_history.user_banned') + : t('account_history.ban_removed'); case 'SuspensionStatusHistory': return until - ? `Suspended, ${readableDuration(created_at, until)}` - : 'Suspension removed'; + ? t('account_history.suspended', readableDuration(created_at, until)) + : t('account_history.suspension_removed'); default: return '-'; } }; -const getModerationValue = (userId, assignedBy = {}) => { - if (assignedBy && userId !== assignedBy.id) { - return assignedBy.username; - } - return 'SYSTEM'; -}; +const getModerationValue = assignedBy => + has(assignedBy, 'username') ? ( + assignedBy.username + ) : ( + + {t('account_history.system')} + + ); class AccountHistory extends React.Component { render() { @@ -68,9 +79,15 @@ class AccountHistory extends React.Component { 'talk-admin-account-history-header-row' )} > -
Date
-
Action
-
Moderation
+
+ {t('account_history.date')} +
+
+ {t('account_history.action')} +
+
+ {t('account_history.taken_by')} +
{userHistory.map( ({ __typename, created_at, assigned_by, until, status }) => ( @@ -98,10 +115,11 @@ class AccountHistory extends React.Component {
- {getModerationValue(user.id, assigned_by)} + {getModerationValue(assigned_by)}
) diff --git a/locales/da.yml b/locales/da.yml index a1d1fab73..c68185406 100644 --- a/locales/da.yml +++ b/locales/da.yml @@ -432,6 +432,16 @@ da: all: "All" rejected: "Rejected" account_history: "Account History" + account_history: + user_banned: "User banned" + ban_removed: "Ban removed" + username_status: "Username {0}" + suspended: "Suspended, {0}" + suspension_removed: "Suspension removed" + system: "System" + date: "Date" + action: "Action" + taken_by: "Taken By" user_impersonating: "Denne bruger efterligner" user_no_comment: "Du har aldrig efterladt en kommentar. Deltag i samtalen" username_offensive: "Dette brugernavn er stødende" diff --git a/locales/de.yml b/locales/de.yml index 069c8ddb3..b5ced1096 100644 --- a/locales/de.yml +++ b/locales/de.yml @@ -431,6 +431,16 @@ de: all: "Alle" rejected: "Abgelehnte" account_history: "Konto-Verlauf" + account_history: + user_banned: "User banned" + ban_removed: "Ban removed" + username_status: "Username {0}" + suspended: "Suspended, {0}" + suspension_removed: "Suspension removed" + system: "System" + date: "Date" + action: "Action" + taken_by: "Taken By" user_impersonating: "Gibt sich für jemand anderen aus" user_no_comment: "Sie haben noch keinen Kommentar abgegeben. Teilen Sie Ihre Meinung mit uns!" username_offensive: "Dieser Nutzername ist unangemessen" diff --git a/locales/en.yml b/locales/en.yml index 8f7a3853b..2bbe23254 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -396,6 +396,8 @@ en: one_hour: "1 hour" hours: "{0} hours" days: "{0} days" + hour: "{0} hours" + day: "{0} days" cancel: "Cancel" suspend_user: "Suspend User" email_message_suspend: "Dear {0},\n\nIn accordance with {1}’s community guidelines, your account has been temporarily suspended. During the suspension, you will be unable to comment, flag or engage with fellow commenters. Please rejoin the conversation {2}." @@ -434,6 +436,16 @@ en: all: "All" rejected: "Rejected" account_history: "Account History" + account_history: + user_banned: "User banned" + ban_removed: "Ban removed" + username_status: "Username {0}" + suspended: "Suspended, {0}" + suspension_removed: "Suspension removed" + system: "System" + date: "Date" + action: "Action" + taken_by: "Taken By" user_impersonating: "This user is impersonating" user_no_comment: "You've never left a comment. Join the conversation!" username_offensive: "This username is offensive" @@ -462,4 +474,4 @@ en: close: "Close this Installer" admin_sidebar: view_options: "View Options" - sort_comments: "Sort Comments" + sort_comments: "Sort Comments" \ No newline at end of file diff --git a/locales/es.yml b/locales/es.yml index 28e12ac3f..8edd1f8fc 100644 --- a/locales/es.yml +++ b/locales/es.yml @@ -433,6 +433,16 @@ es: all: "All" rejected: "Rejected" account_history: "Account History" + account_history: + user_banned: "User banned" + ban_removed: "Ban removed" + username_status: "Username {0}" + suspended: "Suspended, {0}" + suspension_removed: "Suspension removed" + system: "System" + date: "Date" + action: "Action" + taken_by: "Taken By" user_impersonating: "Este usuario suplanta a alguien" user_no_comment: "No has dejado aún ningún comentario. ¡Únete a la conversación!" username_offensive: "Este nombre de usuario es ofensivo" diff --git a/locales/fr.yml b/locales/fr.yml index a922d931d..fb2b3be99 100644 --- a/locales/fr.yml +++ b/locales/fr.yml @@ -433,6 +433,16 @@ fr: all: "All" rejected: "Rejected" account_history: "Account History" + account_history: + user_banned: "User banned" + ban_removed: "Ban removed" + username_status: "Username {0}" + suspended: "Suspended, {0}" + suspension_removed: "Suspension removed" + system: "System" + date: "Date" + action: "Action" + taken_by: "Taken By" user_impersonating: "Cet utilisateur se fait passer pour quelqu'un d'autre" user_no_comment: "Vous n'avez jamais laissé de commentaire. Rejoignez la conversation !" username_offensive: "Ce nom d'utilisateur est offensant" diff --git a/locales/nl_NL.yml b/locales/nl_NL.yml index f6be0ef6c..a60268e42 100644 --- a/locales/nl_NL.yml +++ b/locales/nl_NL.yml @@ -432,6 +432,16 @@ nl_NL: all: "Alle" rejected: "Afgewezen" account_history: "Accountgeschiedenis" + account_history: + user_banned: "User banned" + ban_removed: "Ban removed" + username_status: "Username {0}" + suspended: "Suspended, {0}" + suspension_removed: "Suspension removed" + system: "System" + date: "Date" + action: "Action" + taken_by: "Taken By" user_impersonating: "Deze gebruiker imiteert" user_no_comment: "Je hebt nog niet eerder gereageerd. Laat je mening horen!" username_offensive: "Dit is een aanstootgevende gebruikersnaam." diff --git a/locales/pt_BR.yml b/locales/pt_BR.yml index c64c17824..b19a3789b 100644 --- a/locales/pt_BR.yml +++ b/locales/pt_BR.yml @@ -431,6 +431,16 @@ pt_BR: all: "All" rejected: "Rejected" account_history: "Account History" + account_history: + user_banned: "User banned" + ban_removed: "Ban removed" + username_status: "Username {0}" + suspended: "Suspended, {0}" + suspension_removed: "Suspension removed" + system: "System" + date: "Date" + action: "Action" + taken_by: "Taken By" user_impersonating: "Este usuário está representando" user_no_comment: "Você nunca deixou um comentário. Participe da conversa!" username_offensive: "Esse nome de usuário é ofensivo" diff --git a/locales/zh_CN.yml b/locales/zh_CN.yml index 3108addf6..31d6623a3 100644 --- a/locales/zh_CN.yml +++ b/locales/zh_CN.yml @@ -433,6 +433,16 @@ zh_CN: all: "All" rejected: "Rejected" account_history: "Account History" + account_history: + user_banned: "User banned" + ban_removed: "Ban removed" + username_status: "Username {0}" + suspended: "Suspended, {0}" + suspension_removed: "Suspension removed" + system: "System" + date: "Date" + action: "Action" + taken_by: "Taken By" user_impersonating: "冒名用户" user_no_comment: "您未曾发表评论。现在就来加入对话吧!" username_offensive: "用户名有冒犯性" diff --git a/locales/zh_TW.yml b/locales/zh_TW.yml index c6698fec4..8f2f54dfd 100644 --- a/locales/zh_TW.yml +++ b/locales/zh_TW.yml @@ -433,6 +433,16 @@ zh_TW: all: "All" rejected: "Rejected" account_history: "Account History" + account_history: + user_banned: "User banned" + ban_removed: "Ban removed" + username_status: "Username {0}" + suspended: "Suspended, {0}" + suspension_removed: "Suspension removed" + system: "System" + date: "Date" + action: "Action" + taken_by: "Taken By" user_impersonating: "此用戶正在冒充" user_no_comment: "您尚未評論過。加入對話吧!" username_offensive: "這個用戶名有冒犯性"