Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/assets/javascripts/work_items/components/work_item_milestone.vue9
-rw-r--r--app/services/projects/destroy_service.rb2
-rw-r--r--app/services/projects/unlink_fork_service.rb6
-rw-r--r--config/feature_flags/development/refresh_statistics_on_unlink_fork.yml8
-rw-r--r--qa/qa/specs/features/api/9_data_stores/user_inherited_access_spec.rb2
-rw-r--r--spec/services/projects/destroy_service_spec.rb6
-rw-r--r--spec/services/projects/unlink_fork_service_spec.rb20
7 files changed, 42 insertions, 11 deletions
diff --git a/app/assets/javascripts/work_items/components/work_item_milestone.vue b/app/assets/javascripts/work_items/components/work_item_milestone.vue
index 9c6fa158169..dbeb3d4d3ff 100644
--- a/app/assets/javascripts/work_items/components/work_item_milestone.vue
+++ b/app/assets/javascripts/work_items/components/work_item_milestone.vue
@@ -47,7 +47,7 @@ export default {
workItemMilestone: {
type: Object,
required: false,
- default: () => {},
+ default: () => ({}),
},
workItemType: {
type: String,
@@ -155,9 +155,6 @@ export default {
},
},
methods: {
- handleMilestoneClick(milestone) {
- this.localMilestone = milestone;
- },
onDropdownShown() {
this.shouldFetch = true;
},
@@ -168,9 +165,6 @@ export default {
setSearchKey(value) {
this.searchTerm = value;
},
- isMilestoneChecked(milestone) {
- return this.localMilestone?.id === milestone?.id;
- },
updateMilestone() {
this.localMilestone =
this.milestones.find(({ id }) => id === this.localMilestoneId) ?? noMilestoneItem;
@@ -234,7 +228,6 @@ export default {
v-model="localMilestoneId"
:items="dropdownGroups"
category="tertiary"
- data-testid="work-item-milestone-dropdown"
class="gl-max-w-full"
:toggle-text="dropdownText"
:loading="updateInProgress"
diff --git a/app/services/projects/destroy_service.rb b/app/services/projects/destroy_service.rb
index 8c86646ba5c..7ba5b6119b9 100644
--- a/app/services/projects/destroy_service.rb
+++ b/app/services/projects/destroy_service.rb
@@ -34,7 +34,7 @@ module Projects
::Ci::AbortPipelinesService.new.execute(project.all_pipelines, :project_deleted)
- Projects::UnlinkForkService.new(project, current_user).execute
+ Projects::UnlinkForkService.new(project, current_user).execute(refresh_statistics: false)
attempt_destroy(project)
diff --git a/app/services/projects/unlink_fork_service.rb b/app/services/projects/unlink_fork_service.rb
index 898421364db..cdd1870858e 100644
--- a/app/services/projects/unlink_fork_service.rb
+++ b/app/services/projects/unlink_fork_service.rb
@@ -3,7 +3,7 @@
module Projects
class UnlinkForkService < BaseService
# Close existing MRs coming from the project and remove it from the fork network
- def execute
+ def execute(refresh_statistics: true)
fork_network = @project.fork_network
forked_from = @project.forked_from_project
@@ -46,6 +46,10 @@ module Projects
end
# rubocop: enable Cop/InBatches
+ if Feature.enabled?(:refresh_statistics_on_unlink_fork, @project.namespace) && refresh_statistics
+ ProjectCacheWorker.perform_async(project.id, [], [:repository_size])
+ end
+
# When the project getting out of the network is a node with parent
# and children, both the parent and the node needs a cache refresh.
[forked_from, @project].compact.each do |project|
diff --git a/config/feature_flags/development/refresh_statistics_on_unlink_fork.yml b/config/feature_flags/development/refresh_statistics_on_unlink_fork.yml
new file mode 100644
index 00000000000..e4358224831
--- /dev/null
+++ b/config/feature_flags/development/refresh_statistics_on_unlink_fork.yml
@@ -0,0 +1,8 @@
+---
+name: refresh_statistics_on_unlink_fork
+introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/137197
+rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/432177
+milestone: '16.7'
+type: development
+group: group::utilization
+default_enabled: false
diff --git a/qa/qa/specs/features/api/9_data_stores/user_inherited_access_spec.rb b/qa/qa/specs/features/api/9_data_stores/user_inherited_access_spec.rb
index 7f034f62d46..d961c2b52fe 100644
--- a/qa/qa/specs/features/api/9_data_stores/user_inherited_access_spec.rb
+++ b/qa/qa/specs/features/api/9_data_stores/user_inherited_access_spec.rb
@@ -65,7 +65,7 @@ module QA
end
it(
- 'is allowed to commit to sub-group project via the API',
+ 'is allowed to commit to sub-group project via the API', :reliable,
testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/363349'
) do
# Retry is needed due to delays with project authorization updates
diff --git a/spec/services/projects/destroy_service_spec.rb b/spec/services/projects/destroy_service_spec.rb
index a0064eadf13..3aea329a45f 100644
--- a/spec/services/projects/destroy_service_spec.rb
+++ b/spec/services/projects/destroy_service_spec.rb
@@ -454,6 +454,12 @@ RSpec.describe Projects::DestroyService, :aggregate_failures, :event_store_publi
expect { destroy_project(forked_project, user) }
.not_to raise_error
end
+
+ it 'does not update project statistics for the deleted project' do
+ expect(ProjectCacheWorker).not_to receive(:perform_async)
+
+ destroy_project(forked_project, user)
+ end
end
context 'as the root of a fork network' do
diff --git a/spec/services/projects/unlink_fork_service_spec.rb b/spec/services/projects/unlink_fork_service_spec.rb
index 872e38aba1d..2e1a6c03c90 100644
--- a/spec/services/projects/unlink_fork_service_spec.rb
+++ b/spec/services/projects/unlink_fork_service_spec.rb
@@ -58,6 +58,26 @@ RSpec.describe Projects::UnlinkForkService, :use_clean_rails_memory_store_cachin
expect(source.forks_count).to be_zero
end
+ it 'refreshes the project statistics of the forked project' do
+ expect(ProjectCacheWorker).to receive(:perform_async).with(forked_project.id, [], [:repository_size])
+
+ subject.execute
+ end
+
+ it 'does not refresh project statistics when refresh_statistics is false' do
+ expect(ProjectCacheWorker).not_to receive(:perform_async)
+
+ subject.execute(refresh_statistics: false)
+ end
+
+ it 'does not refresh project statistics when the feature flag is disabled' do
+ stub_feature_flags(refresh_statistics_on_unlink_fork: false)
+
+ expect(ProjectCacheWorker).not_to receive(:perform_async)
+
+ subject.execute
+ end
+
context 'when the original project was deleted' do
it 'does not fail when the original project is deleted' do
source = forked_project.forked_from_project