Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2023-06-13 21:09:09 +00:00
parent 4a064b8dc0
commit 04cc87ee46
115 changed files with 1274 additions and 342 deletions

View File

@ -1,21 +0,0 @@
---
RSpec/Be:
Exclude:
- 'ee/spec/services/groups/transfer_service_spec.rb'
- 'spec/lib/bulk_imports/common/pipelines/boards_pipeline_spec.rb'
- 'spec/lib/gitlab/background_migration/backfill_snippet_repositories_spec.rb'
- 'spec/lib/gitlab/lets_encrypt/client_spec.rb'
- 'spec/lib/gitlab/search_context/builder_spec.rb'
- 'spec/migrations/20220503035221_add_gitlab_schema_to_batched_background_migrations_spec.rb'
- 'spec/models/concerns/issuable_spec.rb'
- 'spec/models/identity_spec.rb'
- 'spec/models/snippet_repository_spec.rb'
- 'spec/presenters/packages/nuget/search_results_presenter_spec.rb'
- 'spec/requests/api/graphql/mutations/snippets/create_spec.rb'
- 'spec/requests/api/pages_domains_spec.rb'
- 'spec/services/pages/delete_service_spec.rb'
- 'spec/services/pages/migrate_from_legacy_storage_service_spec.rb'
- 'spec/services/projects/update_pages_service_spec.rb'
- 'spec/support/shared_examples/requests/api/packages_shared_examples.rb'
- 'spec/uploaders/file_uploader_spec.rb'
- 'spec/uploaders/namespace_file_uploader_spec.rb'

18
app/models/abuse/event.rb Normal file
View File

@ -0,0 +1,18 @@
# frozen_string_literal: true
module Abuse
class Event < ApplicationRecord
self.table_name = 'abuse_events'
validates :category, presence: true
validates :source, presence: true
validates :user, presence: true, on: :create
validates :metadata, json_schema: { filename: 'abuse_event_metadata' }, allow_blank: true
belongs_to :user, inverse_of: :abuse_events
belongs_to :abuse_report, inverse_of: :abuse_events
enum category: Enums::Abuse::Category.categories
enum source: Enums::Abuse::Source.sources
end
end

View File

@ -19,6 +19,8 @@ class AbuseReport < ApplicationRecord
has_many :events, class_name: 'ResourceEvents::AbuseReportEvent', inverse_of: :abuse_report
has_many :abuse_events, class_name: 'Abuse::Event', inverse_of: :abuse_report
validates :reporter, presence: true, on: :create
validates :user, presence: true, on: :create
validates :message, presence: true

View File

@ -3,7 +3,7 @@
class CommitUserMention < UserMention
include IgnorableColumns
ignore_column :note_id_convert_to_bigint, remove_with: '16.0', remove_after: '2023-05-22'
ignore_column :note_id_convert_to_bigint, remove_with: '16.2', remove_after: '2023-07-22'
belongs_to :note
end

View File

@ -0,0 +1,16 @@
# frozen_string_literal: true
module Enums
module Abuse
module Category
def self.categories
{
spam: 0, # spamcheck
virus: 1, # VirusTotal
fraud: 2, # Arkos, Telesign
ci_cd: 3 # PVS
}
end
end
end
end

View File

@ -3,7 +3,7 @@
class DesignUserMention < UserMention
include IgnorableColumns
ignore_column :note_id_convert_to_bigint, remove_with: '16.0', remove_after: '2023-05-22'
ignore_column :note_id_convert_to_bigint, remove_with: '16.2', remove_after: '2023-07-22'
belongs_to :design, class_name: 'DesignManagement::Design'
belongs_to :note

View File

@ -5,5 +5,5 @@ class IssueUserMention < UserMention
belongs_to :note
include IgnorableColumns
ignore_column :note_id_convert_to_bigint, remove_with: '16.0', remove_after: '2023-05-22'
ignore_column :note_id_convert_to_bigint, remove_with: '16.2', remove_after: '2023-07-22'
end

View File

@ -3,7 +3,7 @@
class MergeRequestUserMention < UserMention
include IgnorableColumns
ignore_column :note_id_convert_to_bigint, remove_with: '16.0', remove_after: '2023-05-22'
ignore_column :note_id_convert_to_bigint, remove_with: '16.2', remove_after: '2023-07-22'
belongs_to :merge_request
belongs_to :note

View File

@ -4,7 +4,7 @@ class NoteDiffFile < ApplicationRecord
include DiffFile
include IgnorableColumns
ignore_column :diff_note_id_convert_to_bigint, remove_with: '16.0', remove_after: '2023-05-22'
ignore_column :diff_note_id_convert_to_bigint, remove_with: '16.2', remove_after: '2023-07-22'
scope :referencing_sha, -> (oids, project_id:) do
joins(:diff_note).where(notes: { project_id: project_id, commit_id: oids })

View File

@ -3,7 +3,7 @@
class SnippetUserMention < UserMention
include IgnorableColumns
ignore_column :note_id_convert_to_bigint, remove_with: '16.0', remove_after: '2023-05-22'
ignore_column :note_id_convert_to_bigint, remove_with: '16.2', remove_after: '2023-07-22'
belongs_to :snippet
belongs_to :note

View File

@ -5,7 +5,7 @@ class Suggestion < ApplicationRecord
include Suggestible
include IgnorableColumns
ignore_column :note_id_convert_to_bigint, remove_with: '16.0', remove_after: '2023-05-22'
ignore_column :note_id_convert_to_bigint, remove_with: '16.2', remove_after: '2023-07-22'
belongs_to :note, inverse_of: :suggestions
validates :note, presence: true, unless: :importing?

View File

@ -4,7 +4,7 @@ class SystemNoteMetadata < ApplicationRecord
include Importable
include IgnorableColumns
ignore_column :note_id_convert_to_bigint, remove_with: '16.0', remove_after: '2023-05-22'
ignore_column :note_id_convert_to_bigint, remove_with: '16.2', remove_after: '2023-07-22'
# These notes's action text might contain a reference that is external.
# We should always force a deep validation upon references that are found

View File

@ -5,7 +5,7 @@ class Timelog < ApplicationRecord
include IgnorableColumns
include Sortable
ignore_column :note_id_convert_to_bigint, remove_with: '16.0', remove_after: '2023-05-22'
ignore_column :note_id_convert_to_bigint, remove_with: '16.2', remove_after: '2023-07-22'
before_save :set_project

View File

@ -6,7 +6,7 @@ class Todo < ApplicationRecord
include EachBatch
include IgnorableColumns
ignore_column :note_id_convert_to_bigint, remove_with: '16.0', remove_after: '2023-05-22'
ignore_column :note_id_convert_to_bigint, remove_with: '16.2', remove_after: '2023-07-22'
# Time to wait for todos being removed when not visible for user anymore.
# Prevents TODOs being removed by mistake, for example, removing access from a user

View File

@ -223,6 +223,7 @@ class User < ApplicationRecord
has_many :reported_abuse_reports, dependent: :nullify, foreign_key: :reporter_id, class_name: "AbuseReport", inverse_of: :reporter # rubocop:disable Cop/ActiveRecordDependent
has_many :assigned_abuse_reports, foreign_key: :assignee_id, class_name: "AbuseReport", inverse_of: :assignee
has_many :resolved_abuse_reports, foreign_key: :resolved_by_id, class_name: "AbuseReport", inverse_of: :resolved_by
has_many :abuse_events, foreign_key: :user_id, class_name: 'Abuse::Event', inverse_of: :user
has_many :spam_logs, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent
has_many :abuse_trust_scores, class_name: 'Abuse::TrustScore', foreign_key: :user_id
has_many :builds, class_name: 'Ci::Build'

View File

@ -4,7 +4,7 @@ class WorkItem < Issue
include Gitlab::Utils::StrongMemoize
COMMON_QUICK_ACTIONS_COMMANDS = [
:title, :reopen, :close, :cc, :tableflip, :shrug, :type
:title, :reopen, :close, :cc, :tableflip, :shrug, :type, :promote_to
].freeze
self.table_name = 'issues'
@ -168,8 +168,9 @@ class WorkItem < Issue
errors.add(
:work_item_type_id,
format(
_('cannot be changed to %{new_type} with %{parent_type} as parent type.'),
new_type: work_item_type.name, parent_type: parent_link.work_item_parent.work_item_type.name
_('cannot be changed to %{new_type} when linked to a parent %{parent_type}.'),
new_type: work_item_type.name.downcase,
parent_type: parent_link.work_item_parent.work_item_type.name.downcase
)
)
end

View File

@ -0,0 +1,4 @@
# frozen_string_literal: true
class WorkItemPresenter < IssuePresenter # rubocop:todo Gitlab/NamespacedClass
end

View File

