mirror of
https://github.com/wassname/talk.git
synced 2026-06-30 14:43:30 +08:00
Refactor Admin Side queries
This commit is contained in:
@@ -14,7 +14,11 @@ export default withQuery(gql`
|
||||
})
|
||||
flaggedUsernamesCount: userCount(query: {
|
||||
action_type: FLAG,
|
||||
statuses: [SET, CHANGED]
|
||||
state: {
|
||||
status: {
|
||||
username: [SET, CHANGED]
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
`, {
|
||||
|
||||
@@ -48,7 +48,7 @@ class SuspendUserDialogContainer extends Component {
|
||||
SuspendUserDialogContainer.propTypes = {
|
||||
open: PropTypes.bool,
|
||||
hideSuspendUserDialog: PropTypes.func,
|
||||
username: PropTypes.object,
|
||||
username: PropTypes.string,
|
||||
};
|
||||
|
||||
const withOrganizationName = withQuery(gql`
|
||||
|
||||
@@ -55,15 +55,16 @@ class User extends React.Component {
|
||||
className={styles.button}>
|
||||
{user.username}
|
||||
</button>
|
||||
{console.log(user.status.banned.status, user)}
|
||||
{me.id !== user.id &&
|
||||
<ActionsMenu icon="not_interested">
|
||||
<ActionsMenuItem
|
||||
disabled={user.status === 'BANNED'}
|
||||
disabled={user.status.banned.status === 'BANNED'}
|
||||
onClick={this.showSuspenUserDialog}>
|
||||
Suspend User
|
||||
</ActionsMenuItem>
|
||||
<ActionsMenuItem
|
||||
disabled={user.status === 'BANNED'}
|
||||
disabled={user.status.banned.status === 'BANNED'}
|
||||
onClick={this.showBanUserDialog}>
|
||||
Ban User
|
||||
</ActionsMenuItem>
|
||||
|
||||
@@ -20,10 +20,16 @@ const mapDispatchToProps = (dispatch) =>
|
||||
|
||||
const withData = withQuery(gql`
|
||||
query TalkAdmin_Community {
|
||||
flaggedUsernamesCount: userCount(query: {
|
||||
action_type: FLAG,
|
||||
statuses: [SET, CHANGED]
|
||||
})
|
||||
flaggedUsernamesCount: userCount(
|
||||
query:{
|
||||
action_type: FLAG,
|
||||
state: {
|
||||
status: {
|
||||
username: [SET, CHANGED]
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
...${getDefinitionName(FlaggedAccounts.fragments.root)}
|
||||
...${getDefinitionName(FlaggedUser.fragments.root)}
|
||||
me {
|
||||
|
||||
@@ -90,7 +90,16 @@ FlaggedAccountsContainer.propTypes = {
|
||||
|
||||
const LOAD_MORE_QUERY = gql`
|
||||
query TalkAdmin_LoadMoreFlaggedAccounts($limit: Int, $cursor: Cursor) {
|
||||
users(query:{action_type: FLAG, statuses: [PENDING], limit: $limit, cursor: $cursor}){
|
||||
users(query:{
|
||||
action_type: FLAG,
|
||||
state: {
|
||||
status: {
|
||||
username: [PENDING]
|
||||
}
|
||||
},
|
||||
limit: $limit,
|
||||
cursor: $cursor
|
||||
}){
|
||||
hasNextPage
|
||||
endCursor
|
||||
nodes {
|
||||
@@ -116,7 +125,15 @@ export default compose(
|
||||
withFragments({
|
||||
root: gql`
|
||||
fragment TalkAdminCommunity_FlaggedAccounts_root on RootQuery {
|
||||
users(query:{action_type: FLAG, statuses: [PENDING], limit: 10}){
|
||||
users(query:{
|
||||
action_type: FLAG,
|
||||
state: {
|
||||
status: {
|
||||
username: [PENDING]
|
||||
}
|
||||
}
|
||||
limit: 10
|
||||
}){
|
||||
hasNextPage
|
||||
endCursor
|
||||
nodes {
|
||||
|
||||
@@ -37,7 +37,19 @@ export default withFragments({
|
||||
user {
|
||||
id
|
||||
username
|
||||
status
|
||||
state {
|
||||
status {
|
||||
username {
|
||||
status
|
||||
}
|
||||
banned {
|
||||
status
|
||||
}
|
||||
suspension {
|
||||
until
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
asset {
|
||||
id
|
||||
|
||||
Reference in New Issue
Block a user