Commit 289acd2f authored by Toon Claes's avatar Toon Claes

Add feature guard for custom emoji

Custom Emoji is still behind a default-disabled feature flag [1]. With
this change a few codepaths that weren't guarded by the feature flag are
now disabled when the feature is not active.

1. https://gitlab.com/gitlab-org/gitlab/-/issues/231317
parent cba2c203
...@@ -36,7 +36,7 @@ class CustomEmoji < ApplicationRecord ...@@ -36,7 +36,7 @@ class CustomEmoji < ApplicationRecord
namespace = resource.root_ancestor namespace = resource.root_ancestor
return none if namespace.nil? return none if namespace.nil? || Feature.disabled?(:custom_emoji, namespace)
namespace.custom_emoji namespace.custom_emoji
end end
......
...@@ -277,5 +277,17 @@ RSpec.describe AwardEmoji do ...@@ -277,5 +277,17 @@ RSpec.describe AwardEmoji do
expect(new_award.url).to eq(custom_emoji.url) expect(new_award.url).to eq(custom_emoji.url)
end end
context 'feature flag disabled' do
before do
stub_feature_flags(custom_emoji: false)
end
it 'does not query' do
new_award = build_award(custom_emoji.name)
expect(ActiveRecord::QueryRecorder.new { new_award.url }.count).to be_zero
end
end
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