@ -107,16 +107,10 @@ module Notes
def do_commands(note, update_params, message, command_names, only_commands)
return if quick_actions_service.commands_executed_count.to_i == 0
if update_params.present?
invalid_message = validate_commands(note, update_params)
if invalid_message
note.errors.add(:validation, invalid_message)
message = invalid_message
else
quick_actions_service.apply_updates(update_params, note)
note.commands_changes = update_params
end
update_error = quick_actions_update_errors(note, update_params)
if update_error
note.errors.add(:validation, update_error)
message = update_error
end
# We must add the error after we call #save because errors are reset
@ -129,6 +123,19 @@ module Notes
end
end
def quick_actions_update_errors(note, params)
return unless params.present?
invalid_message = validate_commands(note, params)
return invalid_message if invalid_message
service_response = quick_actions_service.apply_updates(params, note)
note.commands_changes = params
return if service_response.success?
service_response.message.join(', ')
end
def quick_action_options
{
merge_request_diff_head_sha: params[:merge_request_diff_head_sha],

View File

@ -50,7 +50,21 @@ module Notes
update_params[:spend_time][:note_id] = note.id
end
noteable_update_service(note, update_params).execute(note.noteable)
execute_update_service(note, update_params)
end
private
def execute_update_service(note, params)
service_response = noteable_update_service(note, params).execute(note.noteable)
service_errors = if service_response.respond_to?(:errors)
service_response.errors.full_messages
elsif service_response.respond_to?(:[]) && service_response[:status] == :error
service_response[:message]
end
service_errors.blank? ? ServiceResponse.success : ServiceResponse.error(message: service_errors)
end
def noteable_update_service(note, update_params)

View File

@ -0,0 +1,7 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Metadata to support an abuse event",
"type": "object",
"properties": {
}
}

View File

@ -1,21 +1,23 @@
.login-box
.login-body
= gitlab_ui_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post, class: 'gl-show-field-errors' }) do |f|
= gitlab_ui_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post, class: 'gl-p-5 gl-show-field-errors', aria: { live: 'assertive' }}) do |f|
.devise-errors
= render "devise/shared/error_messages", resource: resource
.form-group.gl-px-5.gl-pt-5
= f.label :email, class: ("gl-mb-1" if Feature.enabled?(:restyle_login_page))
.form-group
= f.label :email, _('Email')
= f.email_field :email, class: "form-control gl-form-input", required: true, autocomplete: 'off', value: params[:user_email], autofocus: true, title: _('Please provide a valid email address.')
.form-text.text-muted
= _('Requires a verified GitLab email address.')
- if recaptcha_enabled?
.gl-px-5
.gl-mb-5
= recaptcha_tags nonce: content_security_policy_nonce
.gl-p-5
= render Pajamas::ButtonComponent.new(type: :submit, variant: :confirm, block: true) do
= _('Reset password')
= render Pajamas::ButtonComponent.new(type: :submit, variant: :confirm, block: true) do
= _('Reset password')
.clearfix.prepend-top-20
- if Feature.enabled?(:restyle_login_page, @project)
= render 'devise/shared/sign_in_link'
- else
.gl-mt-3
= render 'devise/shared/sign_in_link'

View File

@ -0,0 +1,26 @@
---
key_path: redis_hll_counters.quickactions.i_quickactions_promote_to_weekly
name: quickactions_promote_to_weekly
description: Count of WAU using the `/promote_to` quick action
product_section: dev
product_stage: plan
product_group: product_planning
value_type: number
status: active
milestone: "16.1"
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/122911
time_frame: 7d
data_source: redis_hll
data_category: optional
instrumentation_class: RedisHLLMetric
options:
events:
- i_quickactions_promote_to
performance_indicator_type: []
distribution:
- ce
- ee
tier:
- free
- premium
- ultimate

10
db/docs/abuse_events.yml Normal file
View File

@ -0,0 +1,10 @@
---
table_name: abuse_events
classes:
- Abuse::Event
feature_categories:
- insider_threat
description: Captures events of potential abuse
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/115258
milestone: '16.1'
gitlab_schema: gitlab_main

View File

@ -0,0 +1,24 @@
# frozen_string_literal: true
class CreateAbuseEvents < Gitlab::Database::Migration[2.1]
INDEX_NAME = 'index_abuse_events_on_category_and_source'
enable_lock_retries!
def up
create_table :abuse_events do |t|
t.bigint :user_id, null: true, index: true
t.timestamps_with_timezone null: false
t.references :abuse_report, foreign_key: true, on_delete: :nullify, null: true, index: true
t.integer :source, null: false, limit: 2
t.integer :category, null: true, limit: 2
t.jsonb :metadata, null: true
end
add_index :abuse_events, [:category, :source], name: INDEX_NAME
end
def down
drop_table :abuse_events
end
end

View File

@ -0,0 +1,15 @@
# frozen_string_literal: true
class AddForeignKeyConstraintsToAbuseEvents < Gitlab::Database::Migration[2.1]
disable_ddl_transaction!
def up
add_concurrent_foreign_key :abuse_events, :users, column: :user_id, on_delete: :nullify, null: true
end
def down
with_lock_retries do
remove_foreign_key_if_exists :abuse_events, column: :user_id
end
end
end

View File

@ -0,0 +1,11 @@
# frozen_string_literal: true
class ValidateFkCiBuildPendingStatesPCiBuilds < Gitlab::Database::Migration[2.1]
def up
validate_foreign_key :ci_build_pending_states, nil, name: :temp_fk_861cd17da3_p
end
def down
# no-op
end
end

View File

@ -0,0 +1,11 @@
# frozen_string_literal: true
class ValidateFkCiBuildTraceChunksPCiBuilds < Gitlab::Database::Migration[2.1]
def up
validate_foreign_key :ci_build_trace_chunks, nil, name: :temp_fk_89e29fa5ee_p
end
def down
# no-op
end
end

View File

@ -0,0 +1,11 @@
# frozen_string_literal: true
class ValidateFkCiUnitTestFailuresPCiBuilds < Gitlab::Database::Migration[2.1]
def up
validate_foreign_key :ci_unit_test_failures, nil, name: :temp_fk_9e0fc58930_p
end
def down
# no-op
end
end

View File

@ -0,0 +1,11 @@
# frozen_string_literal: true
class ValidateFkCiSourcesPipelinesPCiBuilds < Gitlab::Database::Migration[2.1]
def up
validate_foreign_key :ci_sources_pipelines, nil, name: :temp_fk_be5624bf37_p
end
def down
# no-op
end
end

View File

@ -0,0 +1,11 @@
# frozen_string_literal: true
class ValidateFkCiResourcesPCiBuilds < Gitlab::Database::Migration[2.1]
def up
validate_foreign_key :ci_resources, nil, name: :temp_fk_e169a8e3d5_p
end
def down
# no-op
end
end

View File

@ -0,0 +1,11 @@
# frozen_string_literal: true
class ValidateFkCiBuildReportResultsPCiBuilds < Gitlab::Database::Migration[2.1]
def up
validate_foreign_key :ci_build_report_results, nil, name: :temp_fk_rails_16cb1ff064_p
end
def down
# no-op
end
end

View File

@ -0,0 +1,11 @@
# frozen_string_literal: true
class ValidateFkCiBuildNeedsPCiBuilds < Gitlab::Database::Migration[2.1]
def up
validate_foreign_key :ci_build_needs, nil, name: :temp_fk_rails_3cf221d4ed_p
end
def down
# no-op
end
end

View File

@ -0,0 +1,11 @@
# frozen_string_literal: true
class ValidateFkCiBuildsRunnerSessionPCiBuilds < Gitlab::Database::Migration[2.1]
def up
validate_foreign_key :ci_builds_runner_session, nil, name: :temp_fk_rails_70707857d3_p
end
def down
# no-op
end
end

View File

@ -0,0 +1,11 @@
# frozen_string_literal: true
class ValidateFkCiPendingBuildsPCiBuilds < Gitlab::Database::Migration[2.1]
def up
validate_foreign_key :ci_pending_builds, nil, name: :temp_fk_rails_725a2644a3_p
end
def down
# no-op
end
end

View File

@ -0,0 +1,11 @@
# frozen_string_literal: true
class ValidateFkCiBuildTraceMetadataPCiBuilds < Gitlab::Database::Migration[2.1]
def up
validate_foreign_key :ci_build_trace_metadata, nil, name: :temp_fk_rails_aebc78111f_p
end
def down
# no-op
end
end

View File

@ -0,0 +1,28 @@
# frozen_string_literal: true
class CleanupBigintConversionForTodosForGitlabCom < Gitlab::Database::Migration[2.1]
include Gitlab::Database::MigrationHelpers::ConvertToBigint
enable_lock_retries!
TABLE = :todos
COLUMNS = [:note_id]
def up
return unless should_run?
cleanup_conversion_of_integer_to_bigint(TABLE, COLUMNS)
end
def down
return unless should_run?
restore_conversion_of_integer_to_bigint(TABLE, COLUMNS)
end
private
def should_run?
com_or_dev_or_test_but_not_jh?
end
end

View File

@ -0,0 +1,28 @@
# frozen_string_literal: true
class CleanupBigintConversionForSystemNoteMetadataForGitlabCom < Gitlab::Database::Migration[2.1]
include Gitlab::Database::MigrationHelpers::ConvertToBigint
enable_lock_retries!
TABLE = :system_note_metadata
COLUMNS = [:note_id]
def up
return unless should_run?
cleanup_conversion_of_integer_to_bigint(TABLE, COLUMNS)
end
def down
return unless should_run?
restore_conversion_of_integer_to_bigint(TABLE, COLUMNS)
end
private
def should_run?
com_or_dev_or_test_but_not_jh?
end
end

View File

