gitlab-org--gitlab-foss/app/controllers/concerns/toggle_award_emoji.rb

25 lines
447 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2016-04-16 15:09:08 -04:00
module ToggleAwardEmoji
extend ActiveSupport::Concern
def toggle_award_emoji
authenticate_user!
2016-04-16 15:09:08 -04:00
name = params.require(:name)
2016-05-17 13:28:17 -04:00
service = AwardEmojis::ToggleService.new(awardable, name, current_user).execute
if service[:status] == :success
render json: { ok: true }
else
render json: { ok: false }
end
2016-04-16 15:09:08 -04:00
end
private
def awardable
raise NotImplementedError
end
end