mirror of
https://github.com/wassname/talk.git
synced 2026-08-17 11:27:52 +08:00
Updated with User-Status-Refactor API
This commit is contained in:
@@ -89,15 +89,17 @@ class UserDetail extends React.Component {
|
||||
}
|
||||
|
||||
getActionMenuLabel() {
|
||||
// const {root: {user}} = this.props;
|
||||
//
|
||||
// if (user.status === 'BANNED') {
|
||||
// return 'Banned';
|
||||
// } else if (user.suspension.until && new Date(user.suspension.until) > new Date()) {
|
||||
// return 'Suspended';
|
||||
// } else {
|
||||
// return '';
|
||||
// }
|
||||
const {root: {user}} = this.props;
|
||||
|
||||
const banned = get(user, 'state.status.banned.status');
|
||||
const suspensionUntil = get(user, 'state.status.suspension.until');
|
||||
|
||||
if (banned) {
|
||||
return 'Banned';
|
||||
} else if (suspensionUntil && new Date(suspensionUntil) > new Date()) {
|
||||
return 'Suspended';
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -128,8 +130,8 @@ class UserDetail extends React.Component {
|
||||
rejectedPercent = 0;
|
||||
}
|
||||
|
||||
const banned = get(user, 'status.banned.status');
|
||||
const suspensionUntil = get(user, 'status.suspension.until');
|
||||
const banned = get(user, 'state.status.banned.status');
|
||||
const suspensionUntil = get(user, 'state.status.suspension.until');
|
||||
|
||||
const suspended =
|
||||
user &&
|
||||
@@ -153,22 +155,18 @@ class UserDetail extends React.Component {
|
||||
}, 'talk-admin-user-detail-actions-button')}
|
||||
label={this.getActionMenuLabel()}>
|
||||
|
||||
{suspended && <ActionsMenuItem
|
||||
{suspended ? <ActionsMenuItem
|
||||
onClick={this.showSuspenUserDialog}>
|
||||
Remove Suspension
|
||||
</ActionsMenuItem>}
|
||||
|
||||
{banned && <ActionsMenuItem
|
||||
onClick={this.showSuspenUserDialog}>
|
||||
Remove Ban
|
||||
</ActionsMenuItem>}
|
||||
|
||||
{!suspended && <ActionsMenuItem
|
||||
</ActionsMenuItem> : <ActionsMenuItem
|
||||
onClick={this.showSuspenUserDialog}>
|
||||
Suspend User
|
||||
</ActionsMenuItem>}
|
||||
|
||||
{!banned && <ActionsMenuItem
|
||||
{banned ? <ActionsMenuItem
|
||||
onClick={this.showSuspenUserDialog}>
|
||||
Remove Ban
|
||||
</ActionsMenuItem> : <ActionsMenuItem
|
||||
onClick={this.showBanUserDialog}>
|
||||
Ban User
|
||||
</ActionsMenuItem>}
|
||||
|
||||
@@ -164,6 +164,7 @@ export const withUserDetailQuery = withQuery(gql`
|
||||
state {
|
||||
status {
|
||||
suspension {
|
||||
until
|
||||
history {
|
||||
until
|
||||
created_at
|
||||
@@ -173,6 +174,7 @@ export const withUserDetailQuery = withQuery(gql`
|
||||
}
|
||||
}
|
||||
banned {
|
||||
status
|
||||
history {
|
||||
status
|
||||
assigned_by {
|
||||
@@ -182,6 +184,7 @@ export const withUserDetailQuery = withQuery(gql`
|
||||
}
|
||||
}
|
||||
username {
|
||||
status
|
||||
history {
|
||||
status
|
||||
assigned_by {
|
||||
|
||||
Reference in New Issue
Block a user