@ -0,0 +1,28 @@
# frozen_string_literal: true
class CleanupBigintConversionForEpicUserMentionsForGitlabCom < Gitlab::Database::Migration[2.1]
include Gitlab::Database::MigrationHelpers::ConvertToBigint
enable_lock_retries!
TABLE = :epic_user_mentions
COLUMNS = [:note_id]
def up
return unless should_run?
cleanup_conversion_of_integer_to_bigint(TABLE, COLUMNS)
end
def down
return unless should_run?
restore_conversion_of_integer_to_bigint(TABLE, COLUMNS)
end
private
def should_run?
com_or_dev_or_test_but_not_jh?
end
end

View File

@ -0,0 +1,28 @@
# frozen_string_literal: true
class CleanupBigintConversionForSuggestionsForGitlabCom < Gitlab::Database::Migration[2.1]
include Gitlab::Database::MigrationHelpers::ConvertToBigint
enable_lock_retries!
TABLE = :suggestions
COLUMNS = [:note_id]
def up
return unless should_run?
cleanup_conversion_of_integer_to_bigint(TABLE, COLUMNS)
end
def down
return unless should_run?
restore_conversion_of_integer_to_bigint(TABLE, COLUMNS)
end
private
def should_run?
com_or_dev_or_test_but_not_jh?
end
end

View File

@ -0,0 +1,28 @@
# frozen_string_literal: true
class CleanupBigintConversionForIssueUserMentionsForGitlabCom < Gitlab::Database::Migration[2.1]
include Gitlab::Database::MigrationHelpers::ConvertToBigint
enable_lock_retries!
TABLE = :issue_user_mentions
COLUMNS = [:note_id]
def up
return unless should_run?
cleanup_conversion_of_integer_to_bigint(TABLE, COLUMNS)
end
def down
return unless should_run?
restore_conversion_of_integer_to_bigint(TABLE, COLUMNS)
end
private
def should_run?
com_or_dev_or_test_but_not_jh?
end
end

View File

@ -0,0 +1,28 @@
# frozen_string_literal: true
class CleanupBigintConversionForNoteDiffFilesForGitlabCom < Gitlab::Database::Migration[2.1]
include Gitlab::Database::MigrationHelpers::ConvertToBigint
enable_lock_retries!
TABLE = :note_diff_files
COLUMNS = [:diff_note_id]
def up
return unless should_run?
cleanup_conversion_of_integer_to_bigint(TABLE, COLUMNS)
end
def down
return unless should_run?
restore_conversion_of_integer_to_bigint(TABLE, COLUMNS)
end
private
def should_run?
com_or_dev_or_test_but_not_jh?
end
end

View File

@ -0,0 +1,28 @@
# frozen_string_literal: true
class CleanupBigintConversionForSnippetUserMentionsForGitlabCom < Gitlab::Database::Migration[2.1]
include Gitlab::Database::MigrationHelpers::ConvertToBigint
enable_lock_retries!
TABLE = :snippet_user_mentions
COLUMNS = [:note_id]
def up
return unless should_run?
cleanup_conversion_of_integer_to_bigint(TABLE, COLUMNS)
end
def down
return unless should_run?
restore_conversion_of_integer_to_bigint(TABLE, COLUMNS)
end
private
def should_run?
com_or_dev_or_test_but_not_jh?
end
end

View File

@ -0,0 +1,28 @@
# frozen_string_literal: true
class CleanupBigintConversionForDesignUserMentionsForGitlabCom < Gitlab::Database::Migration[2.1]
include Gitlab::Database::MigrationHelpers::ConvertToBigint
enable_lock_retries!
TABLE = :design_user_mentions
COLUMNS = [:note_id]
def up
return unless should_run?
cleanup_conversion_of_integer_to_bigint(TABLE, COLUMNS)
end
def down
return unless should_run?
restore_conversion_of_integer_to_bigint(TABLE, COLUMNS)
end
private
def should_run?
com_or_dev_or_test_but_not_jh?
end
end

View File

@ -0,0 +1,28 @@
# frozen_string_literal: true
class CleanupBigintConversionForVulnerabilityUserMentionsForGitlabCom < Gitlab::Database::Migration[2.1]
include Gitlab::Database::MigrationHelpers::ConvertToBigint
enable_lock_retries!
TABLE = :vulnerability_user_mentions
COLUMNS = [:note_id]
def up
return unless should_run?
cleanup_conversion_of_integer_to_bigint(TABLE, COLUMNS)
end
def down
return unless should_run?
restore_conversion_of_integer_to_bigint(TABLE, COLUMNS)
end
private
def should_run?
com_or_dev_or_test_but_not_jh?
end
end

View File

@ -0,0 +1,28 @@
# frozen_string_literal: true
class CleanupBigintConversionForCommitUserMentionsForGitlabCom < Gitlab::Database::Migration[2.1]
include Gitlab::Database::MigrationHelpers::ConvertToBigint
enable_lock_retries!
TABLE = :commit_user_mentions
COLUMNS = [:note_id]
def up
return unless should_run?
cleanup_conversion_of_integer_to_bigint(TABLE, COLUMNS)
end
def down
return unless should_run?
restore_conversion_of_integer_to_bigint(TABLE, COLUMNS)
end
private
def should_run?
com_or_dev_or_test_but_not_jh?
end
end

View File

@ -0,0 +1,28 @@
# frozen_string_literal: true
class CleanupBigintConversionForMergeRequestUserMentionsForGitlabCom < Gitlab::Database::Migration[2.1]
include Gitlab::Database::MigrationHelpers::ConvertToBigint
enable_lock_retries!
TABLE = :merge_request_user_mentions
COLUMNS = [:note_id]
def up
return unless should_run?
cleanup_conversion_of_integer_to_bigint(TABLE, COLUMNS)
end
def down
return unless should_run?
restore_conversion_of_integer_to_bigint(TABLE, COLUMNS)
end
private
def should_run?
com_or_dev_or_test_but_not_jh?
end
end

View File

@ -0,0 +1,28 @@
# frozen_string_literal: true
class CleanupBigintConversionForTimelogsForGitlabCom < Gitlab::Database::Migration[2.1]
include Gitlab::Database::MigrationHelpers::ConvertToBigint
enable_lock_retries!
TABLE = :timelogs
COLUMNS = [:note_id]
def up
return unless should_run?
cleanup_conversion_of_integer_to_bigint(TABLE, COLUMNS)
end
def down
return unless should_run?
restore_conversion_of_integer_to_bigint(TABLE, COLUMNS)
end
private
def should_run?
com_or_dev_or_test_but_not_jh?
end
end

View File

@ -0,0 +1,28 @@
# frozen_string_literal: true
class CleanupBigintConversionForAwardEmojiForGitlabCom < Gitlab::Database::Migration[2.1]
include Gitlab::Database::MigrationHelpers::ConvertToBigint
enable_lock_retries!
TABLE = :award_emoji
COLUMNS = [:awardable_id]
def up
return unless should_run?
cleanup_conversion_of_integer_to_bigint(TABLE, COLUMNS)
end
def down
return unless should_run?
restore_conversion_of_integer_to_bigint(TABLE, COLUMNS)
end
private
def should_run?
com_or_dev_or_test_but_not_jh?
end
end

View File

@ -0,0 +1 @@
a050f273e3582d5e651f691631dae28a3e1c60a3f95d1f6f05b0ea47be609e8b

View File

@ -0,0 +1 @@
746360d5f65be831e1225d343983ca870464eaa5a84f619d6b28975ecfc4a876

View File

@ -0,0 +1 @@
21784b0f64cadd7e042ef1f749734f36a9c75dab191b52b54abdf446ef0165ae

View File

@ -0,0 +1 @@
4331529950dc93a211f0e367aa9b24beef89406c55f86d37848cad082d10cc4c

View File

@ -0,0 +1 @@
14e7ccf0a930dde1369c7dcd0fc6a8719daccf461efbb2f6abb9ddc33beef670

View File

@ -0,0 +1 @@
2ffca5ebb17dacbea2ec15ba6496db4c1cf02501dcc420a5e2853792c78c1e61

View File

@ -0,0 +1 @@
3be698933e9c19c8723bb02950bda4948fa2ba70782aee59e4103566cb38804f

View File

@ -0,0 +1 @@
f8f4a9cc99a61bc5d9ab630e9d240470a7584e755277b73d8b434a1348b6063a

View File

@ -0,0 +1 @@
8ef2b55c4da3b3c5b975b9cc3e8d71c6db90a7f9288e6edb4fd828f82c545e11

View File

@ -0,0 +1 @@
b0384e0289bb98ffde357520d553484146be9e1a91abc916a1ad5ecf41e57ae8

View File

@ -0,0 +1 @@
fe8957b8fa9ecc302f622a6282633f6dc1b93c007f1d66a5bfc88154bbbf9e24

View File

@ -0,0 +1 @@
08044e26d8e3d1c721665541179a8d968db6b62d479d0761e66421df9e4c64d9

View File

@ -0,0 +1 @@
23a2b03a241a52dd898d55b4440195dee84d1bf638176a1c56d5ea27ecf895e4

View File

@ -0,0 +1 @@
525048a3306c63d37d30d93377e4210c0bf65d680d0191b6981f464829e502bb

View File

@ -0,0 +1 @@
d87c28da8a8155060b2913e7e2fea95353c6512bc013a50f6b3360332307c930

View File

@ -0,0 +1 @@
2d03e7e6d73f655b164251c7b504d695179a345f88cdea9304dc0efec94b573d

View File

