Module: ToggleAwardEmoji

Extended by:
ActiveSupport::Concern
Included in:
Projects::IssuesController, Projects::MergeRequestsController, Projects::NotesController, Projects::SnippetsController, Snippets::NotesController, SnippetsController
Defined in:
app/controllers/concerns/toggle_award_emoji.rb

Instance Method Summary collapse

Instance Method Details

#toggle_award_emojiObject


6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/concerns/toggle_award_emoji.rb', line 6

def toggle_award_emoji
  authenticate_user!
  name = params.require(:name)

  service = AwardEmojis::ToggleService.new(awardable, name, current_user).execute

  if service[:status] == :success
    render json: { ok: true }
  else
    render json: { ok: false }
  end
end