debian-mirror-gitlab/app/controllers/concerns/toggle_award_emoji.rb
2019-12-04 20:38:33 +05:30

24 lines
447 B
Ruby

# frozen_string_literal: true
module ToggleAwardEmoji
extend ActiveSupport::Concern
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
private
def awardable
raise NotImplementedError
end
end