From 4717e30a236272bdee77735f310017d60b773b32 Mon Sep 17 00:00:00 2001
From: GitLab Bot
Date: Thu, 18 May 2023 15:07:09 +0000
Subject: Add latest changes from gitlab-org/gitlab@master
---
.../javascripts/ci/ci_lint/components/ci_lint.vue | 2 +-
.../security_configuration/components/app.vue | 11 ++---
.../components/auto_dev_ops_alert.vue | 2 +-
.../components/feature_card.vue | 6 +--
app/models/group.rb | 2 +-
app/models/packages/package.rb | 10 ++---
app/models/project.rb | 2 +-
app/models/user.rb | 4 ++
.../_create_protected_branch.html.haml | 4 +-
.../groups_tokens_optional_encryption.yml | 8 ----
.../projects_tokens_optional_encryption.yml | 8 ----
doc/user/profile/comment_templates.md | 8 ++--
lib/api/entities/package.rb | 2 +-
lib/api/entities/package_version.rb | 2 +-
locale/gitlab.pot | 3 ++
qa/qa/page/element.rb | 15 ++++---
qa/qa/page/project/secure/configuration_form.rb | 48 ++++++----------------
qa/qa/page/project/settings/protected_branches.rb | 6 +--
qa/spec/page/element_spec.rb | 8 +++-
spec/factories/projects.rb | 3 ++
.../frontend/ci/ci_lint/components/ci_lint_spec.js | 12 ++----
spec/models/packages/package_spec.rb | 6 +--
spec/models/user_spec.rb | 14 ++++++-
.../packages/detail/package_presenter_spec.rb | 2 +-
spec/requests/api/generic_packages_spec.rb | 4 +-
spec/requests/api/maven_packages_spec.rb | 2 +-
spec/requests/api/npm_project_packages_spec.rb | 2 +-
.../generic/find_or_create_package_service_spec.rb | 10 ++---
.../models/ci/token_format_shared_examples.rb | 6 ---
.../services/packages_shared_examples.rb | 4 +-
30 files changed, 95 insertions(+), 121 deletions(-)
delete mode 100644 config/feature_flags/development/groups_tokens_optional_encryption.yml
delete mode 100644 config/feature_flags/development/projects_tokens_optional_encryption.yml
diff --git a/app/assets/javascripts/ci/ci_lint/components/ci_lint.vue b/app/assets/javascripts/ci/ci_lint/components/ci_lint.vue
index 49a314e067c..39573b2180b 100644
--- a/app/assets/javascripts/ci/ci_lint/components/ci_lint.vue
+++ b/app/assets/javascripts/ci/ci_lint/components/ci_lint.vue
@@ -108,7 +108,7 @@ export default {
@click="lint"
>{{ __('Validate') }}
- {{ __('Simulate a pipeline created for the default branch') }}
@@ -196,12 +196,9 @@ export default {
{{ $options.i18n.description }}
- {{ $options.i18n.configurationHistory }}
+ {{
+ $options.i18n.configurationHistory
+ }}
diff --git a/app/assets/javascripts/security_configuration/components/auto_dev_ops_alert.vue b/app/assets/javascripts/security_configuration/components/auto_dev_ops_alert.vue
index 315f676e659..c01df3573c5 100644
--- a/app/assets/javascripts/security_configuration/components/auto_dev_ops_alert.vue
+++ b/app/assets/javascripts/security_configuration/components/auto_dev_ops_alert.vue
@@ -28,7 +28,7 @@ export default {
variant="info"
:primary-button-link="autoDevopsPath"
:primary-button-text="$options.i18n.primaryButtonText"
- data-qa-selector="autodevops_container"
+ data-testid="autodevops-container"
@dismiss="dismissMethod"
>
diff --git a/app/assets/javascripts/security_configuration/components/feature_card.vue b/app/assets/javascripts/security_configuration/components/feature_card.vue
index d1b705fe2fc..467b3e66dd4 100644
--- a/app/assets/javascripts/security_configuration/components/feature_card.vue
+++ b/app/assets/javascripts/security_configuration/components/feature_card.vue
@@ -122,7 +122,7 @@ export default {
v-if="isNotSastIACTemporaryHack"
:class="statusClasses"
data-testid="feature-status"
- :data-qa-selector="`${feature.type}_status`"
+ :data-qa-feature="`${feature.type}_${hasEnabledStatus}_status`"
>
{{ configurationButton.text }}
@@ -176,7 +176,7 @@ export default {
variant="confirm"
:category="manageViaMrButtonCategory"
class="gl-mt-5"
- :data-qa-selector="`${feature.type}_mr_button`"
+ :data-testid="`${feature.type}_mr_button`"
@error="onError"
/>
diff --git a/app/models/group.rb b/app/models/group.rb
index ab8e0101684..1c73dc0f5b2 100644
--- a/app/models/group.rb
+++ b/app/models/group.rb
@@ -160,7 +160,7 @@ class Group < Namespace
validates :group_feature, presence: true
add_authentication_token_field :runners_token,
- encrypted: -> { Feature.enabled?(:groups_tokens_optional_encryption) ? :optional : :required },
+ encrypted: :required,
format_with_prefix: :runners_token_prefix,
require_prefix_for_validation: true
diff --git a/app/models/packages/package.rb b/app/models/packages/package.rb
index 82157e48b0b..a715277a787 100644
--- a/app/models/packages/package.rb
+++ b/app/models/packages/package.rb
@@ -297,16 +297,14 @@ class Packages::Package < ApplicationRecord
end
# Technical debt: to be removed in https://gitlab.com/gitlab-org/gitlab/-/issues/281937
- # TODO: rename the method https://gitlab.com/gitlab-org/gitlab/-/issues/410352
- def original_build_info
- strong_memoize(:original_build_info) do
- build_infos.last
- end
+ def last_build_info
+ build_infos.last
end
+ strong_memoize_attr :last_build_info
# Technical debt: to be removed in https://gitlab.com/gitlab-org/gitlab/-/issues/281937
def pipeline
- original_build_info&.pipeline
+ last_build_info&.pipeline
end
def tag_names
diff --git a/app/models/project.rb b/app/models/project.rb
index 224193fba08..bd341b83482 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -111,7 +111,7 @@ class Project < ApplicationRecord
attribute :ci_config_path, default: -> { Gitlab::CurrentSettings.default_ci_config_path }
add_authentication_token_field :runners_token,
- encrypted: -> { Feature.enabled?(:projects_tokens_optional_encryption) ? :optional : :required },
+ encrypted: :required,
format_with_prefix: :runners_token_prefix,
require_prefix_for_validation: true
diff --git a/app/models/user.rb b/app/models/user.rb
index 8075affdf03..1bd0dbd5d5f 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -1667,7 +1667,11 @@ class User < ApplicationRecord
is_deleting_own_record = deleted_by.id == id
if is_deleting_own_record && ::Feature.enabled?(:delay_delete_own_user)
+ new_note = format(_("User deleted own account on %{timestamp}"), timestamp: Time.zone.now)
+ self.note = "#{new_note}\n#{note}".strip
+
block
+
DeleteUserWorker.perform_in(DELETION_DELAY_IN_DAYS, deleted_by.id, id, params.to_h)
else
block if params[:hard_delete]
diff --git a/app/views/protected_branches/_create_protected_branch.html.haml b/app/views/protected_branches/_create_protected_branch.html.haml
index b4765ab49c2..799f6aa6031 100644
--- a/app/views/protected_branches/_create_protected_branch.html.haml
+++ b/app/views/protected_branches/_create_protected_branch.html.haml
@@ -3,12 +3,12 @@
= dropdown_tag(_('Select'),
options: { toggle_class: 'js-allowed-to-merge wide',
dropdown_class: 'dropdown-menu-selectable capitalize-header', dropdown_qa_selector: 'allowed_to_merge_dropdown_content', dropdown_testid: 'allowed-to-merge-dropdown',
- data: { field_name: 'protected_branch[merge_access_levels_attributes][0][access_level]', input_id: 'merge_access_levels_attributes', qa_selector: 'allowed_to_merge_dropdown' }})
+ data: { field_name: 'protected_branch[merge_access_levels_attributes][0][access_level]', input_id: 'merge_access_levels_attributes', qa_selector: 'select_allowed_to_merge_dropdown' }})
- content_for :push_access_levels do
.push_access_levels-container
= dropdown_tag(_('Select'),
options: { toggle_class: "js-allowed-to-push js-multiselect wide",
dropdown_class: 'dropdown-menu-selectable capitalize-header', dropdown_qa_selector: 'allowed_to_push_dropdown_content' , dropdown_testid: 'allowed-to-push-dropdown',
- data: { field_name: 'protected_branch[push_access_levels_attributes][0][access_level]', input_id: 'push_access_levels_attributes', qa_selector: 'allowed_to_push_dropdown' }})
+ data: { field_name: 'protected_branch[push_access_levels_attributes][0][access_level]', input_id: 'push_access_levels_attributes', qa_selector: 'select_allowed_to_push_dropdown' }})
= render 'protected_branches/shared/create_protected_branch', protected_branch_entity: protected_branch_entity
diff --git a/config/feature_flags/development/groups_tokens_optional_encryption.yml b/config/feature_flags/development/groups_tokens_optional_encryption.yml
deleted file mode 100644
index 4f67ea4bd6c..00000000000
--- a/config/feature_flags/development/groups_tokens_optional_encryption.yml
+++ /dev/null
@@ -1,8 +0,0 @@
----
-name: groups_tokens_optional_encryption
-introduced_by_url: https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/25532
-rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/333862
-milestone: '11.9'
-type: development
-group: group::runner
-default_enabled: false
diff --git a/config/feature_flags/development/projects_tokens_optional_encryption.yml b/config/feature_flags/development/projects_tokens_optional_encryption.yml
deleted file mode 100644
index c35becd87ab..00000000000
--- a/config/feature_flags/development/projects_tokens_optional_encryption.yml
+++ /dev/null
@@ -1,8 +0,0 @@
----
-name: projects_tokens_optional_encryption
-introduced_by_url: https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/25532
-rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/333864
-milestone: '11.9'
-type: development
-group: group::runner
-default_enabled: false
diff --git a/doc/user/profile/comment_templates.md b/doc/user/profile/comment_templates.md
index fed12454663..7ae2f9c3173 100644
--- a/doc/user/profile/comment_templates.md
+++ b/doc/user/profile/comment_templates.md
@@ -9,11 +9,11 @@ type: howto
> - GraphQL support [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/352956) in GitLab 14.9 [with a flag](../../administration/feature_flags.md) named `saved_replies`. Disabled by default.
> - User interface [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/113232) in GitLab 15.10 [with a flag](../../administration/feature_flags.md) named `saved_replies`. Disabled by default. Enabled for GitLab team members only.
-> - [Enabled by default](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/119468) in GitLab 16.0.
+> - [Enabled on GitLab.com and self-managed](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/119468) in GitLab 16.0.
FLAG:
-On self-managed GitLab, by default this feature is not available. To make it available, ask an administrator to [enable the feature flag](../../administration/feature_flags.md) named `saved_replies`.
-On GitLab.com, this feature is not available by default, but enabled for GitLab team members.
+On self-managed GitLab, by default this feature is available. To hide the feature, ask an administrator to [disable the feature flag](../../administration/feature_flags.md) named `saved_replies`.
+On GitLab.com, this feature is available.
With comment templates, create and reuse text for any text area in:
@@ -27,8 +27,6 @@ or large, like chunks of boilerplate text you use frequently:
![Comment templates dropdown list](img/saved_replies_dropdown_v16_0.png)
-For more information about the rollout plan for this feature, see [issue 352956](https://gitlab.com/gitlab-org/gitlab/-/issues/352956).
-
## Use comment templates in a text area
To include the text of a comment template in your comment:
diff --git a/lib/api/entities/package.rb b/lib/api/entities/package.rb
index ab6cc0fcb0a..5831fe68a5d 100644
--- a/lib/api/entities/package.rb
+++ b/lib/api/entities/package.rb
@@ -43,7 +43,7 @@ module API
end
expose :tags
- expose :pipeline, if: ->(package) { package.original_build_info }, using: Package::Pipeline
+ expose :pipeline, if: ->(package) { package.last_build_info }, using: Package::Pipeline
expose :pipelines, if: ->(package) { package.pipelines.present? }, using: Package::Pipeline
expose :versions, using: ::API::Entities::PackageVersion, unless: ->(_, opts) { opts[:collection] }
diff --git a/lib/api/entities/package_version.rb b/lib/api/entities/package_version.rb
index 82522d3f423..417d8755144 100644
--- a/lib/api/entities/package_version.rb
+++ b/lib/api/entities/package_version.rb
@@ -8,7 +8,7 @@ module API
expose :created_at
expose :tags
- expose :pipeline, if: ->(package) { package.original_build_info }, using: Package::Pipeline
+ expose :pipeline, if: ->(package) { package.last_build_info }, using: Package::Pipeline
end
end
end
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index 1f5a89cfd48..f098c24695f 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -48724,6 +48724,9 @@ msgstr ""
msgid "User created at"
msgstr ""
+msgid "User deleted own account on %{timestamp}"
+msgstr ""
+
msgid "User does not have a pending request"
msgstr ""
diff --git a/qa/qa/page/element.rb b/qa/qa/page/element.rb
index 6bfdf98587b..27886934e2e 100644
--- a/qa/qa/page/element.rb
+++ b/qa/qa/page/element.rb
@@ -13,9 +13,7 @@ module QA
@attributes[:pattern] ||= selector
options.each do |option|
- if option.is_a?(String) || option.is_a?(Regexp)
- @attributes[:pattern] = option
- end
+ @attributes[:pattern] = option if option.is_a?(String) || option.is_a?(Regexp)
end
end
@@ -28,7 +26,7 @@ module QA
end
def selector_css
- %Q([data-qa-selector="#{@name}"]#{additional_selectors},.#{selector})
+ %(#{qa_selector},.#{selector})
end
def expression
@@ -40,14 +38,19 @@ module QA
end
def matches?(line)
- !!(line =~ /["']#{name}['"]|#{expression}/)
+ !!(line =~ /["']#{name}['"]|["']#{name.to_s.tr('_', '-')}['"]|#{expression}/)
end
private
+ def qa_selector
+ %([data-testid="#{@name}"]#{additional_selectors},[data-testid="#{@name.to_s.tr('_',
+ '-')}"]#{additional_selectors},[data-qa-selector="#{@name}"]#{additional_selectors})
+ end
+
def additional_selectors
@attributes.dup.delete_if { |attr| attr == :pattern || attr == :required }.map do |key, value|
- %Q([data-qa-#{key.to_s.tr('_', '-')}="#{value}"])
+ %([data-qa-#{key.to_s.tr('_', '-')}="#{value}"])
end.join
end
end
diff --git a/qa/qa/page/project/secure/configuration_form.rb b/qa/qa/page/project/secure/configuration_form.rb
index 493ec08d023..70eff31bfa9 100644
--- a/qa/qa/page/project/secure/configuration_form.rb
+++ b/qa/qa/page/project/secure/configuration_form.rb
@@ -9,15 +9,13 @@ module QA
view 'app/assets/javascripts/security_configuration/components/app.vue' do
element :security_configuration_container
- element :security_configuration_history_link
+ element :security_view_history_link
end
view 'app/assets/javascripts/security_configuration/components/feature_card.vue' do
- element :dependency_scanning_status, "`${feature.type}_status`" # rubocop:disable QA/ElementWithPattern
- element :sast_status, "`${feature.type}_status`" # rubocop:disable QA/ElementWithPattern
+ element :feature_status
element :sast_enable_button, "`${feature.type}_enable_button`" # rubocop:disable QA/ElementWithPattern
element :dependency_scanning_mr_button, "`${feature.type}_mr_button`" # rubocop:disable QA/ElementWithPattern
- element :license_scanning_status, "`${feature.type}_status`" # rubocop:disable QA/ElementWithPattern
end
view 'app/assets/javascripts/security_configuration/components/auto_dev_ops_alert.vue' do
@@ -25,15 +23,15 @@ module QA
end
def has_security_configuration_history_link?
- has_element?(:security_configuration_history_link)
+ has_element?(:security_view_history_link)
end
def has_no_security_configuration_history_link?
- has_no_element?(:security_configuration_history_link)
+ has_no_element?(:security_view_history_link)
end
def click_security_configuration_history_link
- click_element(:security_configuration_history_link)
+ click_element(:security_view_history_link)
end
def click_sast_enable_button
@@ -44,40 +42,20 @@ module QA
click_element(:dependency_scanning_mr_button)
end
- def has_sast_status?(status_text)
- within_element(:sast_status) do
- has_text?(status_text)
- end
- end
-
- def has_no_sast_status?(status_text)
- within_element(:sast_status) do
- has_no_text?(status_text)
- end
- end
-
- def has_dependency_scanning_status?(status_text)
- within_element(:dependency_scanning_status) do
- has_text?(status_text)
- end
+ def has_true_sast_status?
+ has_element?(:feature_status, feature: 'sast_true_status')
end
- def has_no_dependency_scanning_status?(status_text)
- within_element(:dependency_scanning_status) do
- has_no_text?(status_text)
- end
+ def has_false_sast_status?
+ has_element?(:feature_status, feature: 'sast_false_status')
end
- def has_license_compliance_status?(status_text)
- within_element(:license_scanning_status) do
- has_text?(status_text)
- end
+ def has_true_dependency_scanning_status?
+ has_element?(:feature_status, feature: 'dependency_scanning_true_status')
end
- def has_no_license_compliance_status?(status_text)
- within_element(:license_scanning_status) do
- has_no_text?(status_text)
- end
+ def has_false_dependency_scanning_status?
+ has_element?(:feature_status, feature: 'dependency_scanning_false_status')
end
def has_auto_devops_container?
diff --git a/qa/qa/page/project/settings/protected_branches.rb b/qa/qa/page/project/settings/protected_branches.rb
index 3eddd0fd33a..e6b13ed77a0 100644
--- a/qa/qa/page/project/settings/protected_branches.rb
+++ b/qa/qa/page/project/settings/protected_branches.rb
@@ -11,9 +11,9 @@ module QA
end
view 'app/views/protected_branches/_create_protected_branch.html.haml' do
- element :allowed_to_push_dropdown
+ element :select_allowed_to_push_dropdown
element :allowed_to_push_dropdown_content
- element :allowed_to_merge_dropdown
+ element :select_allowed_to_merge_dropdown
element :allowed_to_merge_dropdown_content
end
@@ -45,7 +45,7 @@ module QA
private
def select_allowed(action, allowed)
- click_element :"allowed_to_#{action}_dropdown"
+ click_element :"select_allowed_to_#{action}_dropdown"
allowed[:roles] = Resource::ProtectedBranch::Roles::NO_ONE unless allowed.key?(:roles)
diff --git a/qa/spec/page/element_spec.rb b/qa/spec/page/element_spec.rb
index fbf58b5e18a..da1fd224564 100644
--- a/qa/spec/page/element_spec.rb
+++ b/qa/spec/page/element_spec.rb
@@ -73,7 +73,7 @@ RSpec.describe QA::Page::Element do
subject { described_class.new(:something, /link_to 'something'/) }
it 'has an attribute[pattern] of the pattern' do
- expect(subject.attributes[:pattern]).to eq /link_to 'something'/
+ expect(subject.attributes[:pattern]).to eq(/link_to 'something'/)
end
it 'is not required by default' do
@@ -98,7 +98,7 @@ RSpec.describe QA::Page::Element do
subject { described_class.new(:something, /link_to 'something_else_entirely'/, required: true) }
it 'has an attribute[pattern] of the passed pattern' do
- expect(subject.attributes[:pattern]).to eq /link_to 'something_else_entirely'/
+ expect(subject.attributes[:pattern]).to eq(/link_to 'something_else_entirely'/)
end
it 'is required' do
@@ -118,6 +118,10 @@ RSpec.describe QA::Page::Element do
expect(subject.selector_css).to include(%q([data-qa-selector="my_element"]))
end
+ it 'properly translates to a data-testid' do
+ expect(subject.selector_css).to include(%q([data-testid="my_element"]))
+ end
+
context 'additional selectors' do
let(:element) { described_class.new(:my_element, index: 3, another_match: 'something') }
let(:required_element) { described_class.new(:my_element, required: true, index: 3) }
diff --git a/spec/factories/projects.rb b/spec/factories/projects.rb
index 856f0f6cd05..1b485e47127 100644
--- a/spec/factories/projects.rb
+++ b/spec/factories/projects.rb
@@ -57,6 +57,7 @@ FactoryBot.define do
restrict_user_defined_variables { nil }
ci_outbound_job_token_scope_enabled { nil }
ci_inbound_job_token_scope_enabled { nil }
+ runners_token { nil }
runner_token_expiration_interval { nil }
runner_token_expiration_interval_human_readable { nil }
end
@@ -93,6 +94,8 @@ FactoryBot.define do
project.build_project_namespace(project_namespace_hash)
project.build_project_feature(project_feature_hash)
+
+ project.set_runners_token(evaluator.runners_token) if evaluator.runners_token.present?
end
after(:create) do |project, evaluator|
diff --git a/spec/frontend/ci/ci_lint/components/ci_lint_spec.js b/spec/frontend/ci/ci_lint/components/ci_lint_spec.js
index 4b7ca36f331..7c8863adddd 100644
--- a/spec/frontend/ci/ci_lint/components/ci_lint_spec.js
+++ b/spec/frontend/ci/ci_lint/components/ci_lint_spec.js
@@ -41,6 +41,7 @@ describe('CI Lint', () => {
const findCiLintResults = () => wrapper.findComponent(CiLintResults);
const findValidateBtn = () => wrapper.find('[data-testid="ci-lint-validate"]');
const findClearBtn = () => wrapper.find('[data-testid="ci-lint-clear"]');
+ const findDryRunToggle = () => wrapper.find('[data-testid="ci-lint-dryrun"]');
beforeEach(() => {
createComponent();
@@ -63,18 +64,13 @@ describe('CI Lint', () => {
});
});
- it('validate action calls mutation with dry run', async () => {
- const dryRunEnabled = true;
-
- // setData usage is discouraged. See https://gitlab.com/groups/gitlab-org/-/epics/7330 for details
- // eslint-disable-next-line no-restricted-syntax
- await wrapper.setData({ dryRun: dryRunEnabled });
-
+ it('validate action calls mutation with dry run', () => {
+ findDryRunToggle().vm.$emit('input', true);
findValidateBtn().vm.$emit('click');
expect(wrapper.vm.$apollo.mutate).toHaveBeenCalledWith({
mutation: lintCIMutation,
- variables: { content, dry: dryRunEnabled, endpoint },
+ variables: { content, dry: true, endpoint },
});
});
diff --git a/spec/models/packages/package_spec.rb b/spec/models/packages/package_spec.rb
index 6e312dbeb4d..de13732bc54 100644
--- a/spec/models/packages/package_spec.rb
+++ b/spec/models/packages/package_spec.rb
@@ -1235,12 +1235,12 @@ RSpec.describe Packages::Package, type: :model, feature_category: :package_regis
end
end
- describe '#original_build_info' do
+ describe '#last_build_info' do
let_it_be_with_refind(:package) { create(:npm_package) }
context 'without build_infos' do
it 'returns nil' do
- expect(package.original_build_info).to be_nil
+ expect(package.last_build_info).to be_nil
end
end
@@ -1249,7 +1249,7 @@ RSpec.describe Packages::Package, type: :model, feature_category: :package_regis
let_it_be(:second_build_info) { create(:package_build_info, :with_pipeline, package: package) }
it 'returns the last build info' do
- expect(package.original_build_info).to eq(second_build_info)
+ expect(package.last_build_info).to eq(second_build_info)
end
end
end
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index b2f695c8b5a..d5c7ed59d6a 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -5846,7 +5846,7 @@ RSpec.describe User, feature_category: :user_profile do
end
describe '#delete_async' do
- let(:user) { create(:user) }
+ let(:user) { create(:user, note: "existing note") }
let(:deleted_by) { create(:user) }
it 'blocks the user then schedules them for deletion if a hard delete is specified' do
@@ -5878,6 +5878,14 @@ RSpec.describe User, feature_category: :user_profile do
end
end
+ it 'updates note to indicate the action (account was deleted by the user) and timestamp' do
+ freeze_time do
+ expected_note = "User deleted own account on #{Time.zone.now}\n#{user.note}"
+
+ expect { user.delete_async(deleted_by: deleted_by) }.to change { user.note }.to(expected_note)
+ end
+ end
+
context 'when delay_delete_own_user feature flag is disabled' do
before do
stub_feature_flags(delay_delete_own_user: false)
@@ -5890,6 +5898,10 @@ RSpec.describe User, feature_category: :user_profile do
expect(user).not_to be_blocked
end
+
+ it 'does not update the note' do
+ expect { user.delete_async(deleted_by: deleted_by) }.not_to change { user.note }
+ end
end
end
end
diff --git a/spec/presenters/packages/detail/package_presenter_spec.rb b/spec/presenters/packages/detail/package_presenter_spec.rb
index 8caa70c988e..6dea887eb28 100644
--- a/spec/presenters/packages/detail/package_presenter_spec.rb
+++ b/spec/presenters/packages/detail/package_presenter_spec.rb
@@ -26,7 +26,7 @@ RSpec.describe ::Packages::Detail::PackagePresenter do
end
let(:pipeline_info) do
- pipeline = package.original_build_info.pipeline
+ pipeline = package.last_build_info.pipeline
{
created_at: pipeline.created_at,
id: pipeline.id,
diff --git a/spec/requests/api/generic_packages_spec.rb b/spec/requests/api/generic_packages_spec.rb
index 6b3f378a4bc..9e8bfab6468 100644
--- a/spec/requests/api/generic_packages_spec.rb
+++ b/spec/requests/api/generic_packages_spec.rb
@@ -276,9 +276,9 @@ RSpec.describe API::GenericPackages, feature_category: :package_registry do
expect(package.version).to eq('0.0.1')
if should_set_build_info
- expect(package.original_build_info.pipeline).to eq(ci_build.pipeline)
+ expect(package.last_build_info.pipeline).to eq(ci_build.pipeline)
else
- expect(package.original_build_info).to be_nil
+ expect(package.last_build_info).to be_nil
end
package_file = package.package_files.last
diff --git a/spec/requests/api/maven_packages_spec.rb b/spec/requests/api/maven_packages_spec.rb
index 60e91973b5d..7baec5dd551 100644
--- a/spec/requests/api/maven_packages_spec.rb
+++ b/spec/requests/api/maven_packages_spec.rb
@@ -1020,7 +1020,7 @@ RSpec.describe API::MavenPackages, feature_category: :package_registry do
upload_file(params: params.merge(job_token: job.token))
expect(response).to have_gitlab_http_status(:ok)
- expect(project.reload.packages.last.original_build_info.pipeline).to eq job.pipeline
+ expect(project.reload.packages.last.last_build_info.pipeline).to eq job.pipeline
end
it 'rejects upload without running job token' do
diff --git a/spec/requests/api/npm_project_packages_spec.rb b/spec/requests/api/npm_project_packages_spec.rb
index 1f5ebc80824..6fede7e5267 100644
--- a/spec/requests/api/npm_project_packages_spec.rb
+++ b/spec/requests/api/npm_project_packages_spec.rb
@@ -262,7 +262,7 @@ RSpec.describe API::NpmProjectPackages, feature_category: :package_registry do
upload_package_with_token
expect(response).to have_gitlab_http_status(:ok)
- expect(project.reload.packages.find(json_response['id']).original_build_info.pipeline).to eq job.pipeline
+ expect(project.reload.packages.find(json_response['id']).last_build_info.pipeline).to eq job.pipeline
end
end
end
diff --git a/spec/services/packages/generic/find_or_create_package_service_spec.rb b/spec/services/packages/generic/find_or_create_package_service_spec.rb
index 07054fe3651..d0ffd297069 100644
--- a/spec/services/packages/generic/find_or_create_package_service_spec.rb
+++ b/spec/services/packages/generic/find_or_create_package_service_spec.rb
@@ -27,7 +27,7 @@ RSpec.describe Packages::Generic::FindOrCreatePackageService, feature_category:
expect(package.creator).to eq(user)
expect(package.name).to eq('mypackage')
expect(package.version).to eq('0.0.1')
- expect(package.original_build_info).to be_nil
+ expect(package.last_build_info).to be_nil
end
end
@@ -42,7 +42,7 @@ RSpec.describe Packages::Generic::FindOrCreatePackageService, feature_category:
expect(package.creator).to eq(user)
expect(package.name).to eq('mypackage')
expect(package.version).to eq('0.0.1')
- expect(package.original_build_info.pipeline).to eq(ci_build.pipeline)
+ expect(package.last_build_info.pipeline).to eq(ci_build.pipeline)
end
end
end
@@ -60,7 +60,7 @@ RSpec.describe Packages::Generic::FindOrCreatePackageService, feature_category:
expect(found_package).to eq(package)
end.not_to change { project.packages.generic.count }
- expect(package.reload.original_build_info).to be_nil
+ expect(package.reload.last_build_info).to be_nil
end
end
@@ -80,7 +80,7 @@ RSpec.describe Packages::Generic::FindOrCreatePackageService, feature_category:
expect(found_package).to eq(package)
end.not_to change { project.packages.generic.count }
- expect(package.reload.original_build_info.pipeline).to eq(pipeline)
+ expect(package.reload.last_build_info.pipeline).to eq(pipeline)
end
end
@@ -97,7 +97,7 @@ RSpec.describe Packages::Generic::FindOrCreatePackageService, feature_category:
expect(package.creator).to eq(user)
expect(package.name).to eq('mypackage')
expect(package.version).to eq('0.0.1')
- expect(package.original_build_info).to be_nil
+ expect(package.last_build_info).to be_nil
end
end
end
diff --git a/spec/support/shared_examples/models/ci/token_format_shared_examples.rb b/spec/support/shared_examples/models/ci/token_format_shared_examples.rb
index 0272982e2d0..7aa7d2be520 100644
--- a/spec/support/shared_examples/models/ci/token_format_shared_examples.rb
+++ b/spec/support/shared_examples/models/ci/token_format_shared_examples.rb
@@ -18,12 +18,6 @@ RSpec.shared_examples_for 'ensures runners_token is prefixed' do |factory|
it 'generates runners_token which starts with runner prefix' do
expect(record.runners_token).to match(a_string_starting_with(runners_prefix))
end
-
- it 'changes the attribute values for runners_token and runners_token_encrypted' do
- expect { record.runners_token }
- .to change { record[:runners_token] }.from(invalid_runners_token).to(nil)
- .and change { record[:runners_token_encrypted] }.from(nil)
- end
end
end
end
diff --git a/spec/support/shared_examples/services/packages_shared_examples.rb b/spec/support/shared_examples/services/packages_shared_examples.rb
index 7a4d7f81e96..e09cca42846 100644
--- a/spec/support/shared_examples/services/packages_shared_examples.rb
+++ b/spec/support/shared_examples/services/packages_shared_examples.rb
@@ -8,8 +8,8 @@ RSpec.shared_examples 'assigns build to package' do
it 'assigns the pipeline to the package' do
package = subject
- expect(package.original_build_info).to be_present
- expect(package.original_build_info.pipeline).to eq job.pipeline
+ expect(package.last_build_info).to be_present
+ expect(package.last_build_info.pipeline).to eq job.pipeline
end
end
end
--
cgit v1.2.3