Commit a0f7f0eb authored by Alex Kalderimis's avatar Alex Kalderimis

Remove design_activity_events feature flag

The feature has been in production on gitlab.com for several weeks now
without incident.
parent 4cf1fbe2
...@@ -46,7 +46,7 @@ class UserRecentEventsFinder ...@@ -46,7 +46,7 @@ class UserRecentEventsFinder
SQL SQL
# Workaround for https://github.com/rails/rails/issues/24193 # Workaround for https://github.com/rails/rails/issues/24193
ensure_design_visibility(Event.from([Arel.sql(sql)])) Event.from([Arel.sql(sql)])
end end
# rubocop: enable CodeReuse/ActiveRecord # rubocop: enable CodeReuse/ActiveRecord
...@@ -59,11 +59,4 @@ class UserRecentEventsFinder ...@@ -59,11 +59,4 @@ class UserRecentEventsFinder
def projects def projects
target_user.project_interactions.to_sql target_user.project_interactions.to_sql
end end
# TODO: remove when the :design_activity_events feature flag is removed.
def ensure_design_visibility(events)
return events if Feature.enabled?(:design_activity_events)
events.not_design
end
end end
...@@ -69,8 +69,6 @@ module EventsHelper ...@@ -69,8 +69,6 @@ module EventsHelper
end end
def designs_visible? def designs_visible?
return false unless Feature.enabled?(:design_activity_events)
if @project if @project
design_activity_enabled?(@project) design_activity_enabled?(@project)
elsif @group elsif @group
......
...@@ -83,9 +83,6 @@ class Event < ApplicationRecord ...@@ -83,9 +83,6 @@ class Event < ApplicationRecord
scope :for_wiki_page, -> { where(target_type: 'WikiPage::Meta') } scope :for_wiki_page, -> { where(target_type: 'WikiPage::Meta') }
scope :for_design, -> { where(target_type: 'DesignManagement::Design') } scope :for_design, -> { where(target_type: 'DesignManagement::Design') }
# Needed to implement feature flag: can be removed when feature flag is removed
scope :not_design, -> { where('target_type IS NULL or target_type <> ?', 'DesignManagement::Design') }
scope :with_associations, -> do scope :with_associations, -> do
# We're using preload for "push_event_payload" as otherwise the association # We're using preload for "push_event_payload" as otherwise the association
# is not always available (depending on the query being built). # is not always available (depending on the query being built).
......
...@@ -33,23 +33,16 @@ class EventCollection ...@@ -33,23 +33,16 @@ class EventCollection
project_events project_events
end end
relation = apply_feature_flags(relation)
relation = paginate_events(relation) relation = paginate_events(relation)
relation.with_associations.to_a relation.with_associations.to_a
end end
def all_project_events def all_project_events
apply_feature_flags(Event.from_union([project_events]).recent) Event.from_union([project_events]).recent
end end
private private
def apply_feature_flags(events)
events = events.not_design unless ::Feature.enabled?(:design_activity_events)
events
end
def project_events def project_events
relation_with_join_lateral('project_id', projects) relation_with_join_lateral('project_id', projects)
end end
......
...@@ -83,8 +83,6 @@ class EventCreateService ...@@ -83,8 +83,6 @@ class EventCreateService
end end
def save_designs(current_user, create: [], update: []) def save_designs(current_user, create: [], update: [])
return [] unless Feature.enabled?(:design_activity_events)
records = create.zip([:created].cycle) + update.zip([:updated].cycle) records = create.zip([:created].cycle) + update.zip([:updated].cycle)
return [] if records.empty? return [] if records.empty?
...@@ -92,7 +90,6 @@ class EventCreateService ...@@ -92,7 +90,6 @@ class EventCreateService
end end
def destroy_designs(designs, current_user) def destroy_designs(designs, current_user)
return [] unless Feature.enabled?(:design_activity_events)
return [] unless designs.present? return [] unless designs.present?
create_record_events(designs.zip([:destroyed].cycle), current_user) create_record_events(designs.zip([:destroyed].cycle), current_user)
......
---
title: Enable design activity events by default
merge_request: 37107
author:
type: added
...@@ -250,32 +250,10 @@ Feature.disable(:design_management_reference_filter_gfm_pipeline) ...@@ -250,32 +250,10 @@ Feature.disable(:design_management_reference_filter_gfm_pipeline)
## Design activity records ## Design activity records
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/33051) in GitLab 13.1 > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/33051) in GitLab 13.1.
> - It's deployed behind a feature flag, disabled by default. > - [Feature flag removed](https://gitlab.com/gitlab-org/gitlab/-/issues/225205) in GitLab 13.2.
> - It's enabled on GitLab.com.
> - To use it in GitLab self-managed instances, ask a GitLab administrator to [enable it](#enable-or-disable-design-events-core-only). **(CORE ONLY)**
User activity events on designs (creation, deletion, and updates) are tracked by GitLab and User activity events on designs (creation, deletion, and updates) are tracked by GitLab and
displayed on the [user profile](../../profile/index.md#user-profile), displayed on the [user profile](../../profile/index.md#user-profile),
[group](../../group/index.md#view-group-activity), [group](../../group/index.md#view-group-activity),
and [project](../index.md#project-activity) activity pages. and [project](../index.md#project-activity) activity pages.
### Enable or disable Design Events **(CORE ONLY)**
User activity for designs is under development and not ready for production use. It is
deployed behind a feature flag that is **disabled by default**.
[GitLab administrators with access to the GitLab Rails console](../../../administration/troubleshooting/navigating_gitlab_via_rails_console.md#starting-a-rails-console-session)
can enable it for your instance. You're welcome to test it, but use it at your
own risk.
To enable it:
```ruby
Feature.enable(:design_activity_events)
```
To disable it:
```ruby
Feature.disable(:design_activity_events)
```
...@@ -26,8 +26,6 @@ class EventFilter ...@@ -26,8 +26,6 @@ class EventFilter
# rubocop: disable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord
def apply_filter(events) def apply_filter(events)
events = apply_feature_flags(events)
case filter case filter
when PUSH when PUSH
events.pushed_action events.pushed_action
...@@ -51,29 +49,17 @@ class EventFilter ...@@ -51,29 +49,17 @@ class EventFilter
private private
def apply_feature_flags(events)
events = events.not_design unless can_view_design_activity?
events
end
def wiki_events(events) def wiki_events(events)
events.for_wiki_page events.for_wiki_page
end end
def design_events(events) def design_events(events)
return events.for_design if can_view_design_activity? events.for_design
events
end end
def filters def filters
[ALL, PUSH, MERGED, ISSUE, COMMENTS, TEAM, WIKI, DESIGNS] [ALL, PUSH, MERGED, ISSUE, COMMENTS, TEAM, WIKI, DESIGNS]
end end
def can_view_design_activity?
Feature.enabled?(:design_activity_events)
end
end end
EventFilter.prepend_if_ee('EE::EventFilter') EventFilter.prepend_if_ee('EE::EventFilter')
...@@ -55,20 +55,6 @@ RSpec.describe DashboardController do ...@@ -55,20 +55,6 @@ RSpec.describe DashboardController do
expect(json_response['count']).to eq(6) expect(json_response['count']).to eq(6)
end end
describe 'design_activity_events feature flag' do
context 'it is off' do
before do
stub_feature_flags(design_activity_events: false)
end
it 'excludes design activity' do
get :activity, params: { format: :json }
expect(json_response['count']).to eq(4)
end
end
end
end end
context 'when user has no permission to see the event' do context 'when user has no permission to see the event' do
......
...@@ -1164,18 +1164,6 @@ RSpec.describe GroupsController do ...@@ -1164,18 +1164,6 @@ RSpec.describe GroupsController do
expect(json_response['count']).to eq(3) expect(json_response['count']).to eq(3)
end end
context 'the design_activity_events feature flag is disabled' do
before do
stub_feature_flags(design_activity_events: false)
end
it 'does not include the design activity' do
get_activity
expect(json_response['count']).to eq(1)
end
end
end end
describe 'GET #issues' do describe 'GET #issues' do
......
...@@ -130,18 +130,6 @@ RSpec.describe ProjectsController do ...@@ -130,18 +130,6 @@ RSpec.describe ProjectsController do
expect(json_response['count']).to eq(1) expect(json_response['count']).to eq(1)
end end
context 'the feature flag is disabled' do
before do
stub_feature_flags(design_activity_events: false)
end
it 'returns correct count' do
get_activity(project)
expect(json_response['count']).to eq(0)
end
end
end end
end end
......
...@@ -37,28 +37,15 @@ RSpec.describe UserRecentEventsFinder do ...@@ -37,28 +37,15 @@ RSpec.describe UserRecentEventsFinder do
expect(finder.execute).to be_empty expect(finder.execute).to be_empty
end end
describe 'design_activity_events feature flag' do describe 'design activity events' do
let_it_be(:event_a) { create(:design_event, author: project_owner) } let_it_be(:event_a) { create(:design_event, author: project_owner) }
let_it_be(:event_b) { create(:design_event, author: project_owner) } let_it_be(:event_b) { create(:design_event, author: project_owner) }
context 'the design_activity_events feature-flag is enabled' do it 'only includes design events', :aggregate_failures do
it 'only includes design events in enabled projects', :aggregate_failures do events = finder.execute
events = finder.execute
expect(events).to include(event_a) expect(events).to include(event_a)
expect(events).to include(event_b) expect(events).to include(event_b)
end
end
context 'the design_activity_events feature-flag is disabled' do
it 'excludes design events', :aggregate_failures do
stub_feature_flags(design_activity_events: false)
events = finder.execute
expect(events).not_to include(event_a)
expect(events).not_to include(event_b)
end
end end
end end
end end
......
...@@ -255,14 +255,6 @@ RSpec.describe EventsHelper do ...@@ -255,14 +255,6 @@ RSpec.describe EventsHelper do
it { is_expected.to be(true) } it { is_expected.to be(true) }
end end
context 'the feature flag is off' do
before do
stub_feature_flags(design_activity_events: false)
end
it { is_expected.to be(false) }
end
context 'a project has been assigned' do context 'a project has been assigned' do
before do before do
assign(:project, project) assign(:project, project)
...@@ -277,14 +269,6 @@ RSpec.describe EventsHelper do ...@@ -277,14 +269,6 @@ RSpec.describe EventsHelper do
it { is_expected.to be(false) } it { is_expected.to be(false) }
end end
context 'the feature flag is off' do
before do
stub_feature_flags(design_activity_events: false)
end
it { is_expected.to be(false) }
end
end end
context 'projects have been assigned' do context 'projects have been assigned' do
...@@ -309,14 +293,6 @@ RSpec.describe EventsHelper do ...@@ -309,14 +293,6 @@ RSpec.describe EventsHelper do
it { is_expected.to be(false) } it { is_expected.to be(false) }
end end
context 'the feature flag is off' do
before do
stub_feature_flags(design_activity_events: false)
end
it { is_expected.to be(false) }
end
end end
context 'a group has been assigned' do context 'a group has been assigned' do
...@@ -344,14 +320,6 @@ RSpec.describe EventsHelper do ...@@ -344,14 +320,6 @@ RSpec.describe EventsHelper do
it { is_expected.to be(false) } it { is_expected.to be(false) }
end end
context 'the feature flag is off' do
before do
stub_feature_flags(design_activity_events: false)
end
it { is_expected.to be(false) }
end
end end
end end
end end
......
...@@ -88,16 +88,6 @@ RSpec.describe EventFilter do ...@@ -88,16 +88,6 @@ RSpec.describe EventFilter do
it 'returns only design events' do it 'returns only design events' do
expect(filtered_events).to contain_exactly(design_event) expect(filtered_events).to contain_exactly(design_event)
end end
context 'the :design_activity_events feature is disabled' do
before do
stub_feature_flags(design_activity_events: false)
end
it 'does not return design events' do
expect(filtered_events).to match_array(Event.not_design)
end
end
end end
context 'with the "wiki" filter' do context 'with the "wiki" filter' do
......
...@@ -50,24 +50,6 @@ RSpec.describe EventCollection do ...@@ -50,24 +50,6 @@ RSpec.describe EventCollection do
expect(events).to include(wiki_page_event) expect(events).to include(wiki_page_event)
end end
context 'the design_activity_events feature flag is disabled' do
before do
stub_feature_flags(design_activity_events: false)
end
it 'omits the design events when using to_a' do
events = described_class.new(projects).to_a
expect(events).not_to include(design_event)
end
it 'omits the wiki page events when using all_project_events' do
events = described_class.new(projects).all_project_events
expect(events).not_to include(design_event)
end
end
it 'includes the design events' do it 'includes the design events' do
collection = described_class.new(projects) collection = described_class.new(projects)
......
...@@ -643,15 +643,6 @@ RSpec.describe Event do ...@@ -643,15 +643,6 @@ RSpec.describe Event do
end end
end end
describe '.not_design' do
it 'does not contain the design events' do
non_design_events = events.reject(&:design?)
expect(events).not_to match_array(non_design_events)
expect(described_class.not_design).to match_array(non_design_events)
end
end
describe '.for_wiki_page' do describe '.for_wiki_page' do
it 'only contains the wiki page events' do it 'only contains the wiki page events' do
wiki_events = events.select(&:wiki_page?) wiki_events = events.select(&:wiki_page?)
......
...@@ -290,18 +290,6 @@ RSpec.describe EventCreateService do ...@@ -290,18 +290,6 @@ RSpec.describe EventCreateService do
let_it_be(:design) { create(:design, project: project) } let_it_be(:design) { create(:design, project: project) }
let_it_be(:author) { user } let_it_be(:author) { user }
shared_examples 'feature flag gated multiple event creation' do
context 'the feature flag is off' do
before do
stub_feature_flags(design_activity_events: false)
end
specify { expect(result).to be_empty }
specify { expect { result }.not_to change { Event.count } }
specify { expect { result }.not_to exceed_query_limit(0) }
end
end
describe '#save_designs' do describe '#save_designs' do
let_it_be(:updated) { create_list(:design, 5) } let_it_be(:updated) { create_list(:design, 5) }
let_it_be(:created) { create_list(:design, 3) } let_it_be(:created) { create_list(:design, 3) }
...@@ -326,8 +314,6 @@ RSpec.describe EventCreateService do ...@@ -326,8 +314,6 @@ RSpec.describe EventCreateService do
expect(events.map(&:design)).to match_array(updated) expect(events.map(&:design)).to match_array(updated)
end end
it_behaves_like 'feature flag gated multiple event creation'
it 'records the event in the event counter' do it 'records the event in the event counter' do
stub_feature_flags(Gitlab::UsageDataCounters::TrackUniqueActions::FEATURE_FLAG => true) stub_feature_flags(Gitlab::UsageDataCounters::TrackUniqueActions::FEATURE_FLAG => true)
counter_class = Gitlab::UsageDataCounters::TrackUniqueActions counter_class = Gitlab::UsageDataCounters::TrackUniqueActions
...@@ -356,8 +342,6 @@ RSpec.describe EventCreateService do ...@@ -356,8 +342,6 @@ RSpec.describe EventCreateService do
expect(events.map(&:design)).to match_array(designs) expect(events.map(&:design)).to match_array(designs)
end end
it_behaves_like 'feature flag gated multiple event creation'
it 'records the event in the event counter' do it 'records the event in the event counter' do
stub_feature_flags(Gitlab::UsageDataCounters::TrackUniqueActions::FEATURE_FLAG => true) stub_feature_flags(Gitlab::UsageDataCounters::TrackUniqueActions::FEATURE_FLAG => true)
counter_class = Gitlab::UsageDataCounters::TrackUniqueActions counter_class = Gitlab::UsageDataCounters::TrackUniqueActions
......
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