mirror of
https://github.com/wassname/talk.git
synced 2026-07-06 05:17:19 +08:00
Bugfix/userdrawer changestatus (#2469)
* fix date formatting breaking user details popvoer * update mutation return fields for user status changes
This commit is contained in:
@@ -25,6 +25,13 @@ const BanUserMutation = createMutation(
|
||||
current
|
||||
ban {
|
||||
active
|
||||
history {
|
||||
active
|
||||
createdAt
|
||||
createdBy {
|
||||
username
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -49,6 +56,12 @@ const BanUserMutation = createMutation(
|
||||
)!.status.current.concat(GQLUSER_STATUS.BANNED),
|
||||
ban: {
|
||||
active: true,
|
||||
history: [
|
||||
{
|
||||
active: true,
|
||||
createdAt: new Date(),
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -25,6 +25,13 @@ const RemoveUserBanMutation = createMutation(
|
||||
current
|
||||
ban {
|
||||
active
|
||||
history {
|
||||
active
|
||||
createdAt
|
||||
createdBy {
|
||||
username
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -49,6 +56,7 @@ const RemoveUserBanMutation = createMutation(
|
||||
)!.status.current.filter(s => s !== GQLUSER_STATUS.BANNED),
|
||||
ban: {
|
||||
active: false,
|
||||
history: [],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -27,6 +27,16 @@ const RemoveUserSuspensionMutation = createMutation(
|
||||
current
|
||||
suspension {
|
||||
active
|
||||
history {
|
||||
active
|
||||
from {
|
||||
start
|
||||
finish
|
||||
}
|
||||
createdBy {
|
||||
username
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -51,6 +61,11 @@ const RemoveUserSuspensionMutation = createMutation(
|
||||
)!.status.current.concat(GQLUSER_STATUS.SUSPENDED),
|
||||
suspension: {
|
||||
active: false,
|
||||
history: [
|
||||
{
|
||||
active: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { DateTime } from "luxon";
|
||||
import { graphql } from "react-relay";
|
||||
import { Environment } from "relay-runtime";
|
||||
|
||||
@@ -15,6 +16,10 @@ let clientMutationId = 0;
|
||||
const SuspendUserMutation = createMutation(
|
||||
"suspendUser",
|
||||
(environment: Environment, input: MutationInput<MutationTypes>) => {
|
||||
const now = new Date();
|
||||
const finish = DateTime.fromJSDate(now).plus({
|
||||
seconds: input.timeout,
|
||||
});
|
||||
return commitMutationPromiseNormalized<MutationTypes>(environment, {
|
||||
mutation: graphql`
|
||||
mutation SuspendUserMutation($input: SuspendUserInput!) {
|
||||
@@ -25,6 +30,16 @@ const SuspendUserMutation = createMutation(
|
||||
current
|
||||
suspension {
|
||||
active
|
||||
history {
|
||||
active
|
||||
from {
|
||||
start
|
||||
finish
|
||||
}
|
||||
createdBy {
|
||||
username
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -49,6 +64,15 @@ const SuspendUserMutation = createMutation(
|
||||
)!.status.current.concat(GQLUSER_STATUS.SUSPENDED),
|
||||
suspension: {
|
||||
active: true,
|
||||
history: [
|
||||
{
|
||||
active: true,
|
||||
from: {
|
||||
start: now,
|
||||
finish,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user