diff --git a/.gitlab/ci/dev-fixtures.gitlab-ci.yml b/.gitlab/ci/dev-fixtures.gitlab-ci.yml index 4141cc7f071..c19dce7e4a9 100644 --- a/.gitlab/ci/dev-fixtures.gitlab-ci.yml +++ b/.gitlab/ci/dev-fixtures.gitlab-ci.yml @@ -8,9 +8,9 @@ needs: ["setup-test-env"] variables: FIXTURE_PATH: "db/fixtures/development" - SEED_CYCLE_ANALYTICS: "true" + SEED_VSA: "true" SEED_PRODUCTIVITY_ANALYTICS: "true" - CYCLE_ANALYTICS_ISSUE_COUNT: 1 + VSA_ISSUE_COUNT: 1 SIZE: 0 # number of external projects to fork, requires network connection # SEED_NESTED_GROUPS: "false" # requires network connection diff --git a/app/mailers/emails/service_desk.rb b/app/mailers/emails/service_desk.rb index fa646487819..4dceff5b7ba 100644 --- a/app/mailers/emails/service_desk.rb +++ b/app/mailers/emails/service_desk.rb @@ -47,7 +47,7 @@ module Emails def service_desk_options(email_sender, email_type) { from: email_sender, - to: @issue.service_desk_reply_to + to: @issue.external_author }.tap do |options| next unless template_body = template_content(email_type) diff --git a/app/models/issue.rb b/app/models/issue.rb index 14eed4bd607..d6dba8bb9e5 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -90,6 +90,8 @@ class Issue < ApplicationRecord alias_attribute :parent_ids, :project_id alias_method :issuing_parent, :project + alias_attribute :external_author, :service_desk_reply_to + scope :in_projects, ->(project_ids) { where(project_id: project_ids) } scope :not_in_projects, ->(project_ids) { where.not(project_id: project_ids) } diff --git a/app/services/notification_service.rb b/app/services/notification_service.rb index 85113d3ca22..b45923a5742 100644 --- a/app/services/notification_service.rb +++ b/app/services/notification_service.rb @@ -353,7 +353,7 @@ class NotificationService issue = note.noteable support_bot = User.support_bot - return unless issue.service_desk_reply_to.present? + return unless issue.external_author.present? return unless issue.project.service_desk_enabled? return if note.author == support_bot return unless issue.subscribed?(support_bot, issue.project) diff --git a/changelogs/unreleased/225281-add-external_author-alias-for-service_desk_reply_to.yml b/changelogs/unreleased/225281-add-external_author-alias-for-service_desk_reply_to.yml new file mode 100644 index 00000000000..87bdb16be30 --- /dev/null +++ b/changelogs/unreleased/225281-add-external_author-alias-for-service_desk_reply_to.yml @@ -0,0 +1,5 @@ +--- +title: Add `external_author` alias to `service_desk_reply_to` +merge_request: 48363 +author: Lee Tickett +type: other diff --git a/changelogs/unreleased/288823-rename-cycle_analytics_-variable-for-ci-with-vsa_.yml b/changelogs/unreleased/288823-rename-cycle_analytics_-variable-for-ci-with-vsa_.yml new file mode 100644 index 00000000000..b4732f6e84c --- /dev/null +++ b/changelogs/unreleased/288823-rename-cycle_analytics_-variable-for-ci-with-vsa_.yml @@ -0,0 +1,5 @@ +--- +title: Rename "CYCLE_ANALYTICS_*" variables for CI with "VSA_*" +merge_request: 48675 +author: Takuya Noguchi +type: other diff --git a/db/fixtures/development/17_cycle_analytics.rb b/db/fixtures/development/17_cycle_analytics.rb index 57993061c58..826e703a443 100644 --- a/db/fixtures/development/17_cycle_analytics.rb +++ b/db/fixtures/development/17_cycle_analytics.rb @@ -7,21 +7,21 @@ require './spec/support/helpers/test_env' # # Simple invocation always creates a new project: # -# FILTER=cycle_analytics SEED_CYCLE_ANALYTICS=1 bundle exec rake db:seed_fu +# FILTER=cycle_analytics SEED_VSA=1 bundle exec rake db:seed_fu # # Create more issues/MRs: # -# CYCLE_ANALYTICS_ISSUE_COUNT=100 FILTER=cycle_analytics SEED_CYCLE_ANALYTICS=1 bundle exec rake db:seed_fu +# VSA_ISSUE_COUNT=100 FILTER=cycle_analytics SEED_VSA=1 bundle exec rake db:seed_fu # # Run for an existing project # -# CYCLE_ANALYTICS_SEED_PROJECT_ID=10 FILTER=cycle_analytics SEED_CYCLE_ANALYTICS=1 bundle exec rake db:seed_fu +# VSA_SEED_PROJECT_ID=10 FILTER=cycle_analytics SEED_VSA=1 bundle exec rake db:seed_fu class Gitlab::Seeder::CycleAnalytics attr_reader :project, :issues, :merge_requests, :developers - FLAG = 'SEED_CYCLE_ANALYTICS' - PERF_TEST = 'CYCLE_ANALYTICS_PERF_TEST' + FLAG = 'SEED_VSA' + PERF_TEST = 'VSA_PERF_TEST' ISSUE_STAGE_MAX_DURATION_IN_HOURS = 72 PLAN_STAGE_MAX_DURATION_IN_HOURS = 48 @@ -40,7 +40,7 @@ class Gitlab::Seeder::CycleAnalytics def initialize(project: nil, perf: false) @project = project || create_new_vsm_project - @issue_count = perf ? 1000 : ENV.fetch('CYCLE_ANALYTICS_ISSUE_COUNT', 5).to_i + @issue_count = perf ? 1000 : ENV.fetch('VSA_ISSUE_COUNT', 5).to_i @issues = [] @merge_requests = [] @developers = [] @@ -195,7 +195,7 @@ class Gitlab::Seeder::CycleAnalytics end Gitlab::Seeder.quiet do - project_id = ENV['CYCLE_ANALYTICS_SEED_PROJECT_ID'] + project_id = ENV['VSA_SEED_PROJECT_ID'] project = Project.find(project_id) if project_id seeder = Gitlab::Seeder::CycleAnalytics.seeder_based_on_env(project) diff --git a/lib/gitlab/email/handler/service_desk_handler.rb b/lib/gitlab/email/handler/service_desk_handler.rb index bcd8b98a06f..6c229291f39 100644 --- a/lib/gitlab/email/handler/service_desk_handler.rb +++ b/lib/gitlab/email/handler/service_desk_handler.rb @@ -78,7 +78,7 @@ module Gitlab title: issue_title, description: message_including_template, confidential: true, - service_desk_reply_to: from_address + external_author: from_address ).execute raise InvalidIssueError unless @issue.persisted? diff --git a/lib/gitlab/import_export/project/import_export.yml b/lib/gitlab/import_export/project/import_export.yml index 8c094603d53..80044d239de 100644 --- a/lib/gitlab/import_export/project/import_export.yml +++ b/lib/gitlab/import_export/project/import_export.yml @@ -220,6 +220,7 @@ excluded_attributes: - :duplicated_to_id - :promoted_to_epic_id - :blocking_issues_count + - :service_desk_reply_to merge_request: - :milestone_id - :sprint_id diff --git a/spec/fixtures/lib/gitlab/import_export/designs/project.json b/spec/fixtures/lib/gitlab/import_export/designs/project.json index e11b10a1d4c..1d51a726c4c 100644 --- a/spec/fixtures/lib/gitlab/import_export/designs/project.json +++ b/spec/fixtures/lib/gitlab/import_export/designs/project.json @@ -61,7 +61,7 @@ "lock_version":0, "time_estimate":0, "relative_position":1073742323, - "service_desk_reply_to":null, + "external_author":null, "last_edited_at":null, "last_edited_by_id":null, "discussion_locked":null, @@ -244,7 +244,7 @@ "lock_version":0, "time_estimate":0, "relative_position":1073742823, - "service_desk_reply_to":null, + "external_author":null, "last_edited_at":null, "last_edited_by_id":null, "discussion_locked":null, diff --git a/spec/lib/gitlab/email/handler/service_desk_handler_spec.rb b/spec/lib/gitlab/email/handler/service_desk_handler_spec.rb index 2ebfb054a96..32b451f8329 100644 --- a/spec/lib/gitlab/email/handler/service_desk_handler_spec.rb +++ b/spec/lib/gitlab/email/handler/service_desk_handler_spec.rb @@ -254,7 +254,7 @@ RSpec.describe Gitlab::Email::Handler::ServiceDeskHandler do new_issue = Issue.last - expect(new_issue.service_desk_reply_to).to eq('finn@adventuretime.ooo') + expect(new_issue.external_author).to eq('finn@adventuretime.ooo') end end diff --git a/spec/lib/gitlab/import_export/safe_model_attributes.yml b/spec/lib/gitlab/import_export/safe_model_attributes.yml index 194e261c601..443a1ddd214 100644 --- a/spec/lib/gitlab/import_export/safe_model_attributes.yml +++ b/spec/lib/gitlab/import_export/safe_model_attributes.yml @@ -26,7 +26,7 @@ Issue: - weight - time_estimate - relative_position -- service_desk_reply_to +- external_author - last_edited_at - last_edited_by_id - discussion_locked diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb index 3cc5f202b1f..382f29e1bed 100644 --- a/spec/mailers/notify_spec.rb +++ b/spec/mailers/notify_spec.rb @@ -1284,7 +1284,7 @@ RSpec.describe Notify do context 'for service desk issues' do before do - issue.update!(service_desk_reply_to: 'service.desk@example.com') + issue.update!(external_author: 'service.desk@example.com') end def expect_sender(username) diff --git a/spec/services/notification_service_spec.rb b/spec/services/notification_service_spec.rb index f9a89c6281e..34a95c0505d 100644 --- a/spec/services/notification_service_spec.rb +++ b/spec/services/notification_service_spec.rb @@ -353,7 +353,7 @@ RSpec.describe NotificationService, :mailer do context 'a service-desk issue' do before do - issue.update!(service_desk_reply_to: 'service.desk@example.com') + issue.update!(external_author: 'service.desk@example.com') project.update!(service_desk_enabled: true) end