-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add media reaction unholding mutation
- Loading branch information
1 parent
5c2826f
commit e7e213d
Showing
3 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# frozen_string_literal: true | ||
|
||
class Mutations::MediaReaction::Unhold < Mutations::Base | ||
include FancyMutation | ||
|
||
directive Directive::SitePermission, required: 'community_mod' | ||
|
||
description 'Mark a held reaction as fine, unholding it.' | ||
|
||
input do | ||
argument :media_reaction_id, ID, required: true | ||
end | ||
result Types::Post | ||
errors Types::Errors::NotAuthorized, | ||
Types::Errors::NotAuthenticated, | ||
Types::Errors::NotFound | ||
|
||
def ready?(media_reaction_id:) | ||
authenticate! | ||
@reaction = MediaReaction.find_by(id: media_reaction_id) | ||
return errors << Types::Errors::NotFound.build if @reaction.nil? | ||
authorize!(@reaction, :unhold?) | ||
true | ||
end | ||
|
||
def resolve(**) | ||
@reaction.update!(hidden_at: nil) | ||
@reaction | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters