From 7ad11b777ab6800474f19cd757ab31130836e570 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Fri, 14 Oct 2022 03:10:15 +0000 Subject: [PATCH] Add latest changes from gitlab-org/gitlab@master --- .../style/numeric_literal_prefix.yml | 19 ++--- .../graphql_shared/issuable_client.js | 10 ++- .../graphql/work_item.fragment.graphql | 1 - .../work_item_assignees.subscription.graphql | 16 +++- .../work_item_dates.subscription.graphql | 11 ++- app/services/work_items/update_service.rb | 8 ++ .../_shared_runners_description.html.haml | 4 - .../geo_container_repository_replication.yml | 2 +- .../counts_28d/20220222215951_xmau_plan.yml | 1 + ...20220222215952_xmau_project_management.yml | 1 + .../20220222215955_users_work_items.yml | 1 + ...sers_updating_work_item_labels_monthly.yml | 25 ++++++ .../counts_7d/20220222215851_xmau_plan.yml | 1 + ...20220222215852_xmau_project_management.yml | 1 + .../20220222215855_users_work_items.yml | 1 + ...users_updating_work_item_labels_weekly.yml | 25 ++++++ doc/development/go_guide/index.md | 19 +++++ lib/api/bulk_imports.rb | 6 ++ .../known_events/work_items.yml | 5 ++ .../work_item_activity_unique_counter.rb | 5 ++ locale/gitlab.pot | 3 - spec/features/runners_spec.rb | 10 --- .../work_item_activity_unique_counter_spec.rb | 8 ++ .../work_items/update_service_spec.rb | 78 ++++++++++++++----- workhorse/go.mod | 2 +- workhorse/go.sum | 3 +- 26 files changed, 211 insertions(+), 55 deletions(-) create mode 100644 config/metrics/counts_28d/20221007011350_users_updating_work_item_labels_monthly.yml create mode 100644 config/metrics/counts_7d/20221007010950_users_updating_work_item_labels_weekly.yml diff --git a/.rubocop_todo/style/numeric_literal_prefix.yml b/.rubocop_todo/style/numeric_literal_prefix.yml index d93437aa043..5de15180438 100644 --- a/.rubocop_todo/style/numeric_literal_prefix.yml +++ b/.rubocop_todo/style/numeric_literal_prefix.yml @@ -1,21 +1,22 @@ --- # Cop supports --auto-correct. Style/NumericLiteralPrefix: - # Offense count: 148 - # Temporarily disabled due to too many offenses - Enabled: false + Details: grace period Exclude: - 'app/models/container_repository.rb' - 'app/services/packages/debian/generate_distribution_key_service.rb' - 'config/initializers/01_secret_token.rb' - 'config/initializers/1_settings.rb' - 'db/post_migrate/20220131000001_schedule_trace_expiry_removal.rb' + - 'ee/lib/ee/gitlab/background_migration/backfill_project_statistics_container_repository_size.rb' - 'ee/lib/gitlab/geo/replication/blob_downloader.rb' - 'ee/spec/lib/bulk_imports/groups/pipelines/iterations_pipeline_spec.rb' + - 'ee/spec/lib/ee/gitlab/background_migration/backfill_project_statistics_container_repository_size_spec.rb' - 'ee/spec/lib/gitlab/background_migration/remove_all_trace_expiration_dates_spec.rb' - 'ee/spec/lib/gitlab/geo/replication/blob_downloader_spec.rb' - 'ee/spec/migrations/schedule_trace_expiry_removal_spec.rb' - 'ee/spec/models/analytics/devops_adoption/snapshot_spec.rb' + - 'ee/spec/models/ci/minutes/usage_spec.rb' - 'ee/spec/models/ee/group_spec.rb' - 'ee/spec/models/gitlab/seat_link_data_spec.rb' - 'ee/spec/services/incident_management/oncall_schedules/update_service_spec.rb' @@ -27,18 +28,17 @@ Style/NumericLiteralPrefix: - 'lib/gitlab/jwt_authenticatable.rb' - 'lib/system_check/app/uploads_path_permission_check.rb' - 'lib/system_check/app/uploads_path_tmp_permission_check.rb' + - 'lib/tasks/gitlab/backup.rake' - 'lib/tasks/tanuki_emoji.rake' - 'metrics_server/metrics_server.rb' - 'qa/qa/support/ssh.rb' - 'qa/spec/support/ssh_spec.rb' - 'scripts/security-harness' + - 'spec/finders/personal_access_tokens_finder_spec.rb' - 'spec/lib/gitlab/background_migration/remove_all_trace_expiration_dates_spec.rb' - 'spec/lib/gitlab/database/background_migration/batched_job_spec.rb' - 'spec/lib/gitlab/database/partitioning_migration_helpers/table_management_helpers_spec.rb' - - 'spec/lib/gitlab/encoding_helper_spec.rb' - 'spec/lib/gitlab/git/diff_spec.rb' - - 'spec/lib/gitlab/git/repository_spec.rb' - - 'spec/lib/gitlab/git/tree_spec.rb' - 'spec/lib/gitlab/gitaly_client/blobs_stitcher_spec.rb' - 'spec/lib/gitlab/gitaly_client/conflict_files_stitcher_spec.rb' - 'spec/lib/gitlab/gitaly_client/diff_spec.rb' @@ -65,10 +65,11 @@ Style/NumericLiteralPrefix: - 'spec/lib/gitlab/puma_logging/json_formatter_spec.rb' - 'spec/lib/gitlab/relative_positioning/range_spec.rb' - 'spec/metrics_server/metrics_server_spec.rb' + - 'spec/migrations/20220506154054_create_sync_namespace_details_trigger_spec.rb' + - 'spec/migrations/20220524184149_create_sync_project_namespace_details_trigger_spec.rb' - 'spec/models/issue_spec.rb' - - 'spec/models/repository_spec.rb' - - 'spec/support/helpers/repo_helpers.rb' - - 'spec/support/helpers/test_env.rb' + - 'spec/models/personal_access_token_spec.rb' + - 'spec/requests/api/personal_access_tokens_spec.rb' - 'spec/support/import_export/export_file_helper.rb' - 'spec/support/shared_examples/requests/api/nuget_packages_shared_examples.rb' - 'spec/support/shared_examples/services/packages/debian/generate_distribution_shared_examples.rb' diff --git a/app/assets/javascripts/graphql_shared/issuable_client.js b/app/assets/javascripts/graphql_shared/issuable_client.js index a223c7fa360..3849bd0289d 100644 --- a/app/assets/javascripts/graphql_shared/issuable_client.js +++ b/app/assets/javascripts/graphql_shared/issuable_client.js @@ -19,8 +19,14 @@ export const temporaryConfig = { WorkItem: { fields: { widgets: { - merge(_, incoming) { - return incoming; + merge(existing = [], incoming) { + if (existing.length === 0) { + return incoming; + } + return existing.map((existingWidget) => { + const incomingWidget = incoming.find((w) => w.type === existingWidget.type); + return incomingWidget || existingWidget; + }); }, }, }, diff --git a/app/assets/javascripts/work_items/graphql/work_item.fragment.graphql b/app/assets/javascripts/work_items/graphql/work_item.fragment.graphql index f4c77ed2ec0..bb05c9b2135 100644 --- a/app/assets/javascripts/work_items/graphql/work_item.fragment.graphql +++ b/app/assets/javascripts/work_items/graphql/work_item.fragment.graphql @@ -1,4 +1,3 @@ -#import "~/graphql_shared/fragments/user.fragment.graphql" #import "ee_else_ce/work_items/graphql/work_item_widgets.fragment.graphql" fragment WorkItem on WorkItem { diff --git a/app/assets/javascripts/work_items/graphql/work_item_assignees.subscription.graphql b/app/assets/javascripts/work_items/graphql/work_item_assignees.subscription.graphql index 9015469d61a..d5b2de8c4c6 100644 --- a/app/assets/javascripts/work_items/graphql/work_item_assignees.subscription.graphql +++ b/app/assets/javascripts/work_items/graphql/work_item_assignees.subscription.graphql @@ -1,9 +1,21 @@ -#import "./work_item.fragment.graphql" +#import "~/graphql_shared/fragments/user.fragment.graphql" subscription issuableAssignees($issuableId: IssuableID!) { issuableAssigneesUpdated(issuableId: $issuableId) { ... on WorkItem { - ...WorkItem + id + widgets { + ... on WorkItemWidgetAssignees { + type + allowsMultipleAssignees + canInviteMembers + assignees { + nodes { + ...User + } + } + } + } } } } diff --git a/app/assets/javascripts/work_items/graphql/work_item_dates.subscription.graphql b/app/assets/javascripts/work_items/graphql/work_item_dates.subscription.graphql index bee2458fb91..d8760f147e1 100644 --- a/app/assets/javascripts/work_items/graphql/work_item_dates.subscription.graphql +++ b/app/assets/javascripts/work_items/graphql/work_item_dates.subscription.graphql @@ -1,9 +1,14 @@ -#import "./work_item.fragment.graphql" - subscription issuableDatesUpdated($issuableId: IssuableID!) { issuableDatesUpdated(issuableId: $issuableId) { ... on WorkItem { - ...WorkItem + id + widgets { + ... on WorkItemWidgetStartAndDueDate { + type + dueDate + startDate + } + } } } } diff --git a/app/services/work_items/update_service.rb b/app/services/work_items/update_service.rb index f66639b0149..1351445f6f3 100644 --- a/app/services/work_items/update_service.rb +++ b/app/services/work_items/update_service.rb @@ -58,5 +58,13 @@ module WorkItems def payload(work_item) { work_item: work_item } end + + def handle_label_changes(issuable, old_labels) + return false unless super + + Gitlab::UsageDataCounters::WorkItemActivityUniqueCounter.track_work_item_labels_changed_action( + author: current_user + ) + end end end diff --git a/app/views/shared/runners/_shared_runners_description.html.haml b/app/views/shared/runners/_shared_runners_description.html.haml index 01b601ef986..c8ddb5d5176 100644 --- a/app/views/shared/runners/_shared_runners_description.html.haml +++ b/app/views/shared/runners/_shared_runners_description.html.haml @@ -1,5 +1,3 @@ --# "MaxBuilds" is a runner configuration keyword so it must not be translated. -- link = link_to 'MaxBuilds', 'https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-runnersmachine-section', target: '_blank', rel: 'noopener noreferrer' - shared_link_start = ''.html_safe % { url: help_page_path('ci/runners/runners_scope.md', anchor: 'shared-runners') } %h4 @@ -9,5 +7,3 @@ %p= s_('Runners|%{link_start}These runners%{link_end} are available to all groups and projects.').html_safe % { link_start: shared_link_start, link_end: ''.html_safe } - if Gitlab::CurrentSettings.shared_runners_text.present? = markdown(Gitlab::CurrentSettings.current_application_settings.shared_runners_text) - - else - %p= _('The same shared runner executes code from multiple projects, unless you configure autoscaling with %{link} set to 1 (which it is on GitLab.com).').html_safe % { link: link } diff --git a/config/feature_flags/development/geo_container_repository_replication.yml b/config/feature_flags/development/geo_container_repository_replication.yml index b849518a739..94682cc63cc 100644 --- a/config/feature_flags/development/geo_container_repository_replication.yml +++ b/config/feature_flags/development/geo_container_repository_replication.yml @@ -5,4 +5,4 @@ rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/366662 milestone: '15.5' type: development group: group::geo -default_enabled: false +default_enabled: true diff --git a/config/metrics/counts_28d/20220222215951_xmau_plan.yml b/config/metrics/counts_28d/20220222215951_xmau_plan.yml index 9498c56e06f..587f34e90c3 100644 --- a/config/metrics/counts_28d/20220222215951_xmau_plan.yml +++ b/config/metrics/counts_28d/20220222215951_xmau_plan.yml @@ -20,6 +20,7 @@ options: - users_creating_work_items - users_updating_work_item_title - users_updating_work_item_dates + - users_updating_work_item_labels data_category: optional distribution: - ce diff --git a/config/metrics/counts_28d/20220222215952_xmau_project_management.yml b/config/metrics/counts_28d/20220222215952_xmau_project_management.yml index a02616e06ce..542f8a13118 100644 --- a/config/metrics/counts_28d/20220222215952_xmau_project_management.yml +++ b/config/metrics/counts_28d/20220222215952_xmau_project_management.yml @@ -20,6 +20,7 @@ options: - users_creating_work_items - users_updating_work_item_title - users_updating_work_item_dates + - users_updating_work_item_labels data_category: optional distribution: - ce diff --git a/config/metrics/counts_28d/20220222215955_users_work_items.yml b/config/metrics/counts_28d/20220222215955_users_work_items.yml index 3e6103a6dfd..e7a95c9d335 100644 --- a/config/metrics/counts_28d/20220222215955_users_work_items.yml +++ b/config/metrics/counts_28d/20220222215955_users_work_items.yml @@ -20,6 +20,7 @@ options: - users_creating_work_items - users_updating_work_item_title - users_updating_work_item_dates + - users_updating_work_item_labels data_category: optional distribution: - ce diff --git a/config/metrics/counts_28d/20221007011350_users_updating_work_item_labels_monthly.yml b/config/metrics/counts_28d/20221007011350_users_updating_work_item_labels_monthly.yml new file mode 100644 index 00000000000..5ebb56ea936 --- /dev/null +++ b/config/metrics/counts_28d/20221007011350_users_updating_work_item_labels_monthly.yml @@ -0,0 +1,25 @@ +--- +key_path: redis_hll_counters.work_items.users_updating_work_item_labels_monthly +description: Unique users updating a work item's labels +product_category: team_planning +product_section: dev +product_stage: plan +product_group: project_management +value_type: number +status: active +milestone: '15.5' +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/100485 +time_frame: 28d +data_source: redis_hll +data_category: optional +instrumentation_class: RedisHLLMetric +options: + events: + - users_updating_work_item_labels +distribution: +- ce +- ee +tier: +- free +- premium +- ultimate diff --git a/config/metrics/counts_7d/20220222215851_xmau_plan.yml b/config/metrics/counts_7d/20220222215851_xmau_plan.yml index ebeaa6e5060..4fb302d67ac 100644 --- a/config/metrics/counts_7d/20220222215851_xmau_plan.yml +++ b/config/metrics/counts_7d/20220222215851_xmau_plan.yml @@ -20,6 +20,7 @@ options: - users_creating_work_items - users_updating_work_item_title - users_updating_work_item_dates + - users_updating_work_item_labels data_category: optional distribution: - ce diff --git a/config/metrics/counts_7d/20220222215852_xmau_project_management.yml b/config/metrics/counts_7d/20220222215852_xmau_project_management.yml index 13f35df6530..a63adfab8aa 100644 --- a/config/metrics/counts_7d/20220222215852_xmau_project_management.yml +++ b/config/metrics/counts_7d/20220222215852_xmau_project_management.yml @@ -20,6 +20,7 @@ options: - users_creating_work_items - users_updating_work_item_title - users_updating_work_item_dates + - users_updating_work_item_labels data_category: optional distribution: - ce diff --git a/config/metrics/counts_7d/20220222215855_users_work_items.yml b/config/metrics/counts_7d/20220222215855_users_work_items.yml index fec786715b7..cb312022192 100644 --- a/config/metrics/counts_7d/20220222215855_users_work_items.yml +++ b/config/metrics/counts_7d/20220222215855_users_work_items.yml @@ -20,6 +20,7 @@ options: - users_creating_work_items - users_updating_work_item_title - users_updating_work_item_dates + - users_updating_work_item_labels data_category: optional distribution: - ce diff --git a/config/metrics/counts_7d/20221007010950_users_updating_work_item_labels_weekly.yml b/config/metrics/counts_7d/20221007010950_users_updating_work_item_labels_weekly.yml new file mode 100644 index 00000000000..55e651328e6 --- /dev/null +++ b/config/metrics/counts_7d/20221007010950_users_updating_work_item_labels_weekly.yml @@ -0,0 +1,25 @@ +--- +key_path: redis_hll_counters.work_items.users_updating_work_item_labels_weekly +description: Unique users updating a work item's labels +product_category: team_planning +product_section: dev +product_stage: plan +product_group: project_management +value_type: number +status: active +milestone: '15.5' +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/100485 +time_frame: 7d +data_source: redis_hll +data_category: optional +instrumentation_class: RedisHLLMetric +options: + events: + - users_updating_work_item_labels +distribution: +- ce +- ee +tier: +- free +- premium +- ultimate diff --git a/doc/development/go_guide/index.md b/doc/development/go_guide/index.md index f45ff6b7d7e..197c7616d82 100644 --- a/doc/development/go_guide/index.md +++ b/doc/development/go_guide/index.md @@ -436,6 +436,25 @@ of the Code Review Comments page on the Go wiki for more details. Most editors/IDEs allow you to run commands before/after saving a file, you can set it up to run `goimports -local gitlab.com/gitlab-org` so that it's applied to every file when saving. +### Naming branches + +Only use the characters `a-z`, `0-9` or `-` in branch names. This restriction is due to the fact that `go get` doesn't work as expected when a branch name contains certain characters, such as a slash `/`: + +```shell +$ go get -u gitlab.com/gitlab-org/security-products/analyzers/report/v3@some-user/some-feature + +go get: gitlab.com/gitlab-org/security-products/analyzers/report/v3@some-user/some-feature: invalid version: version "some-user/some-feature" invalid: disallowed version string +``` + +If a branch name contains a slash, it forces us to refer to the commit SHA instead, which is less flexible. For example: + +```shell +$ go get -u gitlab.com/gitlab-org/security-products/analyzers/report/v3@5c9a4279fa1263755718cf069d54ba8051287954 + +go: downloading gitlab.com/gitlab-org/security-products/analyzers/report/v3 v3.15.3-0.20221012172609-5c9a4279fa12 +... +``` + ### Initializing slices If initializing a slice, provide a capacity where possible to avoid extra diff --git a/lib/api/bulk_imports.rb b/lib/api/bulk_imports.rb index 3592e1f9242..c54632919be 100644 --- a/lib/api/bulk_imports.rb +++ b/lib/api/bulk_imports.rb @@ -41,6 +41,7 @@ module API resource :bulk_imports do desc 'Start a new GitLab Migration' do detail 'This feature was introduced in GitLab 14.2.' + success Entities::BulkImport end params do requires :configuration, type: Hash, desc: 'The source GitLab instance configuration' do @@ -87,6 +88,7 @@ module API desc 'List all GitLab Migrations' do detail 'This feature was introduced in GitLab 14.1.' + success Entities::BulkImport end params do use :pagination @@ -101,6 +103,7 @@ module API desc "List all GitLab Migrations' entities" do detail 'This feature was introduced in GitLab 14.1.' + success Entities::BulkImports::Entity end params do use :pagination @@ -120,6 +123,7 @@ module API desc 'Get GitLab Migration details' do detail 'This feature was introduced in GitLab 14.1.' + success Entities::BulkImport end params do requires :import_id, type: Integer, desc: "The ID of user's GitLab Migration" @@ -130,6 +134,7 @@ module API desc "List GitLab Migration entities" do detail 'This feature was introduced in GitLab 14.1.' + success Entities::BulkImports::Entity end params do requires :import_id, type: Integer, desc: "The ID of user's GitLab Migration" @@ -143,6 +148,7 @@ module API desc 'Get GitLab Migration entity details' do detail 'This feature was introduced in GitLab 14.1.' + success Entities::BulkImports::Entity end params do requires :import_id, type: Integer, desc: "The ID of user's GitLab Migration" diff --git a/lib/gitlab/usage_data_counters/known_events/work_items.yml b/lib/gitlab/usage_data_counters/known_events/work_items.yml index 6cd7836ea94..94b7a37e67e 100644 --- a/lib/gitlab/usage_data_counters/known_events/work_items.yml +++ b/lib/gitlab/usage_data_counters/known_events/work_items.yml @@ -14,3 +14,8 @@ redis_slot: users aggregation: weekly feature_flag: track_work_items_activity +- name: users_updating_work_item_labels + category: work_items + redis_slot: users + aggregation: weekly + feature_flag: track_work_items_activity diff --git a/lib/gitlab/usage_data_counters/work_item_activity_unique_counter.rb b/lib/gitlab/usage_data_counters/work_item_activity_unique_counter.rb index 99b4c082310..a0fd04596fc 100644 --- a/lib/gitlab/usage_data_counters/work_item_activity_unique_counter.rb +++ b/lib/gitlab/usage_data_counters/work_item_activity_unique_counter.rb @@ -6,6 +6,7 @@ module Gitlab WORK_ITEM_CREATED = 'users_creating_work_items' WORK_ITEM_TITLE_CHANGED = 'users_updating_work_item_title' WORK_ITEM_DATE_CHANGED = 'users_updating_work_item_dates' + WORK_ITEM_LABELS_CHANGED = 'users_updating_work_item_labels' class << self def track_work_item_created_action(author:) @@ -20,6 +21,10 @@ module Gitlab track_unique_action(WORK_ITEM_DATE_CHANGED, author) end + def track_work_item_labels_changed_action(author:) + track_unique_action(WORK_ITEM_LABELS_CHANGED, author) + end + private def track_unique_action(action, author) diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 76df7230da6..4e4aebd22a8 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -40452,9 +40452,6 @@ msgstr "" msgid "The resource that you are attempting to access does not exist or you don't have permission to perform this action." msgstr "" -msgid "The same shared runner executes code from multiple projects, unless you configure autoscaling with %{link} set to 1 (which it is on GitLab.com)." -msgstr "" - msgid "The scan has been created." msgstr "" diff --git a/spec/features/runners_spec.rb b/spec/features/runners_spec.rb index 482f3d62f36..cee0910aef7 100644 --- a/spec/features/runners_spec.rb +++ b/spec/features/runners_spec.rb @@ -160,16 +160,6 @@ RSpec.describe 'Runners' do end context 'shared runner text' do - context 'when application settings have no shared_runners_text' do - it 'user sees default shared runners description' do - visit project_runners_path(project) - - page.within("[data-testid='shared-runners-description']") do - expect(page).to have_content('The same shared runner executes code from multiple projects') - end - end - end - context 'when application settings have shared_runners_text' do let(:shared_runners_text) { 'custom **shared** runners description' } let(:shared_runners_html) { 'custom shared runners description' } diff --git a/spec/lib/gitlab/usage_data_counters/work_item_activity_unique_counter_spec.rb b/spec/lib/gitlab/usage_data_counters/work_item_activity_unique_counter_spec.rb index 0bcdbe82a7a..2d251017c87 100644 --- a/spec/lib/gitlab/usage_data_counters/work_item_activity_unique_counter_spec.rb +++ b/spec/lib/gitlab/usage_data_counters/work_item_activity_unique_counter_spec.rb @@ -28,4 +28,12 @@ RSpec.describe Gitlab::UsageDataCounters::WorkItemActivityUniqueCounter, :clean_ it_behaves_like 'work item unique counter' end + + describe '.track_work_item_labels_changed_action' do + subject(:track_event) { described_class.track_work_item_labels_changed_action(author: user) } + + let(:event_name) { described_class::WORK_ITEM_LABELS_CHANGED } + + it_behaves_like 'work item unique counter' + end end diff --git a/spec/services/work_items/update_service_spec.rb b/spec/services/work_items/update_service_spec.rb index 92b304a4984..1761d1104dd 100644 --- a/spec/services/work_items/update_service_spec.rb +++ b/spec/services/work_items/update_service_spec.rb @@ -108,24 +108,6 @@ RSpec.describe WorkItems::UpdateService do end end - context 'when labels are updated' do - let_it_be(:label_a) { create(:label, project: project) } - let_it_be(:label_b) { create(:label, project: project) } - let(:issuable) { work_item } - - it_behaves_like 'broadcasting issuable labels updates' do - def update_issuable(update_params) - described_class.new( - project: project, - current_user: current_user, - params: update_params, - spam_params: spam_params, - widget_params: widget_params - ).execute(work_item) - end - end - end - context 'when updating state_event' do context 'when state_event is close' do let(:opts) { { state_event: 'close' } } @@ -330,5 +312,65 @@ RSpec.describe WorkItems::UpdateService do end end end + + describe 'label updates' do + let_it_be(:label1) { create(:label, project: project) } + let_it_be(:label2) { create(:label, project: project) } + + context 'when labels are changed' do + let(:label) { create(:label, project: project) } + let(:opts) { { label_ids: [label1.id] } } + + it 'tracks users updating work item labels' do + expect(Gitlab::UsageDataCounters::WorkItemActivityUniqueCounter).to receive(:track_work_item_labels_changed_action).with(author: current_user) + + update_work_item + end + + it_behaves_like 'broadcasting issuable labels updates' do + let(:issuable) { work_item } + let(:label_a) { label1 } + let(:label_b) { label2 } + + def update_issuable(update_params) + described_class.new( + project: project, + current_user: current_user, + params: update_params, + spam_params: spam_params, + widget_params: widget_params + ).execute(work_item) + end + end + end + + context 'when labels are not changed' do + shared_examples 'work item update that does not track label updates' do + it 'does not track users updating work item labels' do + expect(Gitlab::UsageDataCounters::WorkItemActivityUniqueCounter).not_to receive(:track_work_item_labels_changed_action) + + update_work_item + end + end + + context 'when labels param is not provided' do + let(:opts) { { title: 'not updating labels' } } + + it_behaves_like 'work item update that does not track label updates' + end + + context 'when labels param is provided but labels remain unchanged' do + let(:opts) { { label_ids: [] } } + + it_behaves_like 'work item update that does not track label updates' + end + + context 'when labels param is provided invalid values' do + let(:opts) { { label_ids: [non_existing_record_id] } } + + it_behaves_like 'work item update that does not track label updates' + end + end + end end end diff --git a/workhorse/go.mod b/workhorse/go.mod index 15f1360f8a1..d2d5e4b44f9 100644 --- a/workhorse/go.mod +++ b/workhorse/go.mod @@ -34,7 +34,7 @@ require ( golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 golang.org/x/net v0.0.0-20220722155237-a158d28d115b golang.org/x/tools v0.1.12 - google.golang.org/grpc v1.49.0 + google.golang.org/grpc v1.50.0 google.golang.org/protobuf v1.28.1 honnef.co/go/tools v0.3.3 ) diff --git a/workhorse/go.sum b/workhorse/go.sum index 52b63ebecb1..3795e8aae7a 100644 --- a/workhorse/go.sum +++ b/workhorse/go.sum @@ -1549,8 +1549,9 @@ google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9K google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= -google.golang.org/grpc v1.49.0 h1:WTLtQzmQori5FUH25Pq4WT22oCsv8USpQ+F6rqtsmxw= google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= +google.golang.org/grpc v1.50.0 h1:fPVVDxY9w++VjTZsYvXWqEf9Rqar/e+9zYfxKK+W+YU= +google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=