From 1a39727e389c94589a2e6399f2d218d68f1bb514 Mon Sep 17 00:00:00 2001 From: okbel Date: Tue, 3 Apr 2018 10:29:07 -0300 Subject: [PATCH 1/3] account history to user history --- .../src/components/AccountHistory.js | 20 +++++++++---------- .../coral-admin/src/components/UserDetail.js | 2 +- locales/ar.yml | 4 ++-- locales/da.yml | 4 ++-- locales/de.yml | 4 ++-- locales/en.yml | 4 ++-- locales/es.yml | 4 ++-- locales/fr.yml | 4 ++-- locales/nl_NL.yml | 4 ++-- locales/pt_BR.yml | 4 ++-- locales/zh_CN.yml | 4 ++-- locales/zh_TW.yml | 4 ++-- 12 files changed, 30 insertions(+), 32 deletions(-) diff --git a/client/coral-admin/src/components/AccountHistory.js b/client/coral-admin/src/components/AccountHistory.js index 0d85b62af..6079187c6 100644 --- a/client/coral-admin/src/components/AccountHistory.js +++ b/client/coral-admin/src/components/AccountHistory.js @@ -43,15 +43,15 @@ const readableDuration = (startDate, endDate) => { const buildActionResponse = (typename, created_at, until, status) => { switch (typename) { case 'UsernameStatusHistory': - return t('account_history.username_status', status); + return t('user_history.username_status', status); case 'BannedStatusHistory': return status - ? t('account_history.user_banned') - : t('account_history.ban_removed'); + ? t('user_history.user_banned') + : t('user_history.ban_removed'); case 'SuspensionStatusHistory': return until - ? t('account_history.suspended', readableDuration(created_at, until)) - : t('account_history.suspension_removed'); + ? t('user_history.suspended', readableDuration(created_at, until)) + : t('user_history.suspension_removed'); default: return '-'; } @@ -62,7 +62,7 @@ const getModerationValue = assignedBy => assignedBy.username ) : ( - {t('account_history.system')} + {t('user_history.system')} ); @@ -79,14 +79,12 @@ class AccountHistory extends React.Component { 'talk-admin-account-history-header-row' )} > +
{t('user_history.date')}
- {t('account_history.date')} + {t('user_history.action')}
- {t('account_history.action')} -
-
- {t('account_history.taken_by')} + {t('user_history.taken_by')}
{userHistory.map( diff --git a/client/coral-admin/src/components/UserDetail.js b/client/coral-admin/src/components/UserDetail.js index 31ad999dc..7181a6f52 100644 --- a/client/coral-admin/src/components/UserDetail.js +++ b/client/coral-admin/src/components/UserDetail.js @@ -286,7 +286,7 @@ class UserDetail extends React.Component { 'talk-admin-user-detail-history-tab' )} > - {t('user_detail.account_history')} + {t('user_detail.user_history')} diff --git a/locales/ar.yml b/locales/ar.yml index 3c94c06f0..98f6cc54e 100644 --- a/locales/ar.yml +++ b/locales/ar.yml @@ -438,8 +438,8 @@ ar: reports: "Reports" all: "All" rejected: "Rejected" - account_history: "Account History" - account_history: + user_history: "User History" + user_history: user_banned: "User banned" ban_removed: "Ban removed" username_status: "Username {0}" diff --git a/locales/da.yml b/locales/da.yml index 9618b2f58..0afe4c5ce 100644 --- a/locales/da.yml +++ b/locales/da.yml @@ -431,8 +431,8 @@ da: reports: "Rapporter" all: "Alle" rejected: "Afvist" - account_history: "Konto historik" - account_history: + user_history: "Konto historik" + user_history: user_banned: "Bruger bannet" ban_removed: "Ban fjernet" username_status: "Brugernavn {0}" diff --git a/locales/de.yml b/locales/de.yml index 972c2735b..6f7a1a66e 100644 --- a/locales/de.yml +++ b/locales/de.yml @@ -430,8 +430,8 @@ de: reports: "Meldungen" all: "Alle" rejected: "Abgelehnte" - account_history: "Konto-Verlauf" - account_history: + user_history: "Konto-Verlauf" + user_history: user_banned: "User banned" ban_removed: "Ban removed" username_status: "Username {0}" diff --git a/locales/en.yml b/locales/en.yml index 08d64ddc8..6e4f82c0d 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -439,8 +439,8 @@ en: reports: "Reports" all: "All" rejected: "Rejected" - account_history: "Account History" - account_history: + user_history: "User History" + user_history: user_banned: "User banned" ban_removed: "Ban removed" username_status: "Username {0}" diff --git a/locales/es.yml b/locales/es.yml index ba6cb8ad3..e492aca6f 100644 --- a/locales/es.yml +++ b/locales/es.yml @@ -432,8 +432,8 @@ es: reports: "Reports" all: "All" rejected: "Rejected" - account_history: "Account History" - account_history: + user_history: "User History" + user_history: user_banned: "User banned" ban_removed: "Ban removed" username_status: "Username {0}" diff --git a/locales/fr.yml b/locales/fr.yml index dd14bea81..1f027d49a 100644 --- a/locales/fr.yml +++ b/locales/fr.yml @@ -432,8 +432,8 @@ fr: reports: "Reports" all: "All" rejected: "Rejected" - account_history: "Account History" - account_history: + user_history: "User History" + user_history: user_banned: "User banned" ban_removed: "Ban removed" username_status: "Username {0}" diff --git a/locales/nl_NL.yml b/locales/nl_NL.yml index aa80f58be..9d4057065 100644 --- a/locales/nl_NL.yml +++ b/locales/nl_NL.yml @@ -431,8 +431,8 @@ nl_NL: reports: "Rapportages" all: "Alle" rejected: "Afgewezen" - account_history: "Accountgeschiedenis" - account_history: + user_history: "Accountgeschiedenis" + user_history: user_banned: "User banned" ban_removed: "Ban removed" username_status: "Username {0}" diff --git a/locales/pt_BR.yml b/locales/pt_BR.yml index 86267d51d..d9ef119ed 100644 --- a/locales/pt_BR.yml +++ b/locales/pt_BR.yml @@ -430,8 +430,8 @@ pt_BR: reports: "Reports" all: "All" rejected: "Rejected" - account_history: "Account History" - account_history: + user_history: "User History" + user_history: user_banned: "User banned" ban_removed: "Ban removed" username_status: "Username {0}" diff --git a/locales/zh_CN.yml b/locales/zh_CN.yml index 59e028eb7..b3307a886 100644 --- a/locales/zh_CN.yml +++ b/locales/zh_CN.yml @@ -432,8 +432,8 @@ zh_CN: reports: "Reports" all: "All" rejected: "Rejected" - account_history: "Account History" - account_history: + user_history: "User History" + user_history: user_banned: "User banned" ban_removed: "Ban removed" username_status: "Username {0}" diff --git a/locales/zh_TW.yml b/locales/zh_TW.yml index 1b131f636..c186a667f 100644 --- a/locales/zh_TW.yml +++ b/locales/zh_TW.yml @@ -432,8 +432,8 @@ zh_TW: reports: "Reports" all: "All" rejected: "Rejected" - account_history: "Account History" - account_history: + user_history: "User History" + user_history: user_banned: "User banned" ban_removed: "Ban removed" username_status: "Username {0}" From ef10ab80888c33063f22aadb2f4320277ccc9393 Mon Sep 17 00:00:00 2001 From: okbel Date: Tue, 3 Apr 2018 11:20:22 -0300 Subject: [PATCH 2/3] Renaming components and styles --- .../{AccountHistory.css => UserHistory.css} | 0 .../{AccountHistory.js => UserHistory.js} | 20 +++++++------- package-lock.json | 27 +++++++++++++++++++ test/e2e/page_objects/admin.js | 4 +-- test/e2e/specs/06_suspendUser.js | 2 +- 5 files changed, 40 insertions(+), 13 deletions(-) rename client/coral-admin/src/components/{AccountHistory.css => UserHistory.css} (100%) rename client/coral-admin/src/components/{AccountHistory.js => UserHistory.js} (86%) create mode 100644 package-lock.json diff --git a/client/coral-admin/src/components/AccountHistory.css b/client/coral-admin/src/components/UserHistory.css similarity index 100% rename from client/coral-admin/src/components/AccountHistory.css rename to client/coral-admin/src/components/UserHistory.css diff --git a/client/coral-admin/src/components/AccountHistory.js b/client/coral-admin/src/components/UserHistory.js similarity index 86% rename from client/coral-admin/src/components/AccountHistory.js rename to client/coral-admin/src/components/UserHistory.js index 6079187c6..3a3472c86 100644 --- a/client/coral-admin/src/components/AccountHistory.js +++ b/client/coral-admin/src/components/UserHistory.js @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { murmur3 } from 'murmurhash-js'; -import styles from './AccountHistory.css'; +import styles from './UserHistory.css'; import cn from 'classnames'; import flatten from 'lodash/flatten'; import orderBy from 'lodash/orderBy'; @@ -66,17 +66,17 @@ const getModerationValue = assignedBy => ); -class AccountHistory extends React.Component { +class UserHistory extends React.Component { render() { const { user } = this.props; const userHistory = buildUserHistory(user.state); return (
-
+
{t('user_history.date')}
@@ -90,13 +90,13 @@ class AccountHistory extends React.Component { {userHistory.map( ({ __typename, created_at, assigned_by, until, status }) => (
{moment(new Date(created_at)).format('MMM DD, YYYY')} @@ -105,7 +105,7 @@ class AccountHistory extends React.Component { className={cn( styles.item, styles.action, - 'talk-admin-account-history-row-status' + 'talk-admin-user-history-row-status' )} > {buildActionResponse(__typename, created_at, until, status)} @@ -114,7 +114,7 @@ class AccountHistory extends React.Component { className={cn( styles.item, styles.username, - 'talk-admin-account-history-row-assigned-by' + 'talk-admin-user-history-row-assigned-by' )} > {getModerationValue(assigned_by)} @@ -128,8 +128,8 @@ class AccountHistory extends React.Component { } } -AccountHistory.propTypes = { +UserHistory.propTypes = { user: PropTypes.object.isRequired, }; -export default AccountHistory; +export default UserHistory; diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 000000000..d6105c594 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,27 @@ +{ + "name": "talk", + "version": "4.3.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "exenv": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/exenv/-/exenv-1.2.2.tgz", + "integrity": "sha1-KueOhdmJQVhnCwPUe+wfA72Ru50=" + }, + "react-side-effect": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/react-side-effect/-/react-side-effect-1.1.5.tgz", + "integrity": "sha512-Z2ZJE4p/jIfvUpiUMRydEVpQRf2f8GMHczT6qLcARmX7QRb28JDBTpnM2g/i5y/p7ZDEXYGHWg0RbhikE+hJRw==", + "requires": { + "exenv": "1.2.2", + "shallowequal": "1.0.2" + } + }, + "shallowequal": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/shallowequal/-/shallowequal-1.0.2.tgz", + "integrity": "sha512-zlVXeVUKvo+HEv1e2KQF/csyeMKx2oHvatQ9l6XjCUj3agvC8XGf6R9HvIPDSmp8FNPvx7b5kaEJTRi7CqxtEw==" + } + } +} diff --git a/test/e2e/page_objects/admin.js b/test/e2e/page_objects/admin.js index 218afe425..8e319e499 100644 --- a/test/e2e/page_objects/admin.js +++ b/test/e2e/page_objects/admin.js @@ -128,8 +128,8 @@ module.exports = { rejectedTab: '.talk-admin-user-detail-rejected-tab', historyTab: '.talk-admin-user-detail-history-tab', historyPane: '.talk-admin-user-detail-history-tab-pane', - accountHistory: '.talk-admin-account-history', - accountHistoryRowStatus: '.talk-admin-account-history-row-status', + UserHistory: '.talk-admin-user-history', + UserHistoryRowStatus: '.talk-admin-user-history-row-status', actionsMenu: '.talk-admin-user-detail-actions-button', actionItemSuspendUser: '.action-menu-item#suspendUser', actionMenuButton: diff --git a/test/e2e/specs/06_suspendUser.js b/test/e2e/specs/06_suspendUser.js index 0b89c5c01..81fde3781 100644 --- a/test/e2e/specs/06_suspendUser.js +++ b/test/e2e/specs/06_suspendUser.js @@ -125,7 +125,7 @@ module.exports = { .waitForElementVisible('@historyTab') .click('@historyTab') .waitForElementVisible('@historyPane') - .waitForElementVisible('@accountHistory') + .waitForElementVisible('@UserHistory') .click('@closeButton'); }, 'admin logs out': client => { From c4cbefeb81d73a37045a1a3cc6e87787173b7c2c Mon Sep 17 00:00:00 2001 From: Kim Gardner Date: Wed, 18 Apr 2018 16:02:39 -0400 Subject: [PATCH 3/3] Change to UserHistory in UserDetail.js --- client/coral-admin/src/components/UserDetail.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/coral-admin/src/components/UserDetail.js b/client/coral-admin/src/components/UserDetail.js index 7181a6f52..02b0e66f8 100644 --- a/client/coral-admin/src/components/UserDetail.js +++ b/client/coral-admin/src/components/UserDetail.js @@ -3,7 +3,7 @@ import cn from 'classnames'; import PropTypes from 'prop-types'; import capitalize from 'lodash/capitalize'; import styles from './UserDetail.css'; -import AccountHistory from './AccountHistory'; +import UserHistory from './UserHistory'; import { Slot } from 'coral-framework/components'; import UserDetailCommentList from '../components/UserDetailCommentList'; import { @@ -334,7 +334,7 @@ class UserDetail extends React.Component { tabId={'history'} className={'talk-admin-user-detail-history-tab-pane'} > - +