Add revoke achievement mutation and service
What does this MR do and why?
Related to #385393 (closed)
Add the ability to revoke an achievement (via GraphQL).
Screenshots or screen recordings
How to set up and validate locally
Enable feature flag in rails console: Feature.enable(:achievements)
Find some user achievements (you may need to run the seed depending on the age of your database: bundle exec rake db:seed_fu FILTER=36_achievements
)
query userAchievements(
$id: UserID!
) {
user(id: $id) {
userAchievements {
nodes {
id
createdAt
achievement {
id
name
avatarUrl
namespace {
id
name
}
}
}
}
}
}
variables
{
"id": "gid://gitlab/User/1"
}
Try and revoke one:
mutation {
achievementsRevoke(input: {
userAchievementId: "gid://gitlab/Achievements::UserAchievement/94" }) {
userAchievement {
id
achievement {
id
name
}
revokedByUser {
username
}
revokedAt
}
errors
}
}
Try revoking again and check. you get an error: This achievement has already been revoked
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Lee Tickett