Commit 21d3afd3 authored by Kerri Miller's avatar Kerri Miller

Merge branch 'remove-store-mentioned-users-to-db-ff' into 'master'

Remove the store_mentioned_users_to_db feature flag

See merge request gitlab-org/gitlab!43393
parents 080dc368 ee73f515
...@@ -81,13 +81,6 @@ module Mentionable ...@@ -81,13 +81,6 @@ module Mentionable
end end
def store_mentions! def store_mentions!
# if store_mentioned_users_to_db feature flag is not enabled then consider storing operation as succeeded
# because we wrap this method in transaction with with_transaction_returning_status, and we need the status to be
# successful if mentionable.save is successful.
#
# This line will get removed when we remove the feature flag.
return true unless store_mentioned_users_to_db_enabled?
refs = all_references(self.author) refs = all_references(self.author)
references = {} references = {}
...@@ -253,15 +246,6 @@ module Mentionable ...@@ -253,15 +246,6 @@ module Mentionable
def model_user_mention def model_user_mention
user_mentions.where(note_id: nil).first_or_initialize user_mentions.where(note_id: nil).first_or_initialize
end end
# We need this method to be checking that store_mentioned_users_to_db feature flag is enabled at the group level
# and not the project level as epics are defined at group level and we want to have epics store user mentions as well
# for the test period.
# During the test period the flag should be enabled at the group level.
def store_mentioned_users_to_db_enabled?
return Feature.enabled?(:store_mentioned_users_to_db, self.project&.group, default_enabled: true) if self.respond_to?(:project)
return Feature.enabled?(:store_mentioned_users_to_db, self.group, default_enabled: true) if self.respond_to?(:group)
end
end end
Mentionable.prepend_if_ee('EE::Mentionable') Mentionable.prepend_if_ee('EE::Mentionable')
---
title: Store user mentions to DB
merge_request: 43393
author:
type: added
---
name: store_mentioned_users_to_db
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/19088
rollout_issue_url:
group: group::project management
type: development
default_enabled: true
...@@ -207,29 +207,8 @@ RSpec.shared_examples 'an editable mentionable' do ...@@ -207,29 +207,8 @@ RSpec.shared_examples 'an editable mentionable' do
end end
RSpec.shared_examples 'mentions in description' do |mentionable_type| RSpec.shared_examples 'mentions in description' do |mentionable_type|
describe 'when store_mentioned_users_to_db feature disabled' do describe 'when storing user mentions' do
before do before do
stub_feature_flags(store_mentioned_users_to_db: false)
mentionable.store_mentions!
end
context 'when mentionable description contains mentions' do
let(:user) { create(:user) }
let(:mentionable) { create(mentionable_type, description: "#{user.to_reference} some description") }
it 'stores no mentions' do
expect(mentionable.user_mentions.count).to eq 0
end
it 'renders description_html correctly' do
expect(mentionable.description_html).to include("<a href=\"/#{user.username}\" data-user=\"#{user.id}\"")
end
end
end
describe 'when store_mentioned_users_to_db feature enabled' do
before do
stub_feature_flags(store_mentioned_users_to_db: true)
mentionable.store_mentions! mentionable.store_mentions!
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