Added in 24.2.
In this guide, you will learn how to report a user profile as abuse with a reason.
Here is an example of reportAbuse
mutation.
mutation ReportAbuse($entityId: ID!, $reporterComment: String, $reportReason: String, $reportedFor: String) {
reportAbuse(entityId: $entityId, reporterComment: $reporterComment, reportReason: $reportReason, reportedFor: $reportedFor) {
result
errors {
...Error
}
}
}
fragment Error on Error {
message
fields
}
In our example, we are going to report the user ID: 43 as spam, and the user is reported for the bio information. The variables to report a user are given below:
{
"entityId": "user:43",
"reporterComment": "This comment is to report abusive user.",
"reportReason": "Spam",
"reportedFor": "Bio"
}
Here is the response to the abuse report mutation.
{
"data": {
"reportAbuse": {
"result": true,
"errors": null
}
}
}
Retrieve the abusive user reports with report reason and reported by
Here is the graphql query to retrieve the abusive user reports with report reason and reported by as constraints.
query AbuseReportedUsers(
$constraints: AbuseReportedUsersConstraints,
$sorts: AbuseReportedUsersSorts
) {
abuseReportedUsers(
constraints: $constraints,
sorts: $sorts
) {
totalCount
edges {
node {
...AbuseReportedUserView
}
cursor
}
}
}
fragment AbuseReportedUserView on AbuseReportedUser {
id
user {
...UserPersonalInfo
}
reportedDate
reportersCount
}
fragment UserPersonalInfo on User {
firstName
lastName
email
biography
}
Here are the variable constraints to retrieve the abusive reports.
{
"constraints": {
"reportedFor": {
"eq": "Bio"
},
"reportReason": {
"eq": "Spam"
}
},
"sorts": {
"reportedDate": {
"direction": "DESC",
"order": 0
}
}
}
Here is the response to the graphql query.
{
"data": {
"abuseReportedUsers": {
"totalCount": 2,
"edges": [
{
"node": {
"id": "AbuseReportedUser:43",
"user": {
"firstName": null,
"lastName": null,
"email": "kdsgks@khvk.com",
"biography": null
},
"reportedDate": "2024-02-26T16:27:47.000+02:00",
"reportersCount": 1
},
"cursor": "1111122222333333AAAAABBBBBCCCCCDDDDEEE"
},
{
"node": {
"id": "AbuseReportedUser:1",
"user": {
"firstName": "admin",
"lastName": null,
"email": "admin@lithium.com",
"biography": "some bio"
},
"reportedDate": "2024-02-12T09:51:52.000+02:00",
"reportersCount": 1
},
"cursor": "AAABBBBCCCCCDSDDDDDEEEEEEFFFFFFGGGGGHHHHH"
}
]
}
}
}
ATLAS
Comments