@ -0,0 +1 @@
570b154e7c912e75b7ffb899b809eb5aeead6c6fc8b427db8342a5df25a0734b

View File

@ -0,0 +1 @@
4ebf7479ab3d40be6b8dbcfad034c62ce6cd66a9118da85f8344e68b5bfc08b5

View File

@ -0,0 +1 @@
ed093ce5b064fbd7f5ac99ae8add45a2ccf1e4a4911086a11517d0f99644299d

View File

@ -0,0 +1 @@
d516424bba378d9857c5807b9cef648ee4fe13531207c9aae91ece58894151d8

View File

@ -0,0 +1 @@
a3a08d3d10ca4e0e2a0d382a222ca4438313d4ee9a8998cbe2348a37517ef3ff

View File

@ -0,0 +1 @@
a5e5bc6b56f1134d94d46b084172961869bb6f7d5d5d828ba5f076dd9cf9a2ad

View File

@ -0,0 +1 @@
c66905576a5cdbf1f299fa6af77414ef889b108e0212f7ce9e6e9f132c134af9

View File

@ -0,0 +1 @@
c4f9c35213d69b2285fecf253bd3d50c962c55a3cfc4b50c3905571e6c99e9b6

View File

@ -0,0 +1 @@
32adffeb44d662bb83d3685820bf2d149963b09ff25488586cbb0ad81fe5672f

View File

