Commit d46084c3 authored by Peter Leitzen's avatar Peter Leitzen

Publish status page on emoji destroy

parent 6fba4972
......@@ -14,8 +14,16 @@ module AwardEmojis
end
award = awards.destroy_all.first # rubocop: disable DestroyAll
after_destroy(award)
success(award: award)
end
private
def after_destroy(award)
end
end
end
AwardEmojis::DestroyService.prepend_if_ee('EE::AwardEmojis::DestroyService')
# frozen_string_literal: true
module EE
module AwardEmojis
module DestroyService
extend ::Gitlab::Utils::Override
private
override :after_destroy
def after_destroy(award)
super
StatusPage.trigger_publish(project, current_user, award)
end
end
end
end
# frozen_string_literal: true
require 'spec_helper'
describe AwardEmojis::DestroyService do
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project) }
let_it_be(:awardable) { create(:note_on_issue, project: project) }
let(:name) { 'thumbsup' }
subject(:service) { described_class.new(awardable, name, user) }
describe '#execute' do
describe 'publish to status page' do
let(:execute) { service.execute }
let(:issue_id) { awardable.noteable_id }
before do
create(:award_emoji, user: user, name: name, awardable: awardable)
end
context 'with recognized emoji' do
let(:name) { StatusPage::AWARD_EMOJI }
include_examples 'trigger status page publish'
end
context 'with unrecognized emoji' do
let(:name) { 'x' }
include_examples 'no trigger status page publish'
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment