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
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/graphql/resolvers/labels_resolver.rb2
-rw-r--r--app/graphql/resolvers/merge_requests_resolver.rb2
-rw-r--r--app/graphql/resolvers/milestones_resolver.rb6
-rw-r--r--app/graphql/resolvers/package_details_resolver.rb2
-rw-r--r--app/graphql/resolvers/paginated_tree_resolver.rb4
-rw-r--r--app/graphql/resolvers/release_resolver.rb2
-rw-r--r--app/graphql/resolvers/repository_branch_names_resolver.rb6
-rw-r--r--app/graphql/resolvers/snippets_resolver.rb6
-rw-r--r--app/graphql/resolvers/todo_resolver.rb12
-rw-r--r--app/graphql/resolvers/tree_resolver.rb4
-rw-r--r--app/graphql/resolvers/users/snippets_resolver.rb2
-rw-r--r--app/graphql/types/admin/analytics/usage_trends/measurement_type.rb4
-rw-r--r--app/graphql/types/admin/sidekiq_queues/delete_jobs_response_type.rb4
-rw-r--r--app/graphql/types/alert_management/alert_type.rb4
-rw-r--r--app/graphql/types/award_emojis/award_emoji_type.rb12
-rw-r--r--app/graphql/types/ci/config/job_restriction_type.rb2
-rw-r--r--app/graphql/types/ci/config/status_enum.rb4
-rw-r--r--app/graphql/types/ci/pipeline_type.rb2
-rw-r--r--app/graphql/types/ci_configuration/sast/ui_component_size_enum.rb6
-rw-r--r--app/graphql/types/commit_action_type.rb2
-rw-r--r--app/graphql/types/container_repository_cleanup_status_enum.rb8
-rw-r--r--app/graphql/types/container_repository_tag_type.rb2
-rw-r--r--app/graphql/types/container_repository_type.rb2
-rw-r--r--app/graphql/types/custom_emoji_type.rb6
-rw-r--r--app/helpers/system_note_helper.rb3
-rw-r--r--app/models/issue.rb3
-rw-r--r--app/models/issue/metrics.rb33
-rw-r--r--app/services/issues/update_service.rb11
-rw-r--r--app/services/system_note_service.rb4
-rw-r--r--app/services/system_notes/issuables_service.rb6
-rw-r--r--app/views/layouts/nav/sidebar/_group_menus.html.haml2
-rw-r--r--app/workers/gitlab/github_import/stage/import_issues_and_diff_notes_worker.rb28
-rw-r--r--app/workers/gitlab/github_import/stage/import_notes_worker.rb24
33 files changed, 145 insertions, 75 deletions
diff --git a/app/graphql/resolvers/labels_resolver.rb b/app/graphql/resolvers/labels_resolver.rb
index 505d1dff8d2..f0e099e8fb2 100644
--- a/app/graphql/resolvers/labels_resolver.rb
+++ b/app/graphql/resolvers/labels_resolver.rb
@@ -10,7 +10,7 @@ module Resolvers
argument :search_term, GraphQL::Types::String,
required: false,
- description: 'A search term to find labels with.'
+ description: 'Search term to find labels with.'
argument :include_ancestor_groups, GraphQL::Types::Boolean,
required: false,
diff --git a/app/graphql/resolvers/merge_requests_resolver.rb b/app/graphql/resolvers/merge_requests_resolver.rb
index 8f2c7847a2e..c0dd61078c6 100644
--- a/app/graphql/resolvers/merge_requests_resolver.rb
+++ b/app/graphql/resolvers/merge_requests_resolver.rb
@@ -49,7 +49,7 @@ module Resolvers
argument :state, ::Types::MergeRequestStateEnum,
required: false,
- description: 'A merge request state. If provided, all resolved merge requests will have this state.'
+ description: 'Merge request state. If provided, all resolved merge requests will have this state.'
argument :labels, [GraphQL::Types::String],
required: false,
diff --git a/app/graphql/resolvers/milestones_resolver.rb b/app/graphql/resolvers/milestones_resolver.rb
index 84f7d66ec19..dc6d781f584 100644
--- a/app/graphql/resolvers/milestones_resolver.rb
+++ b/app/graphql/resolvers/milestones_resolver.rb
@@ -15,15 +15,15 @@ module Resolvers
argument :title, GraphQL::Types::String,
required: false,
- description: 'The title of the milestone.'
+ description: 'Title of the milestone.'
argument :search_title, GraphQL::Types::String,
required: false,
- description: 'A search string for the title.'
+ description: 'Search string for the title.'
argument :containing_date, Types::TimeType,
required: false,
- description: 'A date that the milestone contains.'
+ description: 'Date the milestone contains.'
argument :sort, Types::MilestoneSortEnum,
description: 'Sort milestones by this criteria.',
diff --git a/app/graphql/resolvers/package_details_resolver.rb b/app/graphql/resolvers/package_details_resolver.rb
index 89d79747732..42cb23e701d 100644
--- a/app/graphql/resolvers/package_details_resolver.rb
+++ b/app/graphql/resolvers/package_details_resolver.rb
@@ -6,7 +6,7 @@ module Resolvers
argument :id, ::Types::GlobalIDType[::Packages::Package],
required: true,
- description: 'The global ID of the package.'
+ description: 'Global ID of the package.'
def ready?(**args)
context[self.class] ||= { executions: 0 }
diff --git a/app/graphql/resolvers/paginated_tree_resolver.rb b/app/graphql/resolvers/paginated_tree_resolver.rb
index d1b4e75169c..6c0545d26de 100644
--- a/app/graphql/resolvers/paginated_tree_resolver.rb
+++ b/app/graphql/resolvers/paginated_tree_resolver.rb
@@ -10,11 +10,11 @@ module Resolvers
argument :path, GraphQL::Types::String,
required: false,
default_value: '', # root of the repository
- description: 'The path to get the tree for. Default value is the root of the repository.'
+ description: 'Path to get the tree for. Default value is the root of the repository.'
argument :ref, GraphQL::Types::String,
required: false,
default_value: :head,
- description: 'The commit ref to get the tree for. Default value is HEAD.'
+ description: 'Commit ref to get the tree for. Default value is HEAD.'
argument :recursive, GraphQL::Types::Boolean,
required: false,
default_value: false,
diff --git a/app/graphql/resolvers/release_resolver.rb b/app/graphql/resolvers/release_resolver.rb
index 0374a1103de..82b5647615e 100644
--- a/app/graphql/resolvers/release_resolver.rb
+++ b/app/graphql/resolvers/release_resolver.rb
@@ -6,7 +6,7 @@ module Resolvers
argument :tag_name, GraphQL::Types::String,
required: true,
- description: 'The name of the tag associated to the release.'
+ description: 'Name of the tag associated to the release.'
alias_method :project, :object
diff --git a/app/graphql/resolvers/repository_branch_names_resolver.rb b/app/graphql/resolvers/repository_branch_names_resolver.rb
index e9aacda2652..96550bce32f 100644
--- a/app/graphql/resolvers/repository_branch_names_resolver.rb
+++ b/app/graphql/resolvers/repository_branch_names_resolver.rb
@@ -8,15 +8,15 @@ module Resolvers
argument :search_pattern, GraphQL::Types::String,
required: true,
- description: 'The pattern to search for branch names by.'
+ description: 'Pattern to search for branch names by.'
argument :offset, GraphQL::Types::Int,
required: true,
- description: 'The number of branch names to skip.'
+ description: 'Number of branch names to skip.'
argument :limit, GraphQL::Types::Int,
required: true,
- description: 'The number of branch names to return.'
+ description: 'Number of branch names to return.'
def resolve(search_pattern:, offset:, limit:)
Repositories::BranchNamesFinder.new(object, offset: offset, limit: limit, search: search_pattern).execute
diff --git a/app/graphql/resolvers/snippets_resolver.rb b/app/graphql/resolvers/snippets_resolver.rb
index 7d18c9c6fea..149bd8fa1ce 100644
--- a/app/graphql/resolvers/snippets_resolver.rb
+++ b/app/graphql/resolvers/snippets_resolver.rb
@@ -12,15 +12,15 @@ module Resolvers
argument :author_id, ::Types::GlobalIDType[::User],
required: false,
- description: 'The ID of an author.'
+ description: 'ID of an author.'
argument :project_id, ::Types::GlobalIDType[::Project],
required: false,
- description: 'The ID of a project.'
+ description: 'ID of a project.'
argument :type, Types::Snippets::TypeEnum,
required: false,
- description: 'The type of snippet.'
+ description: 'Type of snippet.'
argument :explore,
GraphQL::Types::Boolean,
diff --git a/app/graphql/resolvers/todo_resolver.rb b/app/graphql/resolvers/todo_resolver.rb
index 263b190c74e..863d402b4d3 100644
--- a/app/graphql/resolvers/todo_resolver.rb
+++ b/app/graphql/resolvers/todo_resolver.rb
@@ -8,27 +8,27 @@ module Resolvers
argument :action, [Types::TodoActionEnum],
required: false,
- description: 'The action to be filtered.'
+ description: 'Action to be filtered.'
argument :author_id, [GraphQL::Types::ID],
required: false,
- description: 'The ID of an author.'
+ description: 'ID of an author.'
argument :project_id, [GraphQL::Types::ID],
required: false,
- description: 'The ID of a project.'
+ description: 'ID of a project.'
argument :group_id, [GraphQL::Types::ID],
required: false,
- description: 'The ID of a group.'
+ description: 'ID of a group.'
argument :state, [Types::TodoStateEnum],
required: false,
- description: 'The state of the todo.'
+ description: 'State of the todo.'
argument :type, [Types::TodoTargetEnum],
required: false,
- description: 'The type of the todo.'
+ description: 'Type of the todo.'
def resolve(**args)
return Todo.none unless current_user.present? && target.present?
diff --git a/app/graphql/resolvers/tree_resolver.rb b/app/graphql/resolvers/tree_resolver.rb
index 70b4d81845c..8d6ece0956e 100644
--- a/app/graphql/resolvers/tree_resolver.rb
+++ b/app/graphql/resolvers/tree_resolver.rb
@@ -9,11 +9,11 @@ module Resolvers
argument :path, GraphQL::Types::String,
required: false,
default_value: '',
- description: 'The path to get the tree for. Default value is the root of the repository.'
+ description: 'Path to get the tree for. Default value is the root of the repository.'
argument :ref, GraphQL::Types::String,
required: false,
default_value: :head,
- description: 'The commit ref to get the tree for. Default value is HEAD.'
+ description: 'Commit ref to get the tree for. Default value is HEAD.'
argument :recursive, GraphQL::Types::Boolean,
required: false,
default_value: false,
diff --git a/app/graphql/resolvers/users/snippets_resolver.rb b/app/graphql/resolvers/users/snippets_resolver.rb
index ee1727aadbe..75bba8debab 100644
--- a/app/graphql/resolvers/users/snippets_resolver.rb
+++ b/app/graphql/resolvers/users/snippets_resolver.rb
@@ -11,7 +11,7 @@ module Resolvers
argument :type, Types::Snippets::TypeEnum,
required: false,
- description: 'The type of snippet.'
+ description: 'Type of snippet.'
private
diff --git a/app/graphql/types/admin/analytics/usage_trends/measurement_type.rb b/app/graphql/types/admin/analytics/usage_trends/measurement_type.rb
index c54c938402d..8276549ddcc 100644
--- a/app/graphql/types/admin/analytics/usage_trends/measurement_type.rb
+++ b/app/graphql/types/admin/analytics/usage_trends/measurement_type.rb
@@ -12,13 +12,13 @@ module Types
authorize :read_usage_trends_measurement
field :recorded_at, Types::TimeType, null: true,
- description: 'The time the measurement was recorded.'
+ description: 'Time the measurement was recorded.'
field :count, GraphQL::Types::Int, null: false,
description: 'Object count.'
field :identifier, Types::Admin::Analytics::UsageTrends::MeasurementIdentifierEnum, null: false,
- description: 'The type of objects being measured.'
+ description: 'Type of objects being measured.'
end
end
end
diff --git a/app/graphql/types/admin/sidekiq_queues/delete_jobs_response_type.rb b/app/graphql/types/admin/sidekiq_queues/delete_jobs_response_type.rb
index cc6e3db007b..4f31e2f783a 100644
--- a/app/graphql/types/admin/sidekiq_queues/delete_jobs_response_type.rb
+++ b/app/graphql/types/admin/sidekiq_queues/delete_jobs_response_type.rb
@@ -17,12 +17,12 @@ module Types
field :deleted_jobs,
GraphQL::Types::Int,
null: true,
- description: 'The number of matching jobs deleted.'
+ description: 'Number of matching jobs deleted.'
field :queue_size,
GraphQL::Types::Int,
null: true,
- description: 'The queue size after processing.'
+ description: 'Queue size after processing.'
end
end
end
diff --git a/app/graphql/types/alert_management/alert_type.rb b/app/graphql/types/alert_management/alert_type.rb
index bdfdd2c5886..4bdb476860a 100644
--- a/app/graphql/types/alert_management/alert_type.rb
+++ b/app/graphql/types/alert_management/alert_type.rb
@@ -122,12 +122,12 @@ module Types
field :details_url,
GraphQL::Types::String,
null: false,
- description: 'The URL of the alert detail page.'
+ description: 'URL of the alert detail page.'
field :prometheus_alert,
Types::PrometheusAlertType,
null: true,
- description: 'The alert condition for Prometheus.'
+ description: 'Alert condition for Prometheus.'
def notes
object.ordered_notes
diff --git a/app/graphql/types/award_emojis/award_emoji_type.rb b/app/graphql/types/award_emojis/award_emoji_type.rb
index 1f6f0badcac..76415afc6c1 100644
--- a/app/graphql/types/award_emojis/award_emoji_type.rb
+++ b/app/graphql/types/award_emojis/award_emoji_type.rb
@@ -13,32 +13,32 @@ module Types
field :name,
GraphQL::Types::String,
null: false,
- description: 'The emoji name.'
+ description: 'Emoji name.'
field :description,
GraphQL::Types::String,
null: false,
- description: 'The emoji description.'
+ description: 'Emoji description.'
field :unicode,
GraphQL::Types::String,
null: false,
- description: 'The emoji in Unicode.'
+ description: 'Emoji in Unicode.'
field :emoji,
GraphQL::Types::String,
null: false,
- description: 'The emoji as an icon.'
+ description: 'Emoji as an icon.'
field :unicode_version,
GraphQL::Types::String,
null: false,
- description: 'The Unicode version for this emoji.'
+ description: 'Unicode version for this emoji.'
field :user,
Types::UserType,
null: false,
- description: 'The user who awarded the emoji.'
+ description: 'User who awarded the emoji.'
def user
Gitlab::Graphql::Loaders::BatchModelLoader.new(User, object.user_id).find
diff --git a/app/graphql/types/ci/config/job_restriction_type.rb b/app/graphql/types/ci/config/job_restriction_type.rb
index 891ba18dacc..8cf0e210def 100644
--- a/app/graphql/types/ci/config/job_restriction_type.rb
+++ b/app/graphql/types/ci/config/job_restriction_type.rb
@@ -8,7 +8,7 @@ module Types
graphql_name 'CiConfigJobRestriction'
field :refs, [GraphQL::Types::String], null: true,
- description: 'The Git refs the job restriction applies to.'
+ description: 'Git refs the job restriction applies to.'
end
end
end
diff --git a/app/graphql/types/ci/config/status_enum.rb b/app/graphql/types/ci/config/status_enum.rb
index 1ba207531b8..dbb560c93c3 100644
--- a/app/graphql/types/ci/config/status_enum.rb
+++ b/app/graphql/types/ci/config/status_enum.rb
@@ -7,8 +7,8 @@ module Types
graphql_name 'CiConfigStatus'
description 'Values for YAML processor result'
- value 'VALID', 'The configuration file is valid.', value: :valid
- value 'INVALID', 'The configuration file is not valid.', value: :invalid
+ value 'VALID', 'Configuration file is valid.', value: :valid
+ value 'INVALID', 'Configuration file is not valid.', value: :invalid
end
end
end
diff --git a/app/graphql/types/ci/pipeline_type.rb b/app/graphql/types/ci/pipeline_type.rb
index 0375257eb7b..493ce188d9b 100644
--- a/app/graphql/types/ci/pipeline_type.rb
+++ b/app/graphql/types/ci/pipeline_type.rb
@@ -97,7 +97,7 @@ module Types
type: ::Types::Ci::JobType,
null: true,
authorize: :read_commit_status,
- description: 'A specific job in this pipeline, either by name or ID.' do
+ description: 'Specific job in this pipeline, either by name or ID.' do
argument :id,
type: ::Types::GlobalIDType[::CommitStatus],
required: false,
diff --git a/app/graphql/types/ci_configuration/sast/ui_component_size_enum.rb b/app/graphql/types/ci_configuration/sast/ui_component_size_enum.rb
index 76d2a314c13..62bd3e9b2ca 100644
--- a/app/graphql/types/ci_configuration/sast/ui_component_size_enum.rb
+++ b/app/graphql/types/ci_configuration/sast/ui_component_size_enum.rb
@@ -7,9 +7,9 @@ module Types
graphql_name 'SastUiComponentSize'
description 'Size of UI component in SAST configuration page'
- value 'SMALL', description: "The size of UI component in SAST configuration page is small."
- value 'MEDIUM', description: "The size of UI component in SAST configuration page is medium."
- value 'LARGE', description: "The size of UI component in SAST configuration page is large."
+ value 'SMALL', description: "Size of UI component in SAST configuration page is small."
+ value 'MEDIUM', description: "Size of UI component in SAST configuration page is medium."
+ value 'LARGE', description: "Size of UI component in SAST configuration page is large."
end
end
end
diff --git a/app/graphql/types/commit_action_type.rb b/app/graphql/types/commit_action_type.rb
index b170134b388..6f6d6a418dc 100644
--- a/app/graphql/types/commit_action_type.rb
+++ b/app/graphql/types/commit_action_type.rb
@@ -3,7 +3,7 @@
module Types
class CommitActionType < BaseInputObject
argument :action, type: Types::CommitActionModeEnum, required: true,
- description: 'The action to perform, create, delete, move, update, chmod.'
+ description: 'Action to perform: create, delete, move, update, or chmod.'
argument :file_path, type: GraphQL::Types::String, required: true,
description: 'Full path to the file.'
argument :content, type: GraphQL::Types::String, required: false,
diff --git a/app/graphql/types/container_repository_cleanup_status_enum.rb b/app/graphql/types/container_repository_cleanup_status_enum.rb
index 6e654e65360..e9ccb8adec8 100644
--- a/app/graphql/types/container_repository_cleanup_status_enum.rb
+++ b/app/graphql/types/container_repository_cleanup_status_enum.rb
@@ -5,9 +5,9 @@ module Types
graphql_name 'ContainerRepositoryCleanupStatus'
description 'Status of the tags cleanup of a container repository'
- value 'UNSCHEDULED', value: 'cleanup_unscheduled', description: 'The tags cleanup is not scheduled. This is the default state.'
- value 'SCHEDULED', value: 'cleanup_scheduled', description: 'The tags cleanup is scheduled and is going to be executed shortly.'
- value 'UNFINISHED', value: 'cleanup_unfinished', description: 'The tags cleanup has been partially executed. There are still remaining tags to delete.'
- value 'ONGOING', value: 'cleanup_ongoing', description: 'The tags cleanup is ongoing.'
+ value 'UNSCHEDULED', value: 'cleanup_unscheduled', description: 'Tags cleanup is not scheduled. This is the default state.'
+ value 'SCHEDULED', value: 'cleanup_scheduled', description: 'Tags cleanup is scheduled and is going to be executed shortly.'
+ value 'UNFINISHED', value: 'cleanup_unfinished', description: 'Tags cleanup has been partially executed. There are still remaining tags to delete.'
+ value 'ONGOING', value: 'cleanup_ongoing', description: 'Tags cleanup is ongoing.'
end
end
diff --git a/app/graphql/types/container_repository_tag_type.rb b/app/graphql/types/container_repository_tag_type.rb
index b6b65bce421..206d6a3426c 100644
--- a/app/graphql/types/container_repository_tag_type.rb
+++ b/app/graphql/types/container_repository_tag_type.rb
@@ -14,7 +14,7 @@ module Types
field :digest, GraphQL::Types::String, null: true, description: 'Digest of the tag.'
field :revision, GraphQL::Types::String, null: true, description: 'Revision of the tag.'
field :short_revision, GraphQL::Types::String, null: true, description: 'Short revision of the tag.'
- field :total_size, GraphQL::Types::BigInt, null: true, description: 'The size of the tag.'
+ field :total_size, GraphQL::Types::BigInt, null: true, description: 'Size of the tag.'
field :created_at, Types::TimeType, null: true, description: 'Timestamp when the tag was created.'
field :can_delete, GraphQL::Types::Boolean, null: false, description: 'Can the current user delete this tag.'
diff --git a/app/graphql/types/container_repository_type.rb b/app/graphql/types/container_repository_type.rb
index 91a65053131..67093f57862 100644
--- a/app/graphql/types/container_repository_type.rb
+++ b/app/graphql/types/container_repository_type.rb
@@ -15,7 +15,7 @@ module Types
field :created_at, Types::TimeType, null: false, description: 'Timestamp when the container repository was created.'
field :updated_at, Types::TimeType, null: false, description: 'Timestamp when the container repository was updated.'
field :expiration_policy_started_at, Types::TimeType, null: true, description: 'Timestamp when the cleanup done by the expiration policy was started on the container repository.'
- field :expiration_policy_cleanup_status, Types::ContainerRepositoryCleanupStatusEnum, null: true, description: 'The tags cleanup status for the container repository.'
+ field :expiration_policy_cleanup_status, Types::ContainerRepositoryCleanupStatusEnum, null: true, description: 'Tags cleanup status for the container repository.'
field :status, Types::ContainerRepositoryStatusEnum, null: true, description: 'Status of the container repository.'
field :tags_count, GraphQL::Types::Int, null: false, description: 'Number of tags associated with this image.'
field :can_delete, GraphQL::Types::Boolean, null: false, description: 'Can the current user delete the container repository.'
diff --git a/app/graphql/types/custom_emoji_type.rb b/app/graphql/types/custom_emoji_type.rb
index 64381b3ee1e..379a0c44d67 100644
--- a/app/graphql/types/custom_emoji_type.rb
+++ b/app/graphql/types/custom_emoji_type.rb
@@ -9,16 +9,16 @@ module Types
field :id, ::Types::GlobalIDType[::CustomEmoji],
null: false,
- description: 'The ID of the emoji.'
+ description: 'ID of the emoji.'
field :name, GraphQL::Types::String,
null: false,
- description: 'The name of the emoji.'
+ description: 'Name of the emoji.'
field :url, GraphQL::Types::String,
null: false,
method: :file,
- description: 'The link to file of the emoji.'
+ description: 'Link to file of the emoji.'
field :external, GraphQL::Types::Boolean,
null: false,
diff --git a/app/helpers/system_note_helper.rb b/app/helpers/system_note_helper.rb
index 521423fbb94..1d8b657025c 100644
--- a/app/helpers/system_note_helper.rb
+++ b/app/helpers/system_note_helper.rb
@@ -39,7 +39,8 @@ module SystemNoteHelper
'alert_issue_added' => 'issues',
'new_alert_added' => 'warning',
'severity' => 'information-o',
- 'cloned' => 'documents'
+ 'cloned' => 'documents',
+ 'issue_type' => 'pencil-square'
}.freeze
def system_note_icon_name(note)
diff --git a/app/models/issue.rb b/app/models/issue.rb
index 48e3fdd51e9..fc5c0455df4 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -584,9 +584,10 @@ class Issue < ApplicationRecord
confidential_changed?(from: true, to: false)
end
- # Ensure that the metrics association is safely created and respecting the unique constraint on issue_id
override :ensure_metrics
def ensure_metrics
+ return Issue::Metrics.record!(self) if Feature.enabled?(:upsert_issue_metrics, default_enabled: :yaml)
+
if !association(:metrics).loaded? || metrics.blank?
metrics_record = Issue::Metrics.safe_find_or_create_by(issue: self)
self.metrics = metrics_record
diff --git a/app/models/issue/metrics.rb b/app/models/issue/metrics.rb
index 86523bbd023..b6ef600450e 100644
--- a/app/models/issue/metrics.rb
+++ b/app/models/issue/metrics.rb
@@ -9,6 +9,33 @@ class Issue::Metrics < ApplicationRecord
.or(where(arel_table['first_mentioned_in_commit_at'].gteq(timestamp)))
}
+ class << self
+ def record!(issue)
+ now = connection.quote(Time.current)
+ first_associated_with_milestone_at = issue.milestone_id.present? ? now : 'NULL'
+ first_added_to_board_at = issue_assigned_to_list_label?(issue) ? now : 'NULL'
+
+ sql = <<~SQL
+ INSERT INTO #{self.table_name} (issue_id, first_associated_with_milestone_at, first_added_to_board_at, created_at, updated_at)
+ VALUES (#{issue.id}, #{first_associated_with_milestone_at}, #{first_added_to_board_at}, NOW(), NOW())
+ ON CONFLICT (issue_id)
+ DO UPDATE SET
+ first_associated_with_milestone_at = LEAST(#{self.table_name}.first_associated_with_milestone_at, EXCLUDED.first_associated_with_milestone_at),
+ first_added_to_board_at = LEAST(#{self.table_name}.first_added_to_board_at, EXCLUDED.first_added_to_board_at),
+ updated_at = NOW()
+ RETURNING id
+ SQL
+
+ connection.execute(sql)
+ end
+
+ private
+
+ def issue_assigned_to_list_label?(issue)
+ issue.labels.joins(:lists).exists?
+ end
+ end
+
def record!
if issue.milestone_id.present? && self.first_associated_with_milestone_at.blank?
self.first_associated_with_milestone_at = Time.current
@@ -24,10 +51,6 @@ class Issue::Metrics < ApplicationRecord
private
def issue_assigned_to_list_label?
- # Avoid another DB lookup when issue.labels are empty by adding a guard clause here
- # We can't use issue.labels.empty? because that will cause a `Label Exists?` DB lookup
- return false if issue.labels.length == 0 # rubocop:disable Style/ZeroLengthPredicate
-
- issue.labels.includes(:lists).any? { |label| label.lists.present? }
+ issue.labels.joins(:lists).exists?
end
end
diff --git a/app/services/issues/update_service.rb b/app/services/issues/update_service.rb
index 9ede5ef728b..4e52acfcdda 100644
--- a/app/services/issues/update_service.rb
+++ b/app/services/issues/update_service.rb
@@ -77,6 +77,7 @@ module Issues
end
handle_severity_change(issue, old_severity)
+ handle_issue_type_change(issue)
end
def handle_assignee_changes(issue, old_assignees)
@@ -218,6 +219,16 @@ module Issues
def remove_incident_label?(issue)
issue.issue_type != params[:issue_type] && issue.incident?
end
+
+ def handle_issue_type_change(issue)
+ return unless issue.previous_changes.include?('issue_type')
+
+ do_handle_issue_type_change(issue)
+ end
+
+ def do_handle_issue_type_change(issue)
+ SystemNoteService.change_issue_type(issue, current_user)
+ end
end
end
diff --git a/app/services/system_note_service.rb b/app/services/system_note_service.rb
index 56a6244eebf..e5080718b69 100644
--- a/app/services/system_note_service.rb
+++ b/app/services/system_note_service.rb
@@ -331,6 +331,10 @@ module SystemNoteService
::SystemNotes::AlertManagementService.new(noteable: alert, project: alert.project).log_resolving_alert(monitoring_tool)
end
+ def change_issue_type(issue, author)
+ ::SystemNotes::IssuablesService.new(noteable: issue, project: issue.project, author: author).change_issue_type
+ end
+
private
def merge_requests_service(noteable, project, author)
diff --git a/app/services/system_notes/issuables_service.rb b/app/services/system_notes/issuables_service.rb
index ae4f65e785c..62aead352aa 100644
--- a/app/services/system_notes/issuables_service.rb
+++ b/app/services/system_notes/issuables_service.rb
@@ -380,6 +380,12 @@ module SystemNotes
create_resource_state_event(status: 'closed', close_auto_resolve_prometheus_alert: true)
end
+ def change_issue_type
+ body = "changed issue type to #{noteable.issue_type.humanize(capitalize: false)}"
+
+ create_note(NoteSummary.new(noteable, project, author, body, action: 'issue_type'))
+ end
+
private
def cross_reference_note_content(gfm_reference)
diff --git a/app/views/layouts/nav/sidebar/_group_menus.html.haml b/app/views/layouts/nav/sidebar/_group_menus.html.haml
index 25b6c264d92..4c0ed6a888d 100644
--- a/app/views/layouts/nav/sidebar/_group_menus.html.haml
+++ b/app/views/layouts/nav/sidebar/_group_menus.html.haml
@@ -1,3 +1 @@
-= render_if_exists "groups/ee/administration_nav"
-
= render 'shared/sidebar_toggle_button'
diff --git a/app/workers/gitlab/github_import/stage/import_issues_and_diff_notes_worker.rb b/app/workers/gitlab/github_import/stage/import_issues_and_diff_notes_worker.rb
index c33836e20d1..5188bda03e2 100644
--- a/app/workers/gitlab/github_import/stage/import_issues_and_diff_notes_worker.rb
+++ b/app/workers/gitlab/github_import/stage/import_issues_and_diff_notes_worker.rb
@@ -12,17 +12,10 @@ module Gitlab
include GithubImport::Queue
include StageMethods
- # The importers to run in this stage. Issues can't be imported earlier
- # on as we also use these to enrich pull requests with assigned labels.
- IMPORTERS = [
- Importer::IssuesImporter,
- Importer::DiffNotesImporter
- ].freeze
-
# client - An instance of Gitlab::GithubImport::Client.
# project - An instance of Project.
def import(client, project)
- waiters = IMPORTERS.each_with_object({}) do |klass, hash|
+ waiters = importers(project).each_with_object({}) do |klass, hash|
info(project.id, message: "starting importer", importer: klass.name)
waiter = klass.new(project, client).execute
hash[waiter.key] = waiter.jobs_remaining
@@ -30,6 +23,25 @@ module Gitlab
AdvanceStageWorker.perform_async(project.id, waiters, :notes)
end
+
+ # The importers to run in this stage. Issues can't be imported earlier
+ # on as we also use these to enrich pull requests with assigned labels.
+ def importers(project)
+ [
+ Importer::IssuesImporter,
+ diff_notes_importer(project)
+ ]
+ end
+
+ private
+
+ def diff_notes_importer(project)
+ if project.group.present? && Feature.enabled?(:github_importer_single_endpoint_notes_import, project.group, type: :ops, default_enabled: :yaml)
+ Importer::SingleEndpointDiffNotesImporter
+ else
+ Importer::DiffNotesImporter
+ end
+ end
end
end
end
diff --git a/app/workers/gitlab/github_import/stage/import_notes_worker.rb b/app/workers/gitlab/github_import/stage/import_notes_worker.rb
index 0160145ffe2..90a1337169f 100644
--- a/app/workers/gitlab/github_import/stage/import_notes_worker.rb
+++ b/app/workers/gitlab/github_import/stage/import_notes_worker.rb
@@ -15,17 +15,31 @@ module Gitlab
# client - An instance of Gitlab::GithubImport::Client.
# project - An instance of Project.
def import(client, project)
- info(project.id, message: "starting importer", importer: 'Importer::NotesImporter')
- waiter = Importer::NotesImporter
- .new(project, client)
- .execute
+ waiters = importers(project).each_with_object({}) do |klass, hash|
+ info(project.id, message: "starting importer", importer: klass.name)
+ waiter = klass.new(project, client).execute
+ hash[waiter.key] = waiter.jobs_remaining
+ end
AdvanceStageWorker.perform_async(
project.id,
- { waiter.key => waiter.jobs_remaining },
+ waiters,
:lfs_objects
)
end
+
+ def importers(project)
+ if project.group.present? && Feature.enabled?(:github_importer_single_endpoint_notes_import, project.group, type: :ops, default_enabled: :yaml)
+ [
+ Importer::SingleEndpointMergeRequestNotesImporter,
+ Importer::SingleEndpointIssueNotesImporter
+ ]
+ else
+ [
+ Importer::NotesImporter
+ ]
+ end
+ end
end
end
end