From 139d036b42d39d9ec55a295b5232a31186b0d61c Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Thu, 22 Feb 2018 17:32:37 -0700 Subject: [PATCH 1/3] changed styles + added translations --- .../src/components/AccountHistory.css | 6 ++- .../src/components/AccountHistory.js | 46 ++++++++++++------- locales/en.yml | 14 +++++- 3 files changed, 48 insertions(+), 18 deletions(-) diff --git a/client/coral-admin/src/components/AccountHistory.css b/client/coral-admin/src/components/AccountHistory.css index 09b324f08..1d94ae82e 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; @@ -24,7 +28,7 @@ border-bottom: 1px solid #e0e0e0; } -.action { +.action, .system { color: black; font-weight: bold; } diff --git a/client/coral-admin/src/components/AccountHistory.js b/client/coral-admin/src/components/AccountHistory.js index 52f3af92d..e945e9c8e 100644 --- a/client/coral-admin/src/components/AccountHistory.js +++ b/client/coral-admin/src/components/AccountHistory.js @@ -5,7 +5,9 @@ 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'; const buildUserHistory = (userState = {}) => { return orderBy( @@ -29,31 +31,35 @@ 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 hasUsername = user => has(user, 'username'); + +const getModerationValue = assignedBy => + hasUsername(assignedBy) ? assignedBy.username : t('account_history.system'); class AccountHistory extends React.Component { render() { @@ -68,9 +74,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.actor')} +
{userHistory.map( ({ __typename, created_at, assigned_by, until, status }) => ( @@ -98,10 +110,12 @@ class AccountHistory extends React.Component {
- {getModerationValue(user.id, assigned_by)} + {getModerationValue(assigned_by)}
) diff --git a/locales/en.yml b/locales/en.yml index 8f7a3853b..3d5c9bba5 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" + actor: "Actor" 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 From 8b4fe461204b50eaa5b7c8a0bff050c6439d2c07 Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Fri, 23 Feb 2018 12:32:49 -0700 Subject: [PATCH 2/3] added support for new system icon --- .../coral-admin/src/components/AccountHistory.css | 2 +- .../coral-admin/src/components/AccountHistory.js | 14 +++++++++----- locales/en.yml | 4 ++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/client/coral-admin/src/components/AccountHistory.css b/client/coral-admin/src/components/AccountHistory.css index 1d94ae82e..fbd1027d1 100644 --- a/client/coral-admin/src/components/AccountHistory.css +++ b/client/coral-admin/src/components/AccountHistory.css @@ -28,7 +28,7 @@ border-bottom: 1px solid #e0e0e0; } -.action, .system { +.action { color: black; font-weight: bold; } diff --git a/client/coral-admin/src/components/AccountHistory.js b/client/coral-admin/src/components/AccountHistory.js index e945e9c8e..a16b334ca 100644 --- a/client/coral-admin/src/components/AccountHistory.js +++ b/client/coral-admin/src/components/AccountHistory.js @@ -8,6 +8,7 @@ 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( @@ -56,10 +57,14 @@ const buildActionResponse = (typename, created_at, until, status) => { } }; -const hasUsername = user => has(user, 'username'); - const getModerationValue = assignedBy => - hasUsername(assignedBy) ? assignedBy.username : t('account_history.system'); + has(assignedBy, 'username') ? ( + assignedBy.username + ) : ( + + {t('account_history.system')} + + ); class AccountHistory extends React.Component { render() { @@ -81,7 +86,7 @@ class AccountHistory extends React.Component { {t('account_history.action')}
- {t('account_history.actor')} + {t('account_history.taken_by')}
{userHistory.map( @@ -111,7 +116,6 @@ class AccountHistory extends React.Component { className={cn( styles.item, styles.username, - !hasUsername(assigned_by) && styles.system, 'talk-admin-account-history-row-assigned-by' )} > diff --git a/locales/en.yml b/locales/en.yml index 3d5c9bba5..2bbe23254 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -442,10 +442,10 @@ en: username_status: "Username {0}" suspended: "Suspended, {0}" suspension_removed: "Suspension removed" - system: "SYSTEM" + system: "System" date: "Date" action: "Action" - actor: "Actor" + 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" From 7e41619732c47a6e8fcfc25086c4fc9acd370c1d Mon Sep 17 00:00:00 2001 From: Kim Gardner Date: Fri, 23 Feb 2018 14:54:45 -0500 Subject: [PATCH 3/3] Update new translation keys --- locales/da.yml | 10 ++++++++++ locales/de.yml | 10 ++++++++++ locales/es.yml | 10 ++++++++++ locales/fr.yml | 10 ++++++++++ locales/nl_NL.yml | 10 ++++++++++ locales/pt_BR.yml | 10 ++++++++++ locales/zh_CN.yml | 10 ++++++++++ locales/zh_TW.yml | 10 ++++++++++ 8 files changed, 80 insertions(+) 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/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: "這個用戶名有冒犯性"