@ -255,24 +255,6 @@ BEGIN
END;
$$;
CREATE FUNCTION trigger_0e214b8a14f2() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
NEW."note_id_convert_to_bigint" := NEW."note_id";
RETURN NEW;
END;
$$;
CREATE FUNCTION trigger_17c3a95ee58a() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
NEW."note_id_convert_to_bigint" := NEW."note_id";
RETURN NEW;
END;
$$;
CREATE FUNCTION trigger_1a857e8db6cd() RETURNS trigger
LANGUAGE plpgsql
AS $$
@ -282,51 +264,6 @@ BEGIN
END;
$$;
CREATE FUNCTION trigger_3dc62927cae8() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
NEW."note_id_convert_to_bigint" := NEW."note_id";
RETURN NEW;
END;
$$;
CREATE FUNCTION trigger_428d92773fe7() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
NEW."note_id_convert_to_bigint" := NEW."note_id";
RETURN NEW;
END;
$$;
CREATE FUNCTION trigger_482bac5ec48a() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
NEW."note_id_convert_to_bigint" := NEW."note_id";
RETURN NEW;
END;
$$;
CREATE FUNCTION trigger_775287b6d67a() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
NEW."diff_note_id_convert_to_bigint" := NEW."diff_note_id";
RETURN NEW;
END;
$$;
CREATE FUNCTION trigger_909cf0a06094() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
NEW."awardable_id_convert_to_bigint" := NEW."awardable_id";
RETURN NEW;
END;
$$;
CREATE FUNCTION trigger_b2d852e1e2cb() RETURNS trigger
LANGUAGE plpgsql
AS $$
@ -336,42 +273,6 @@ BEGIN
END;
$$;
CREATE FUNCTION trigger_bfc6e47be8cc() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
NEW."note_id_convert_to_bigint" := NEW."note_id";
RETURN NEW;
END;
$$;
CREATE FUNCTION trigger_bfcbace4260d() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
NEW."note_id_convert_to_bigint" := NEW."note_id";
RETURN NEW;
END;
$$;
CREATE FUNCTION trigger_c2051020aa8b() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
NEW."note_id_convert_to_bigint" := NEW."note_id";
RETURN NEW;
END;
$$;
CREATE FUNCTION trigger_c5a5f48f12b0() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
NEW."note_id_convert_to_bigint" := NEW."note_id";
RETURN NEW;
END;
$$;
CREATE FUNCTION trigger_cd1aeb22b34a() RETURNS trigger
LANGUAGE plpgsql
AS $$
@ -381,24 +282,6 @@ BEGIN
END;
$$;
CREATE FUNCTION trigger_dca935e3a712() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
NEW."note_id_convert_to_bigint" := NEW."note_id";
RETURN NEW;
END;
$$;
CREATE FUNCTION trigger_ee7956d805e6() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
NEW."note_id_convert_to_bigint" := NEW."note_id";
RETURN NEW;
END;
$$;
CREATE FUNCTION unset_has_issues_on_vulnerability_reads() RETURNS trigger
LANGUAGE plpgsql
AS $$
@ -10758,6 +10641,26 @@ CREATE TABLE gitlab_partitions_static.product_analytics_events_experimental_63 (
);
ALTER TABLE ONLY product_analytics_events_experimental ATTACH PARTITION gitlab_partitions_static.product_analytics_events_experimental_63 FOR VALUES WITH (modulus 64, remainder 63);
CREATE TABLE abuse_events (
id bigint NOT NULL,
user_id bigint,
created_at timestamp with time zone NOT NULL,
updated_at timestamp with time zone NOT NULL,
abuse_report_id bigint,
source smallint NOT NULL,
category smallint,
metadata jsonb
);
CREATE SEQUENCE abuse_events_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE abuse_events_id_seq OWNED BY abuse_events.id;
CREATE TABLE abuse_report_events (
id bigint NOT NULL,
abuse_report_id bigint NOT NULL,
@ -12356,7 +12259,6 @@ CREATE TABLE award_emoji (
id integer NOT NULL,
name character varying,
user_id integer,
awardable_id_convert_to_bigint integer,
awardable_type character varying,
created_at timestamp without time zone,
updated_at timestamp without time zone,
@ -14501,7 +14403,6 @@ ALTER SEQUENCE clusters_kubernetes_namespaces_id_seq OWNED BY clusters_kubernete
CREATE TABLE commit_user_mentions (
id bigint NOT NULL,
note_id_convert_to_bigint integer DEFAULT 0 NOT NULL,
mentioned_users_ids integer[],
mentioned_projects_ids integer[],
mentioned_groups_ids integer[],
@ -15446,7 +15347,6 @@ ALTER SEQUENCE design_management_versions_id_seq OWNED BY design_management_vers
CREATE TABLE design_user_mentions (
id bigint NOT NULL,
design_id integer NOT NULL,
note_id_convert_to_bigint integer DEFAULT 0 NOT NULL,
mentioned_users_ids integer[],
mentioned_projects_ids integer[],
mentioned_groups_ids integer[],
@ -15797,7 +15697,6 @@ ALTER SEQUENCE epic_metrics_id_seq OWNED BY epic_metrics.id;
CREATE TABLE epic_user_mentions (
id bigint NOT NULL,
epic_id integer NOT NULL,
note_id_convert_to_bigint integer,
mentioned_users_ids integer[],
mentioned_projects_ids integer[],
mentioned_groups_ids integer[],
@ -17462,7 +17361,6 @@ ALTER SEQUENCE issue_tracker_data_id_seq OWNED BY issue_tracker_data.id;
CREATE TABLE issue_user_mentions (
id bigint NOT NULL,
issue_id integer NOT NULL,
note_id_convert_to_bigint integer,
mentioned_users_ids integer[],
mentioned_projects_ids integer[],
mentioned_groups_ids integer[],
@ -18302,7 +18200,6 @@ ALTER SEQUENCE merge_request_reviewers_id_seq OWNED BY merge_request_reviewers.i
CREATE TABLE merge_request_user_mentions (
id bigint NOT NULL,
merge_request_id integer NOT NULL,
note_id_convert_to_bigint integer,
mentioned_users_ids integer[],
mentioned_projects_ids integer[],
mentioned_groups_ids integer[],
@ -18924,7 +18821,6 @@ ALTER SEQUENCE namespaces_sync_events_id_seq OWNED BY namespaces_sync_events.id;
CREATE TABLE note_diff_files (
id integer NOT NULL,
diff_note_id_convert_to_bigint integer DEFAULT 0 NOT NULL,
diff text NOT NULL,
new_file boolean NOT NULL,
renamed_file boolean NOT NULL,
@ -22840,7 +22736,6 @@ CREATE TABLE snippet_statistics (
CREATE TABLE snippet_user_mentions (
id bigint NOT NULL,
snippet_id integer NOT NULL,
note_id_convert_to_bigint integer,
mentioned_users_ids integer[],
mentioned_projects_ids integer[],
mentioned_groups_ids integer[],
@ -23113,7 +23008,6 @@ ALTER SEQUENCE subscriptions_id_seq OWNED BY subscriptions.id;
CREATE TABLE suggestions (
id bigint NOT NULL,
note_id_convert_to_bigint integer DEFAULT 0 NOT NULL,
relative_order smallint NOT NULL,
applied boolean DEFAULT false NOT NULL,
commit_id character varying,
@ -23136,7 +23030,6 @@ ALTER SEQUENCE suggestions_id_seq OWNED BY suggestions.id;
CREATE TABLE system_note_metadata (
id integer NOT NULL,
note_id_convert_to_bigint integer DEFAULT 0 NOT NULL,
commit_count integer,
action character varying,
created_at timestamp without time zone NOT NULL,
@ -23296,7 +23189,6 @@ CREATE TABLE timelogs (
issue_id integer,
merge_request_id integer,
spent_at timestamp without time zone DEFAULT now(),
note_id_convert_to_bigint integer,
project_id integer,
summary text,
note_id bigint,
@ -23323,7 +23215,6 @@ CREATE TABLE todos (
state character varying NOT NULL,
created_at timestamp without time zone,
updated_at timestamp without time zone,
note_id_convert_to_bigint integer,
commit_id character varying,
group_id integer,
resolved_by_action smallint,
@ -24523,7 +24414,6 @@ ALTER SEQUENCE vulnerability_statistics_id_seq OWNED BY vulnerability_statistics
CREATE TABLE vulnerability_user_mentions (
id bigint NOT NULL,
vulnerability_id bigint NOT NULL,
note_id_convert_to_bigint integer,
mentioned_users_ids integer[],
mentioned_projects_ids integer[],
mentioned_groups_ids integer[],
@ -24941,6 +24831,8 @@ CREATE SEQUENCE zoom_meetings_id_seq
ALTER SEQUENCE zoom_meetings_id_seq OWNED BY zoom_meetings.id;
ALTER TABLE ONLY abuse_events ALTER COLUMN id SET DEFAULT nextval('abuse_events_id_seq'::regclass);
ALTER TABLE ONLY abuse_report_events ALTER COLUMN id SET DEFAULT nextval('abuse_report_events_id_seq'::regclass);
ALTER TABLE ONLY abuse_reports ALTER COLUMN id SET DEFAULT nextval('abuse_reports_id_seq'::regclass);
@ -26657,6 +26549,9 @@ ALTER TABLE ONLY gitlab_partitions_static.product_analytics_events_experimental_
ALTER TABLE ONLY gitlab_partitions_static.product_analytics_events_experimental_63
ADD CONSTRAINT product_analytics_events_experimental_63_pkey PRIMARY KEY (id, project_id);
ALTER TABLE ONLY abuse_events
ADD CONSTRAINT abuse_events_pkey PRIMARY KEY (id);
ALTER TABLE ONLY abuse_report_events
ADD CONSTRAINT abuse_report_events_pkey PRIMARY KEY (id);
@ -30000,6 +29895,12 @@ CREATE INDEX idx_vulnerability_reads_project_id_scanner_id_vulnerability_id ON v
CREATE UNIQUE INDEX idx_work_item_types_on_namespace_id_and_name_null_namespace ON work_item_types USING btree (btrim(lower(name)), ((namespace_id IS NULL))) WHERE (namespace_id IS NULL);
CREATE INDEX index_abuse_events_on_abuse_report_id ON abuse_events USING btree (abuse_report_id);
CREATE INDEX index_abuse_events_on_category_and_source ON abuse_events USING btree (category, source);
CREATE INDEX index_abuse_events_on_user_id ON abuse_events USING btree (user_id);
CREATE INDEX index_abuse_report_events_on_abuse_report_id ON abuse_report_events USING btree (abuse_report_id);
CREATE INDEX index_abuse_report_events_on_user_id ON abuse_report_events USING btree (user_id);
@ -35156,40 +35057,14 @@ CREATE TRIGGER trigger_023e82d8e257 BEFORE INSERT OR UPDATE ON ci_pipeline_varia
CREATE TRIGGER trigger_080e73845bfd BEFORE INSERT OR UPDATE ON notes FOR EACH ROW EXECUTE FUNCTION trigger_080e73845bfd();
CREATE TRIGGER trigger_0e214b8a14f2 BEFORE INSERT OR UPDATE ON vulnerability_user_mentions FOR EACH ROW EXECUTE FUNCTION trigger_0e214b8a14f2();
CREATE TRIGGER trigger_17c3a95ee58a BEFORE INSERT OR UPDATE ON commit_user_mentions FOR EACH ROW EXECUTE FUNCTION trigger_17c3a95ee58a();
CREATE TRIGGER trigger_1a857e8db6cd BEFORE INSERT OR UPDATE ON vulnerability_occurrences FOR EACH ROW EXECUTE FUNCTION trigger_1a857e8db6cd();
CREATE TRIGGER trigger_3dc62927cae8 BEFORE INSERT OR UPDATE ON design_user_mentions FOR EACH ROW EXECUTE FUNCTION trigger_3dc62927cae8();
CREATE TRIGGER trigger_428d92773fe7 BEFORE INSERT OR UPDATE ON timelogs FOR EACH ROW EXECUTE FUNCTION trigger_428d92773fe7();
CREATE TRIGGER trigger_482bac5ec48a BEFORE INSERT OR UPDATE ON system_note_metadata FOR EACH ROW EXECUTE FUNCTION trigger_482bac5ec48a();
CREATE TRIGGER trigger_775287b6d67a BEFORE INSERT OR UPDATE ON note_diff_files FOR EACH ROW EXECUTE FUNCTION trigger_775287b6d67a();
CREATE TRIGGER trigger_909cf0a06094 BEFORE INSERT OR UPDATE ON award_emoji FOR EACH ROW EXECUTE FUNCTION trigger_909cf0a06094();
CREATE TRIGGER trigger_b2d852e1e2cb BEFORE INSERT OR UPDATE ON ci_pipelines FOR EACH ROW EXECUTE FUNCTION trigger_b2d852e1e2cb();
CREATE TRIGGER trigger_bfc6e47be8cc BEFORE INSERT OR UPDATE ON snippet_user_mentions FOR EACH ROW EXECUTE FUNCTION trigger_bfc6e47be8cc();
CREATE TRIGGER trigger_bfcbace4260d BEFORE INSERT OR UPDATE ON merge_request_user_mentions FOR EACH ROW EXECUTE FUNCTION trigger_bfcbace4260d();
CREATE TRIGGER trigger_c2051020aa8b BEFORE INSERT OR UPDATE ON issue_user_mentions FOR EACH ROW EXECUTE FUNCTION trigger_c2051020aa8b();
CREATE TRIGGER trigger_c5a5f48f12b0 BEFORE INSERT OR UPDATE ON epic_user_mentions FOR EACH ROW EXECUTE FUNCTION trigger_c5a5f48f12b0();
CREATE TRIGGER trigger_cd1aeb22b34a BEFORE INSERT OR UPDATE ON events FOR EACH ROW EXECUTE FUNCTION trigger_cd1aeb22b34a();
CREATE TRIGGER trigger_dca935e3a712 BEFORE INSERT OR UPDATE ON todos FOR EACH ROW EXECUTE FUNCTION trigger_dca935e3a712();
CREATE TRIGGER trigger_delete_project_namespace_on_project_delete AFTER DELETE ON projects FOR EACH ROW WHEN ((old.project_namespace_id IS NOT NULL)) EXECUTE FUNCTION delete_associated_project_namespace();
CREATE TRIGGER trigger_ee7956d805e6 BEFORE INSERT OR UPDATE ON suggestions FOR EACH ROW EXECUTE FUNCTION trigger_ee7956d805e6();
CREATE TRIGGER trigger_has_external_issue_tracker_on_delete AFTER DELETE ON integrations FOR EACH ROW WHEN ((((old.category)::text = 'issue_tracker'::text) AND (old.active = true) AND (old.project_id IS NOT NULL))) EXECUTE FUNCTION set_has_external_issue_tracker();
CREATE TRIGGER trigger_has_external_issue_tracker_on_insert AFTER INSERT ON integrations FOR EACH ROW WHEN ((((new.category)::text = 'issue_tracker'::text) AND (new.active = true) AND (new.project_id IS NOT NULL))) EXECUTE FUNCTION set_has_external_issue_tracker();
@ -36171,6 +36046,9 @@ ALTER TABLE p_ci_builds_metadata
ALTER TABLE ONLY gitlab_subscriptions
ADD CONSTRAINT fk_e2595d00a1 FOREIGN KEY (namespace_id) REFERENCES namespaces(id) ON DELETE CASCADE;
ALTER TABLE ONLY abuse_events
ADD CONSTRAINT fk_e5ce49c215 FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL;
ALTER TABLE ONLY merge_requests
ADD CONSTRAINT fk_e719a85f8a FOREIGN KEY (author_id) REFERENCES users(id) ON DELETE SET NULL;
@ -36888,6 +36766,9 @@ ALTER TABLE ONLY analytics_cycle_analytics_group_value_streams
ALTER TABLE ONLY geo_node_namespace_links
ADD CONSTRAINT fk_rails_546bf08d3e FOREIGN KEY (geo_node_id) REFERENCES geo_nodes(id) ON DELETE CASCADE;
ALTER TABLE ONLY abuse_events
ADD CONSTRAINT fk_rails_55101e588c FOREIGN KEY (abuse_report_id) REFERENCES abuse_reports(id);
ALTER TABLE ONLY issuable_metric_images
ADD CONSTRAINT fk_rails_56417a5a7f FOREIGN KEY (issue_id) REFERENCES issues(id) ON DELETE CASCADE;
@ -38080,37 +37961,37 @@ ALTER TABLE product_analytics_events_experimental
ADD CONSTRAINT product_analytics_events_experimental_project_id_fkey FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
ALTER TABLE ONLY ci_build_pending_states
ADD CONSTRAINT temp_fk_861cd17da3_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE NOT VALID;
ADD CONSTRAINT temp_fk_861cd17da3_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE ONLY ci_build_trace_chunks
ADD CONSTRAINT temp_fk_89e29fa5ee_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE NOT VALID;
ADD CONSTRAINT temp_fk_89e29fa5ee_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE ONLY ci_unit_test_failures
ADD CONSTRAINT temp_fk_9e0fc58930_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE NOT VALID;
ADD CONSTRAINT temp_fk_9e0fc58930_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE ONLY ci_sources_pipelines
ADD CONSTRAINT temp_fk_be5624bf37_p FOREIGN KEY (source_partition_id, source_job_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE NOT VALID;
ADD CONSTRAINT temp_fk_be5624bf37_p FOREIGN KEY (source_partition_id, source_job_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE ONLY ci_resources
ADD CONSTRAINT temp_fk_e169a8e3d5_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE SET NULL NOT VALID;
ADD CONSTRAINT temp_fk_e169a8e3d5_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE SET NULL;
ALTER TABLE ONLY ci_builds_metadata
ADD CONSTRAINT temp_fk_e20479742e_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE NOT VALID;
ALTER TABLE ONLY ci_build_report_results
ADD CONSTRAINT temp_fk_rails_16cb1ff064_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE NOT VALID;
ADD CONSTRAINT temp_fk_rails_16cb1ff064_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE ONLY ci_build_needs
ADD CONSTRAINT temp_fk_rails_3cf221d4ed_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE NOT VALID;
ADD CONSTRAINT temp_fk_rails_3cf221d4ed_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE ONLY ci_builds_runner_session
ADD CONSTRAINT temp_fk_rails_70707857d3_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE NOT VALID;
ADD CONSTRAINT temp_fk_rails_70707857d3_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE ONLY ci_pending_builds
ADD CONSTRAINT temp_fk_rails_725a2644a3_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE NOT VALID;
ADD CONSTRAINT temp_fk_rails_725a2644a3_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE ONLY ci_build_trace_metadata
ADD CONSTRAINT temp_fk_rails_aebc78111f_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE NOT VALID;
ADD CONSTRAINT temp_fk_rails_aebc78111f_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE ONLY ci_job_artifacts
ADD CONSTRAINT temp_fk_rails_c5137cb2c1_p FOREIGN KEY (partition_id, job_id) REFERENCES p_ci_builds(partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE NOT VALID;

View File

@ -406,7 +406,8 @@ domain as a custom domain to their project.
If your user base is private or otherwise trusted, you can disable the
verification requirement:
1. On the top bar, select **Main menu > Admin**.
1. On the left sidebar, expand the top-most chevron (**{chevron-down}**).
1. Select **Admin Area**.
1. On the left sidebar, select **Settings > Preferences**.
1. Expand **Pages**.
1. Clear the **Require users to prove ownership of custom domains** checkbox.
@ -423,7 +424,8 @@ sites served under a custom domain.
To enable it:
1. Choose an email address on which you want to receive notifications about expiring domains.
1. On the top bar, select **Main menu > Admin**.
1. On the left sidebar, expand the top-most chevron (**{chevron-down}**).
1. Select **Admin Area**.
1. On the left sidebar, select **Settings > Preferences**.
1. Expand **Pages**.
1. Enter the email address for receiving notifications and accept Let's Encrypt's Terms of Service.
@ -476,8 +478,9 @@ pre-existing applications must modify the GitLab Pages OAuth application. Follow
this:
1. Enable [access control](#access-control).
1. On the top bar, select **Main menu > Admin**.
1. On the left sidebar, select **Settings > Applications**.
1. On the left sidebar, expand the top-most chevron (**{chevron-down}**).
1. Select **Admin Area**.
1. On the left sidebar, select **Applications**.
1. Expand **GitLab Pages**.
1. Clear the `api` scope's checkbox and select the desired scope's checkbox (for example,
`read_api`).
@ -495,7 +498,8 @@ This can be helpful to restrict information published with Pages websites to the
of your instance only.
To do that:
1. On the top bar, select **Main menu > Admin**.
1. On the left sidebar, expand the top-most chevron (**{chevron-down}**).
1. Select **Admin Area**.
1. On the left sidebar, select **Settings > Preferences**.
1. Expand **Pages**.
1. Select the **Disable public access to Pages sites** checkbox.
@ -664,7 +668,8 @@ Prerequisite:
To set the global maximum pages size for a project:
1. On the top bar, select **Main menu > Admin**.
1. On the left sidebar, expand the top-most chevron (**{chevron-down}**).
1. Select **Admin Area**.
1. On the left sidebar, select **Settings > Preferences**.
1. Expand **Pages**.
1. In **Maximum size of pages**, enter a value. The default is `100`.
@ -678,7 +683,7 @@ Prerequisite:
To set the maximum size of each GitLab Pages site in a group, overriding the inherited setting:
1. On the top bar, select **Main menu > Groups** and find your group.
1. On the left sidebar, at the top, select **Search GitLab** (**{search}**) to find your group.
1. On the left sidebar, select **Settings > General**.
1. Expand **Pages**.
1. Enter a value under **Maximum size** in MB.
@ -692,7 +697,7 @@ Prerequisite:
To set the maximum size of GitLab Pages site in a project, overriding the inherited setting:
1. On the top bar, select **Main menu > Projects** and find your project.
1. On the left sidebar, at the top, select **Search GitLab** (**{search}**) to find your project.
1. On the left sidebar, select **Settings > Pages**.
If this path is not visible, select **Deployments > Pages**.
@ -708,7 +713,8 @@ Prerequisite:
To set the maximum number of GitLab Pages custom domains for a project:
1. On the top bar, select **Main menu > Admin**.
1. On the left sidebar, expand the top-most chevron (**{chevron-down}**).
1. Select **Admin Area**.
1. On the left sidebar, select **Settings > Preferences**, and expand **Pages**.
1. Enter a value for **Maximum number of custom domains per project**. Use `0` for unlimited domains.
1. Select **Save changes**.

View File

@ -64,7 +64,7 @@ Authorization configuration can take one or two minutes to propagate.
To authorize the agent to access the GitLab project where you keep Kubernetes manifests:
1. On the top bar, select **Main menu > Projects** and find the project that contains the [agent configuration file](install/index.md#create-an-agent-configuration-file) (`config.yaml`).
1. On the left sidebar, at the top, select **Search GitLab** (**{search}**) to find the project that contains the [agent configuration file](install/index.md#create-an-agent-configuration-file) (`config.yaml`).
1. Edit the `config.yaml` file. Under the `ci_access` keyword, add the `projects` attribute.
1. For the `id`, add the path to the project. Do not wrap the path in quotation marks.
@ -89,7 +89,7 @@ Choose the context to run `kubectl` commands from your CI/CD scripts.
To authorize the agent to access all of the GitLab projects in a group or subgroup:
1. On the top bar, select **Main menu > Projects** and find the project that contains the [agent configuration file](install/index.md#create-an-agent-configuration-file) (`config.yaml`).
1. On the left sidebar, at the top, select **Search GitLab** (**{search}**) to find the project that contains the [agent configuration file](install/index.md#create-an-agent-configuration-file) (`config.yaml`).
1. Edit the `config.yaml` file. Under the `ci_access` keyword, add the `groups` attribute.
1. For the `id`, add the path:

View File

@ -80,10 +80,10 @@ Prerequisites:
You must register an agent before you can install the agent in your cluster. To register an agent:
1. On the top bar, select **Main menu > Projects** and find your project.
1. On the left sidebar, at the top, select **Search GitLab** (**{search}**) to find your project.
If you have an [agent configuration file](#create-an-agent-configuration-file),
it must be in this project. Your cluster manifest files should also be in this project.
1. From the left sidebar, select **Infrastructure > Kubernetes clusters**.
1. Select **Operate > Kubernetes clusters**.
1. Select **Connect a cluster (agent)**.
- If you want to create a configuration with CI/CD defaults, type a name.
- If you already have an [agent configuration file](#create-an-agent-configuration-file), select it from the list.

View File

@ -100,8 +100,8 @@ You can view the complete schema within the [scan execution policy documentation
To view vulnerability information in GitLab:
1. On the top bar, select **Main menu > Projects** and find the project that contains the agent configuration file.
1. On the left sidebar, select **Infrastructure > Kubernetes clusters**.
1. On the left sidebar, at the top, select **Search GitLab** (**{search}**) to find the project that contains the agent configuration file.
1. Select **Operate > Kubernetes clusters**.
1. Select the **Agent** tab.
1. Select an agent to view the cluster vulnerabilities.

View File

@ -18,9 +18,9 @@ Prerequisite:
To view the list of agents:
1. On the top bar, select **Main menu > Projects** and find the project that contains your agent configuration file.
1. On the left sidebar, at the top, select **Search GitLab** (**{search}**) to find the project that contains your agent configuration file.
You cannot view registered agents from a project that does not contain the agent configuration file.
1. On the left sidebar, select **Infrastructure > Kubernetes clusters**.
1. Select **Operate > Kubernetes clusters**.
1. Select **Agent** tab to view clusters connected to GitLab through the agent.
On this page, you can view:
@ -40,8 +40,8 @@ is shared with a project, it automatically appears in the project agent tab.
To view the list of shared agents:
1. On the top bar, select **Main menu > Projects** and find the project.
1. On the left sidebar, select **Infrastructure > Kubernetes clusters**.
1. On the left sidebar, at the top, select **Search GitLab** (**{search}**) to find your project.
1. Select **Operate > Kubernetes clusters**.
1. Select the **Agent** tab.
The list of shared agents and their clusters are displayed.
@ -54,8 +54,8 @@ The activity logs help you to identify problems and get the information
you need for troubleshooting. You can see events from a week before the
current date. To view an agent's activity:
1. On the top bar, select **Main menu > Projects** and find the project that contains your agent configuration file.
1. On the left sidebar, select **Infrastructure > Kubernetes clusters**.
1. On the left sidebar, at the top, select **Search GitLab** (**{search}**) to find the project that contains your agent configuration file.
1. Select **Operate > Kubernetes clusters**.
1. Select the agent you want to see activity for.
The activity list includes:
@ -114,8 +114,8 @@ An agent can have only two active tokens at one time.
To reset the agent token without downtime:
1. Create a new token:
1. On the top bar, select **Main menu > Projects** and find your project.
1. On the left sidebar, select **Infrastructure > Kubernetes clusters**.
1. On the left sidebar, at the top, select **Search GitLab** (**{search}**) to find your project.
1. Select **Operate > Kubernetes clusters**.
1. Select the agent you want to create a token for.
1. On the **Access tokens** tab, select **Create token**.
1. Enter token's name and description (optional) and select **Create token**.
@ -136,8 +136,8 @@ clean up those resources manually.
To remove an agent from the UI:
1. On the top bar, select **Main menu > Projects** and find the project that contains the agent configuration file.
1. From the left sidebar, select **Infrastructure > Kubernetes clusters**.
1. On the left sidebar, at the top, select **Search GitLab** (**{search}**) to find the project that contains the agent configuration file.
1. Select **Operate > Kubernetes clusters**.
1. In the table, in the row for your agent, in the **Options** column, select the vertical ellipsis (**{ellipsis_v}**).
1. Select **Delete agent**.

View File

@ -61,7 +61,10 @@ To associate a cluster management project with your cluster:
**Infrastructure > Kubernetes clusters** page.
- [Group-level cluster](../group/clusters/index.md), go to your group's **Kubernetes**
page.
- [Instance-level cluster](../instance/clusters/index.md), on the top bar, select **Main menu > Admin > Kubernetes**.
- [Instance-level cluster](../instance/clusters/index.md):
1. On the left sidebar, expand the top-most chevron (**{chevron-down}**).
1. Select **Admin Area**.
1. Select **Kubernetes**.
1. Expand **Advanced settings**.
1. From the **Cluster management project** dropdown list, select the cluster management project
you created in the previous step.

View File

@ -45,8 +45,7 @@ If you have already configured the agent and connected a cluster with GitLab:
To create a project from the cluster management project template:
1. In GitLab, on the top bar, select **Main menu > Projects > View all projects**.
1. On the right of the page, select **New project**.
1. On the left sidebar, at the top, select **Create new** (**{plus}**) and **New project/repository**.
1. Select **Create from template**.
1. From the list of templates, next to **GitLab Cluster Management**, select **Use template**.
1. Enter the project details.

View File

@ -222,7 +222,8 @@ To set health status of an OKR:
## Promote a key result to an objective
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/386877) in GitLab 16.0.
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/386877) in GitLab 16.0.
> - Quick action `/promote_to` [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/412534) in GitLab 16.1.
Prerequisites:
@ -234,6 +235,8 @@ To promote a key result:
1. In the top right corner, select the vertical ellipsis (**{ellipsis_v}**)..
1. Select **Promote to objective**.
Alternatively, use the `/promote_to objective` [quick action](../user/project/quick_actions.md).
## Close an OKR
When an OKR is achieved, you can close it.

View File

@ -164,6 +164,7 @@ The following quick actions can be applied through the description field when ed
| `/weight <value>` | **{check-circle}** Yes | **{dotted-circle}** No | **{dotted-circle}** No | Set weight. Valid options for `<value>` include `0`, `1`, and `2`.
| `/clear_weight` | **{check-circle}** Yes | **{dotted-circle}** No | **{dotted-circle}** No | Clear weight.
| `/type` | **{check-circle}** Yes | **{dotted-circle}** Yes | **{dotted-circle}** Yes | Converts work item to specified type. Available options for `<type>` include `Issue`, `Task`, `Objective` and `Key Result`. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/385227) in GitLab 16.0.
| `/promote_to <type>` | **{check-circle}** Yes | **{dotted-circle}** No | **{check-circle}** Yes | Promotes work item to specified type. Available options for `<type>`: `issue` (promote a task) and `objective` (promote a key result). [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/412534) in GitLab 16.1.
## Commit messages

View File

@ -134,6 +134,14 @@ In VS Code:
To confirm that your account is enabled, go to [https://gitlab.com/api/v4/ml/ai-assist](https://gitlab.com/api/v4/ml/ai-assist). A response of `user_is_allowed` should return `true`.
### Authentication troubleshooting
If the above steps do not solve your issue, the problem may be related to the recent changes in authentication, specifically the token system. To resolve the issue, please follow these troubleshooting steps:
- Remove the existing PAT from your GitLab account settings.
- Reauthorize your GitLab account in VSCode using OAuth.
- Test the code suggestions feature with different file extensions to verify if the issue is resolved.
## Stability and performance
This feature is currently in [Beta](/ee/policy/experiment-beta-support.md#beta).

View File

@ -130,6 +130,16 @@ To edit the description of a task:
1. Above the text box, select **Rich text**.
1. Make your changes, and select **Save**.
## Promote a task to an issue
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/412534) in GitLab 16.1.
Prerequisites:
- You must have at least the Reporter role for the project.
To promote a task to an issue, use the `/promote_to issue` [quick action](../user/project/quick_actions.md).
## Remove a task from an issue
Prerequisites:

View File

@ -14,37 +14,92 @@ module Gitlab
types WorkItem
params 'Task | Objective | Key Result | Issue'
command :type do |type_name|
work_item_type = ::WorkItems::Type.find_by_name(type_name)
errors = validate_type(work_item_type)
@execution_message[:type] = update_type(type_name, :type)
end
if errors.present?
@execution_message[:type] = errors
else
@updates[:issue_type] = work_item_type.base_type
@updates[:work_item_type] = work_item_type
@execution_message[:type] = _('Type changed successfully.')
end
desc { _('Promote work item') }
explanation do |type_name|
format(_("Promotes work item to %{type}."), type: type_name)
end
types WorkItem
params 'issue | objective'
condition { supports_promotion? }
command :promote_to do |type_name|
@execution_message[:promote_to] = update_type(type_name, :promote_to)
end
end
private
# rubocop:disable Gitlab/ModuleWithInstanceVariables
def update_type(type_name, command)
new_type = ::WorkItems::Type.find_by_name(type_name.titleize)
error_message = command == :type ? validate_type(new_type) : validate_promote_to(new_type)
return error_message if error_message.present?
@updates[:issue_type] = new_type.base_type
@updates[:work_item_type] = new_type
success_msg[command]
end
# rubocop:enable Gitlab/ModuleWithInstanceVariables
def validate_type(type)
return type_error(:not_found) unless type.present?
return type_error(:same_type) if quick_action_target.work_item_type == type
return type_error(:forbidden) unless current_user.can?(:"create_#{type.base_type}", quick_action_target)
return error_msg(:not_found) unless type.present?
return error_msg(:same_type) if quick_action_target.work_item_type == type
return error_msg(:forbidden) unless current_user.can?(:"create_#{type.base_type}", quick_action_target)
nil
end
def type_error(reason)
def validate_promote_to(type)
return error_msg(:not_found, action: 'promote') unless type && supports_promote_to?(type.name)
unless current_user.can?(:"create_#{type.base_type}", quick_action_target)
return error_msg(:forbidden, action: 'promote')
end
validate_hierarchy
end
def validate_hierarchy
return unless current_type.task? && quick_action_target.parent_link
error_msg(:hierarchy, action: 'promote')
end
def current_type
quick_action_target.work_item_type
end
def supports_promotion?
current_type.base_type.in?(promote_to_map.keys)
end
def supports_promote_to?(type_name)
type_name == promote_to_map[current_type.base_type]
end
def promote_to_map
{ issue: 'Incident', task: 'Issue' }.with_indifferent_access
end
def error_msg(reason, action: 'convert')
message = {
not_found: 'Provided type is not supported',
same_type: 'Types are the same',
forbidden: 'You have insufficient permissions'
forbidden: 'You have insufficient permissions',
hierarchy: 'A task cannot be promoted when a parent issue is present'
}.freeze
format(_("Failed to convert this work item: %{reason}."), { reason: message[reason] })
format(_("Failed to %{action} this work item: %{reason}."), { action: action, reason: message[reason] })
end
def success_msg
{
type: _('Type changed successfully.'),
promote_to: _("Work Item promoted successfully.")
}
end
end
end

View File

@ -135,3 +135,5 @@
aggregation: weekly
- name: i_quickactions_unlink
aggregation: weekly
- name: i_quickactions_promote_to
aggregation: weekly

View File

@ -9635,6 +9635,9 @@ msgstr ""
msgid "CiCatalog|This project will be marked as a CI/CD Catalog resource and will be visible in the CI/CD Catalog. This action is not reversible."
msgstr ""
msgid "CiCatalog|Unreleased"
msgstr ""
msgid "CiCatalog|We want to help you create and manage pipeline component repositories, while also making it easier to reuse pipeline configurations. Let us know how we're doing!"
msgstr ""
@ -18579,6 +18582,9 @@ msgstr[1] ""
msgid "Failed on"
msgstr ""
msgid "Failed to %{action} this work item: %{reason}."
msgstr ""
msgid "Failed to add a Zoom meeting"
msgstr ""
@ -18623,9 +18629,6 @@ msgstr ""
msgid "Failed to clone this issue: wrong parameters."
msgstr ""
msgid "Failed to convert this work item: %{reason}."
msgstr ""
msgid "Failed to create a branch for this issue. Please try again."
msgstr ""
@ -36748,6 +36751,9 @@ msgstr ""
msgid "Promote to objective"
msgstr ""
msgid "Promote work item"
msgstr ""
msgid "PromoteMilestone|Only project milestones can be promoted."
msgstr ""
@ -36763,6 +36769,9 @@ msgstr ""
msgid "Promotes issue to incident"
msgstr ""
msgid "Promotes work item to %{type}."
msgstr ""
msgid "Promotion is not supported."
msgstr ""
@ -51611,6 +51620,9 @@ msgstr ""
msgid "Won't fix / Accept risk"
msgstr ""
msgid "Work Item promoted successfully."
msgstr ""
msgid "Work Item type with id %{id} was not found"
msgstr ""
@ -53429,7 +53441,7 @@ msgstr ""
msgid "cannot be changed since member is associated with a custom role"
msgstr ""
msgid "cannot be changed to %{new_type} with %{parent_type} as parent type."
msgid "cannot be changed to %{new_type} when linked to a parent %{parent_type}."
msgstr ""
msgid "cannot be changed to %{new_type} with these child item types."

View File

@ -0,0 +1,13 @@
# frozen_string_literal: true
FactoryBot.define do
factory :abuse_event, class: 'Abuse::Event' do
user
category { :spam }
source { :spamcheck }
trait(:with_abuse_report) do
abuse_report
end
end
end

View File

@ -62,7 +62,7 @@ RSpec.describe BulkImports::Common::Pipelines::BoardsPipeline, feature_category:
it 'imports issue boards into destination project' do
expect { subject.run }.to change(::Board, :count).by(1)
board = project.boards.find_by(name: board_data["name"])
expect(board).to be
expect(board).to be_present
expect(board.project.id).to eq(project.id)
expect(board.lists.count).to eq(3)
expect(board.lists.map(&:list_type).sort).to match_array(%w(backlog closed label))
@ -87,7 +87,7 @@ RSpec.describe BulkImports::Common::Pipelines::BoardsPipeline, feature_category:
it 'imports issue boards into destination group' do
expect { subject.run }.to change(::Board, :count).by(1)
board = group.boards.find_by(name: board_data["name"])
expect(board).to be
expect(board).to be_present
expect(board.group.id).to eq(group.id)
expect(board.lists.count).to eq(3)
expect(board.lists.map(&:list_type).sort).to match_array(%w(backlog closed label))

View File

@ -107,7 +107,7 @@ RSpec.describe Gitlab::BackgroundMigration::BackfillSnippetRepositories, :migrat
last_commit = raw_repository(snippet).commit
aggregate_failures do
expect(blob).to be
expect(blob).to be_present
expect(blob.data).to eq content
expect(last_commit.author_name).to eq user.name
expect(last_commit.author_email).to eq user.email
@ -225,13 +225,13 @@ RSpec.describe Gitlab::BackgroundMigration::BackfillSnippetRepositories, :migrat
it 'converts invalid filenames' do
subject
expect(blob_at(snippet_with_invalid_path, converted_file_name)).to be
expect(blob_at(snippet_with_invalid_path, converted_file_name)).to be_present
end
it 'does not convert valid filenames on subsequent migrations' do
subject
expect(blob_at(snippet_with_valid_path, file_name)).to be
expect(blob_at(snippet_with_valid_path, file_name)).to be_present
end
end
end
@ -293,8 +293,8 @@ RSpec.describe Gitlab::BackgroundMigration::BackfillSnippetRepositories, :migrat
it 'updates the file_name only when it is invalid' do
subject
expect(blob_at(invalid_snippet, 'snippetfile1.txt')).to be
expect(blob_at(snippet, file_name)).to be
expect(blob_at(invalid_snippet, 'snippetfile1.txt')).to be_present
expect(blob_at(snippet, file_name)).to be_present
end
it_behaves_like 'migration_bot user commits files' do

View File

@ -33,7 +33,7 @@ RSpec.describe ::Gitlab::LetsEncrypt::Client do
saved_private_key = Gitlab::CurrentSettings.lets_encrypt_private_key
expect(saved_private_key).to be
expect(saved_private_key).to be_present
expect(Acme::Client).to have_received(:new).with(
hash_including(private_key: eq_pem(saved_private_key))
)

View File

@ -75,7 +75,7 @@ RSpec.describe Gitlab::SearchContext::Builder, type: :controller do
it 'delegates to `#with_group`' do
expect(builder).to receive(:with_group).with(project.group)
expect(context).to be
expect(context).to be_present
end
it { is_expected.to be_search_context(project: project, group: project.group) }

View File

@ -0,0 +1,48 @@
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Abuse::Event, type: :model, feature_category: :insider_threat do
let_it_be(:event) { create(:abuse_event) }
let_it_be(:user, reload: true) { create(:admin) }
subject { event }
it { is_expected.to be_valid }
describe "associations" do
it { is_expected.to belong_to(:user).class_name("User").inverse_of(:abuse_events) }
it { is_expected.to belong_to(:abuse_report).inverse_of(:abuse_events) }
end
describe "validations" do
it { is_expected.to validate_presence_of(:source) }
it { is_expected.to validate_presence_of(:category) }
it { is_expected.to validate_presence_of(:user).on(:create) }
end
describe 'enums' do
let(:categories) do
{
spam: 0, # spamcheck
virus: 1, # VirusTotal
fraud: 2, # Arkos, Telesign
ci_cd: 3 # PVS
}
end
let(:sources) do
{
spamcheck: 0,
virus_total: 1,
arkose_custom_score: 2,
arkose_global_score: 3,
telesign: 4,
pvs: 5
}
end
it { is_expected.to define_enum_for(:source).with_values(**sources) }
it { is_expected.to define_enum_for(:category).with_values(**categories) }
end
end

View File

@ -896,7 +896,7 @@ RSpec.describe Issuable do
let(:first_time_contributor_issue) { create(:issue, author: first_time_contributor, project: project) }
it "is false even without merged MR" do
expect(merged_mr).to be
expect(merged_mr).to be_present
expect(first_time_contributor_issue).not_to be_first_contribution
expect(contributor_issue).not_to be_first_contribution
end

View File

@ -88,7 +88,7 @@ RSpec.describe Identity do
it 'finds any extern uids associated with a provider' do
identity = described_class.with_any_extern_uid('test_provider').first
expect(identity).to be
expect(identity).to be_present
end
end

View File

@ -223,7 +223,7 @@ RSpec.describe SnippetRepository do
snippet_repository.multi_files_action(user, [new_file], **commit_opts)
expect(blob_at(snippet, default_name)).to be
expect(blob_at(snippet, default_name)).to be_present
end
it 'reuses the existing file name' do

View File

@ -161,6 +161,7 @@ RSpec.describe User, feature_category: :user_profile do
it { is_expected.to have_many(:reported_abuse_reports).dependent(:nullify).class_name('AbuseReport').inverse_of(:reporter) }
it { is_expected.to have_many(:assigned_abuse_reports).class_name('AbuseReport').inverse_of(:assignee) }
it { is_expected.to have_many(:resolved_abuse_reports).class_name('AbuseReport').inverse_of(:resolved_by) }
it { is_expected.to have_many(:abuse_events).class_name('Abuse::Event').inverse_of(:user) }
it { is_expected.to have_many(:custom_attributes).class_name('UserCustomAttribute') }
it { is_expected.to have_many(:releases).dependent(:nullify) }
it { is_expected.to have_many(:metrics_users_starred_dashboards).inverse_of(:user) }

View File

@ -132,7 +132,7 @@ RSpec.describe WorkItem, feature_category: :portfolio_management do
subject { work_item.supported_quick_action_commands }
it 'returns quick action commands supported for all work items' do
is_expected.to include(:title, :reopen, :close, :cc, :tableflip, :shrug, :type)
is_expected.to include(:title, :reopen, :close, :cc, :tableflip, :shrug, :type, :promote_to)
end
context 'when work item supports the assignee widget' do
@ -461,8 +461,13 @@ RSpec.describe WorkItem, feature_category: :portfolio_management do
it 'does not allow to change types' do
expect(child.valid?).to eq(false)
expect(child.errors[:work_item_type_id])
.to include("cannot be changed to #{new_type.name} with #{parent.work_item_type.name} as parent type.")
expect(child.errors[:work_item_type_id]).to include(
format(
"cannot be changed to %{type_name} when linked to a parent %{parent_name}.",
type_name: new_type.name.downcase,
parent_name: parent.work_item_type.name.downcase
)
)
end
end
end

View File

@ -0,0 +1,14 @@
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe WorkItemPresenter, feature_category: :portfolio_management do
let(:work_item) { build_stubbed(:work_item) }
it 'presents a work item and uses methods defined in IssuePresenter' do
user = build_stubbed(:user)
presenter = work_item.present(current_user: user)
expect(presenter.issue_path).to eq(presenter.web_path)
end
end

Some files were not shown because too many files have changed in this diff Show More