Merge pull request #1504 from coralproject/155910162

Account History to User History
This commit is contained in:
Kim Gardner
2018-04-18 16:18:26 -04:00
committed by GitHub
15 changed files with 70 additions and 45 deletions
@@ -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 {
@@ -272,7 +272,7 @@ class UserDetail extends React.Component {
'talk-admin-user-detail-history-tab'
)}
>
{t('user_detail.account_history')}
{t('user_detail.user_history')}
</Tab>
</TabBar>
@@ -320,7 +320,7 @@ class UserDetail extends React.Component {
tabId={'history'}
className={'talk-admin-user-detail-history-tab-pane'}
>
<AccountHistory user={user} />
<UserHistory user={user} />
</TabPane>
</TabContent>
</Drawer>
@@ -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';
@@ -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,43 +62,41 @@ const getModerationValue = assignedBy =>
assignedBy.username
) : (
<span>
<Icon name="computer" /> {t('account_history.system')}
<Icon name="computer" /> {t('user_history.system')}
</span>
);
class AccountHistory extends React.Component {
class UserHistory extends React.Component {
render() {
const { user } = this.props;
const userHistory = buildUserHistory(user.state);
return (
<div>
<div className={cn(styles.table, 'talk-admin-account-history')}>
<div className={cn(styles.table, 'talk-admin-user-history')}>
<div
className={cn(
styles.headerRow,
'talk-admin-account-history-header-row'
'talk-admin-user-history-header-row'
)}
>
<div className={styles.headerRowItem}>{t('user_history.date')}</div>
<div className={styles.headerRowItem}>
{t('account_history.date')}
{t('user_history.action')}
</div>
<div className={styles.headerRowItem}>
{t('account_history.action')}
</div>
<div className={styles.headerRowItem}>
{t('account_history.taken_by')}
{t('user_history.taken_by')}
</div>
</div>
{userHistory.map(
({ __typename, created_at, assigned_by, until, status }) => (
<div
className={cn(styles.row, 'talk-admin-account-history-row')}
className={cn(styles.row, 'talk-admin-user-history-row')}
key={`${__typename}_${murmur3(created_at)}`}
>
<div
className={cn(
styles.item,
'talk-admin-account-history-row-date'
'talk-admin-user-history-row-date'
)}
>
{moment(new Date(created_at)).format('MMM DD, YYYY')}
@@ -107,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)}
@@ -116,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)}
@@ -130,8 +128,8 @@ class AccountHistory extends React.Component {
}
}
AccountHistory.propTypes = {
UserHistory.propTypes = {
user: PropTypes.object.isRequired,
};
export default AccountHistory;
export default UserHistory;
+2 -2
View File
@@ -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}"
+2 -2
View File
@@ -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}"
+2 -2
View File
@@ -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}"
+2 -2
View File
@@ -446,8 +446,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}"
+2 -2
View File
@@ -439,8 +439,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}"
+2 -2
View File
@@ -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}"
+2 -2
View File
@@ -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}"
+2 -2
View File
@@ -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}"
+2 -2
View File
@@ -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}"
+27
View File
@@ -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=="
}
}
}
+2 -2
View File
@@ -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:
+1 -1
View File
@@ -125,7 +125,7 @@ module.exports = {
.waitForElementVisible('@historyTab')
.click('@historyTab')
.waitForElementVisible('@historyPane')
.waitForElementVisible('@accountHistory')
.waitForElementVisible('@UserHistory')
.click('@closeButton');
},
'admin logs out': client => {