Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2020-11-28 00:09:43 +00:00
parent bb6a90e97e
commit b92f8e2dd4
14 changed files with 31 additions and 18 deletions

View file

@ -8,9 +8,9 @@
needs: ["setup-test-env"] needs: ["setup-test-env"]
variables: variables:
FIXTURE_PATH: "db/fixtures/development" FIXTURE_PATH: "db/fixtures/development"
SEED_CYCLE_ANALYTICS: "true" SEED_VSA: "true"
SEED_PRODUCTIVITY_ANALYTICS: "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 SIZE: 0 # number of external projects to fork, requires network connection
# SEED_NESTED_GROUPS: "false" # requires network connection # SEED_NESTED_GROUPS: "false" # requires network connection

View file

@ -47,7 +47,7 @@ module Emails
def service_desk_options(email_sender, email_type) def service_desk_options(email_sender, email_type)
{ {
from: email_sender, from: email_sender,
to: @issue.service_desk_reply_to to: @issue.external_author
}.tap do |options| }.tap do |options|
next unless template_body = template_content(email_type) next unless template_body = template_content(email_type)

View file

@ -90,6 +90,8 @@ class Issue < ApplicationRecord
alias_attribute :parent_ids, :project_id alias_attribute :parent_ids, :project_id
alias_method :issuing_parent, :project alias_method :issuing_parent, :project
alias_attribute :external_author, :service_desk_reply_to
scope :in_projects, ->(project_ids) { where(project_id: project_ids) } scope :in_projects, ->(project_ids) { where(project_id: project_ids) }
scope :not_in_projects, ->(project_ids) { where.not(project_id: project_ids) } scope :not_in_projects, ->(project_ids) { where.not(project_id: project_ids) }

View file

@ -353,7 +353,7 @@ class NotificationService
issue = note.noteable issue = note.noteable
support_bot = User.support_bot 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 unless issue.project.service_desk_enabled?
return if note.author == support_bot return if note.author == support_bot
return unless issue.subscribed?(support_bot, issue.project) return unless issue.subscribed?(support_bot, issue.project)

View file

@ -0,0 +1,5 @@
---
title: Add `external_author` alias to `service_desk_reply_to`
merge_request: 48363
author: Lee Tickett
type: other

View file

@ -0,0 +1,5 @@
---
title: Rename "CYCLE_ANALYTICS_*" variables for CI with "VSA_*"
merge_request: 48675
author: Takuya Noguchi
type: other

View file

@ -7,21 +7,21 @@ require './spec/support/helpers/test_env'
# #
# Simple invocation always creates a new project: # 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: # 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 # 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 class Gitlab::Seeder::CycleAnalytics
attr_reader :project, :issues, :merge_requests, :developers attr_reader :project, :issues, :merge_requests, :developers
FLAG = 'SEED_CYCLE_ANALYTICS' FLAG = 'SEED_VSA'
PERF_TEST = 'CYCLE_ANALYTICS_PERF_TEST' PERF_TEST = 'VSA_PERF_TEST'
ISSUE_STAGE_MAX_DURATION_IN_HOURS = 72 ISSUE_STAGE_MAX_DURATION_IN_HOURS = 72
PLAN_STAGE_MAX_DURATION_IN_HOURS = 48 PLAN_STAGE_MAX_DURATION_IN_HOURS = 48
@ -40,7 +40,7 @@ class Gitlab::Seeder::CycleAnalytics
def initialize(project: nil, perf: false) def initialize(project: nil, perf: false)
@project = project || create_new_vsm_project @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 = [] @issues = []
@merge_requests = [] @merge_requests = []
@developers = [] @developers = []
@ -195,7 +195,7 @@ class Gitlab::Seeder::CycleAnalytics
end end
Gitlab::Seeder.quiet do 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 project = Project.find(project_id) if project_id
seeder = Gitlab::Seeder::CycleAnalytics.seeder_based_on_env(project) seeder = Gitlab::Seeder::CycleAnalytics.seeder_based_on_env(project)

View file

@ -78,7 +78,7 @@ module Gitlab
title: issue_title, title: issue_title,
description: message_including_template, description: message_including_template,
confidential: true, confidential: true,
service_desk_reply_to: from_address external_author: from_address
).execute ).execute
raise InvalidIssueError unless @issue.persisted? raise InvalidIssueError unless @issue.persisted?

View file

@ -220,6 +220,7 @@ excluded_attributes:
- :duplicated_to_id - :duplicated_to_id
- :promoted_to_epic_id - :promoted_to_epic_id
- :blocking_issues_count - :blocking_issues_count
- :service_desk_reply_to
merge_request: merge_request:
- :milestone_id - :milestone_id
- :sprint_id - :sprint_id

View file

@ -61,7 +61,7 @@
"lock_version":0, "lock_version":0,
"time_estimate":0, "time_estimate":0,
"relative_position":1073742323, "relative_position":1073742323,
"service_desk_reply_to":null, "external_author":null,
"last_edited_at":null, "last_edited_at":null,
"last_edited_by_id":null, "last_edited_by_id":null,
"discussion_locked":null, "discussion_locked":null,
@ -244,7 +244,7 @@
"lock_version":0, "lock_version":0,
"time_estimate":0, "time_estimate":0,
"relative_position":1073742823, "relative_position":1073742823,
"service_desk_reply_to":null, "external_author":null,
"last_edited_at":null, "last_edited_at":null,
"last_edited_by_id":null, "last_edited_by_id":null,
"discussion_locked":null, "discussion_locked":null,

View file

@ -254,7 +254,7 @@ RSpec.describe Gitlab::Email::Handler::ServiceDeskHandler do
new_issue = Issue.last 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
end end

View file

@ -26,7 +26,7 @@ Issue:
- weight - weight
- time_estimate - time_estimate
- relative_position - relative_position
- service_desk_reply_to - external_author
- last_edited_at - last_edited_at
- last_edited_by_id - last_edited_by_id
- discussion_locked - discussion_locked

View file

@ -1284,7 +1284,7 @@ RSpec.describe Notify do
context 'for service desk issues' do context 'for service desk issues' do
before do before do
issue.update!(service_desk_reply_to: 'service.desk@example.com') issue.update!(external_author: 'service.desk@example.com')
end end
def expect_sender(username) def expect_sender(username)

View file

@ -353,7 +353,7 @@ RSpec.describe NotificationService, :mailer do
context 'a service-desk issue' do context 'a service-desk issue' do
before 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) project.update!(service_desk_enabled: true)
end end