diff options
102 files changed, 488 insertions, 267 deletions
diff --git a/.rubocop_todo/layout/argument_alignment.yml b/.rubocop_todo/layout/argument_alignment.yml index eff0b672fea..0bb29744fb5 100644 --- a/.rubocop_todo/layout/argument_alignment.yml +++ b/.rubocop_todo/layout/argument_alignment.yml @@ -1317,7 +1317,6 @@ Layout/ArgumentAlignment: - 'lib/gitlab/github_gists_import/importer/gist_importer.rb' - 'lib/gitlab/github_import/importer/issue_importer.rb' - 'lib/gitlab/github_import/importer/pull_request_importer.rb' - - 'lib/gitlab/github_import/parallel_scheduling.rb' - 'lib/gitlab/github_import/representation/issue.rb' - 'lib/gitlab/github_import/representation/issue_event.rb' - 'lib/gitlab/github_import/representation/note.rb' @@ -1545,17 +1544,6 @@ Layout/ArgumentAlignment: - 'spec/requests/api/graphql/mutations/merge_requests/set_milestone_spec.rb' - 'spec/requests/api/graphql/mutations/merge_requests/set_reviewers_spec.rb' - 'spec/requests/api/graphql/mutations/metrics/dashboard/annotations/create_spec.rb' - - 'spec/requests/api/graphql/mutations/notes/update/image_diff_note_spec.rb' - - 'spec/requests/api/graphql/mutations/packages/cleanup/policy/update_spec.rb' - - 'spec/requests/api/graphql/mutations/release_asset_links/update_spec.rb' - - 'spec/requests/api/graphql/mutations/snippets/create_spec.rb' - - 'spec/requests/api/graphql/mutations/snippets/destroy_spec.rb' - - 'spec/requests/api/graphql/mutations/snippets/mark_as_spam_spec.rb' - - 'spec/requests/api/graphql/mutations/snippets/update_spec.rb' - - 'spec/requests/api/graphql/mutations/todos/mark_all_done_spec.rb' - - 'spec/requests/api/graphql/mutations/todos/mark_done_spec.rb' - - 'spec/requests/api/graphql/mutations/todos/restore_many_spec.rb' - - 'spec/requests/api/graphql/mutations/todos/restore_spec.rb' - 'spec/requests/api/graphql/packages/conan_spec.rb' - 'spec/requests/api/graphql/tasks/task_completion_status_spec.rb' - 'spec/requests/api/graphql/user_query_spec.rb' diff --git a/.rubocop_todo/layout/line_length.yml b/.rubocop_todo/layout/line_length.yml index 8365d314f3a..3efcbb62c24 100644 --- a/.rubocop_todo/layout/line_length.yml +++ b/.rubocop_todo/layout/line_length.yml @@ -2657,7 +2657,6 @@ Layout/LineLength: - 'lib/gitlab/gitaly_client/server_service.rb' - 'lib/gitlab/github_import.rb' - 'lib/gitlab/github_import/importer/pull_request_importer.rb' - - 'lib/gitlab/github_import/parallel_scheduling.rb' - 'lib/gitlab/gl_repository.rb' - 'lib/gitlab/global_id/deprecations.rb' - 'lib/gitlab/golang.rb' diff --git a/.rubocop_todo/style/format_string.yml b/.rubocop_todo/style/format_string.yml index 1bcdb449bb1..3e89b2ca7ea 100644 --- a/.rubocop_todo/style/format_string.yml +++ b/.rubocop_todo/style/format_string.yml @@ -256,7 +256,6 @@ Style/FormatString: - 'lib/gitlab/github_import/issuable_finder.rb' - 'lib/gitlab/github_import/object_counter.rb' - 'lib/gitlab/github_import/page_counter.rb' - - 'lib/gitlab/github_import/parallel_scheduling.rb' - 'lib/gitlab/import_export/base/relation_factory.rb' - 'lib/gitlab/import_export/error.rb' - 'lib/gitlab/import_export/snippet_repo_restorer.rb' @@ -484,7 +484,7 @@ group :test do gem 'capybara', '~> 3.39', '>= 3.39.2' # rubocop:todo Gemfile/MissingFeatureCategory gem 'capybara-screenshot', '~> 1.0.26' # rubocop:todo Gemfile/MissingFeatureCategory - gem 'selenium-webdriver', '~> 4.14' # rubocop:todo Gemfile/MissingFeatureCategory + gem 'selenium-webdriver', '~> 4.15' # rubocop:todo Gemfile/MissingFeatureCategory gem 'graphlyte', '~> 1.0.0' # rubocop:todo Gemfile/MissingFeatureCategory @@ -501,7 +501,7 @@ group :test do # Moved in `test` because https://gitlab.com/gitlab-org/gitlab/-/issues/217527 gem 'derailed_benchmarks', require: false # rubocop:todo Gemfile/MissingFeatureCategory - gem 'gitlab_quality-test_tooling', '~> 1.4.0', require: false # rubocop:todo Gemfile/MissingFeatureCategory + gem 'gitlab_quality-test_tooling', '~> 1.5.0', require: false # rubocop:todo Gemfile/MissingFeatureCategory end gem 'octokit', '~> 6.0' # rubocop:todo Gemfile/MissingFeatureCategory diff --git a/Gemfile.checksum b/Gemfile.checksum index 3ace2363e34..2110a0cd7a6 100644 --- a/Gemfile.checksum +++ b/Gemfile.checksum @@ -221,7 +221,7 @@ {"name":"gitlab-styles","version":"10.1.0","platform":"ruby","checksum":"f42745f5397d042fe24cf2d0eb56c995b37f9f43d8fb79b834d197a1cafdc84a"}, {"name":"gitlab_chronic_duration","version":"0.12.0","platform":"ruby","checksum":"0d766944d415b5c831f176871ee8625783fc0c5bfbef2d79a3a616f207ffc16d"}, {"name":"gitlab_omniauth-ldap","version":"2.2.0","platform":"ruby","checksum":"bb4d20acb3b123ed654a8f6a47d3fac673ece7ed0b6992edb92dca14bad2838c"}, -{"name":"gitlab_quality-test_tooling","version":"1.4.0","platform":"ruby","checksum":"0fdfb574138ac9228ccce5fc40687aa81dcb8158900ca26982e15c14797959cf"}, +{"name":"gitlab_quality-test_tooling","version":"1.5.0","platform":"ruby","checksum":"7ce31d48462290f39c2c9bf8ae99b39b31e3a5eba0546bac058cdb6f7f88afd3"}, {"name":"globalid","version":"1.1.0","platform":"ruby","checksum":"b337e1746f0c8cb0a6c918234b03a1ddeb4966206ce288fbb57779f59b2d154f"}, {"name":"gon","version":"6.4.0","platform":"ruby","checksum":"e3a618d659392890f1aa7db420f17c75fd7d35aeb5f8fe003697d02c4b88d2f0"}, {"name":"google-apis-androidpublisher_v3","version":"0.34.0","platform":"ruby","checksum":"d7e1d7dd92f79c498fe2082222a1740d788e022e660c135564b3fd299cab5425"}, @@ -579,7 +579,7 @@ {"name":"sawyer","version":"0.9.2","platform":"ruby","checksum":"fa3a72d62a4525517b18857ddb78926aab3424de0129be6772a8e2ba240e7aca"}, {"name":"sd_notify","version":"0.1.1","platform":"ruby","checksum":"cbc7ac6caa7cedd26b30a72b5eeb6f36050dc0752df263452ea24fb5a4ad3131"}, {"name":"seed-fu","version":"2.3.7","platform":"ruby","checksum":"f19673443e9af799b730e3d4eca6a89b39e5a36825015dffd00d02ea3365cf74"}, -{"name":"selenium-webdriver","version":"4.14.0","platform":"ruby","checksum":"55726f81021d3f085ed9fcd318486b7ba90155598bb9e1fde7e4deeefe139d24"}, +{"name":"selenium-webdriver","version":"4.15.0","platform":"ruby","checksum":"36134e883c4df98f1b7e8519a3753c77427b74621147f8245aa6cac306d52297"}, {"name":"semver_dialects","version":"1.2.1","platform":"ruby","checksum":"60a1f67659f79c51a667e8858ec9b089c1e4ce4f6d2a0f0b4ac101916946eb23"}, {"name":"sentry-rails","version":"5.8.0","platform":"ruby","checksum":"c11b2d909de2c2bfda793c45f64180fd784d54c46886338b683ee3f8efa7731b"}, {"name":"sentry-raven","version":"3.1.2","platform":"ruby","checksum":"103d3b122958810d34898ce2e705bcf549ddb9d855a70ce9a3970ee2484f364a"}, diff --git a/Gemfile.lock b/Gemfile.lock index e3f0374a4e9..645c0a115ae 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -700,7 +700,7 @@ GEM omniauth (>= 1.3, < 3) pyu-ruby-sasl (>= 0.0.3.3, < 0.1) rubyntlm (~> 0.5) - gitlab_quality-test_tooling (1.4.0) + gitlab_quality-test_tooling (1.5.0) activesupport (>= 6.1, < 7.2) amatch (~> 0.4.1) gitlab (~> 4.19) @@ -1488,7 +1488,7 @@ GEM seed-fu (2.3.7) activerecord (>= 3.1) activesupport (>= 3.1) - selenium-webdriver (4.14.0) + selenium-webdriver (4.15.0) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) @@ -1866,7 +1866,7 @@ DEPENDENCIES gitlab-utils! gitlab_chronic_duration (~> 0.12) gitlab_omniauth-ldap (~> 2.2.0) - gitlab_quality-test_tooling (~> 1.4.0) + gitlab_quality-test_tooling (~> 1.5.0) gon (~> 6.4.0) google-apis-androidpublisher_v3 (~> 0.34.0) google-apis-cloudbilling_v1 (~> 0.21.0) @@ -2026,7 +2026,7 @@ DEPENDENCIES sassc-rails (~> 2.1.0) sd_notify (~> 0.1.0) seed-fu (~> 2.3.7) - selenium-webdriver (~> 4.14) + selenium-webdriver (~> 4.15) semver_dialects (~> 1.2.1) sentry-rails (~> 5.8.0) sentry-raven (~> 3.1) diff --git a/app/assets/javascripts/issues/list/components/issues_list_app.vue b/app/assets/javascripts/issues/list/components/issues_list_app.vue index dcd7aef923a..00c50104436 100644 --- a/app/assets/javascripts/issues/list/components/issues_list_app.vue +++ b/app/assets/javascripts/issues/list/components/issues_list_app.vue @@ -907,7 +907,7 @@ export default { v-if="issuesDrawerEnabled" :open="isIssuableSelected" header-height="calc(var(--top-bar-height) + var(--performance-bar-height))" - class="gl-w-40p gl-xs-w-full" + class="gl-w-full gl-sm-w-40p" @close="activeIssuable = null" > <template #title> diff --git a/app/assets/javascripts/lib/utils/datetime/timeago_utility.js b/app/assets/javascripts/lib/utils/datetime/timeago_utility.js index a973cd890ba..89170ecc55d 100644 --- a/app/assets/javascripts/lib/utils/datetime/timeago_utility.js +++ b/app/assets/javascripts/lib/utils/datetime/timeago_utility.js @@ -108,15 +108,27 @@ timeago.register(`${timeagoLanguageCode}-remaining`, memoizedLocaleRemaining()); timeago.register(`${timeagoLanguageCode}-duration`, memoizedLocaleDuration()); const setupAbsoluteFormatters = () => { - const cache = {}; + let cache = {}; // Intl.DateTimeFormat options (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat#using_options) + // For hourCycle please check https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/hourCycle + const hourCycle = [undefined, 'h12', 'h23']; const formats = { - [DATE_WITH_TIME_FORMAT]: () => ({ dateStyle: 'medium', timeStyle: 'short' }), + [DATE_WITH_TIME_FORMAT]: () => ({ + dateStyle: 'medium', + timeStyle: 'short', + hourCycle: hourCycle[window.gon?.time_display_format || 0], + }), [DATE_ONLY_FORMAT]: () => ({ dateStyle: 'medium' }), }; return (formatName = DEFAULT_DATE_TIME_FORMAT) => { + if (cache.time_display_format !== window.gon?.time_display_format) { + cache = { + time_display_format: window.gon?.time_display_format, + }; + } + if (cache[formatName]) { return cache[formatName]; } diff --git a/app/assets/javascripts/pages/users/index.js b/app/assets/javascripts/pages/users/index.js index 2e479da09e8..d2c31314bba 100644 --- a/app/assets/javascripts/pages/users/index.js +++ b/app/assets/javascripts/pages/users/index.js @@ -1,7 +1,8 @@ import $ from 'jquery'; import { setCookie } from '~/lib/utils/common_utils'; import UserCallout from '~/user_callout'; -import { initProfileTabs } from '~/profile'; +import { initProfileTabs, initUserAchievements } from '~/profile'; +import { initUserActionsApp } from '~/users/profile/actions'; import UserTabs from './user_tabs'; function initUserProfile(action) { @@ -27,4 +28,6 @@ function initUserProfile(action) { const page = $('body').attr('data-page'); const action = page.split(':')[1]; initUserProfile(action); +initUserAchievements(); +initUserActionsApp(); new UserCallout(); // eslint-disable-line no-new diff --git a/app/assets/javascripts/pages/users/show/index.js b/app/assets/javascripts/pages/users/show/index.js deleted file mode 100644 index 7d612d6cc4e..00000000000 --- a/app/assets/javascripts/pages/users/show/index.js +++ /dev/null @@ -1,5 +0,0 @@ -import { initUserAchievements } from '~/profile'; -import { initUserActionsApp } from '~/users/profile/actions'; - -initUserAchievements(); -initUserActionsApp(); diff --git a/app/assets/javascripts/vue_merge_request_widget/components/checks/rebase.stories.js b/app/assets/javascripts/vue_merge_request_widget/components/checks/rebase.stories.js index 46027774596..c0ac1818ffa 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/checks/rebase.stories.js +++ b/app/assets/javascripts/vue_merge_request_widget/components/checks/rebase.stories.js @@ -63,7 +63,7 @@ const Template = ({ apolloProvider, check: { identifier: 'need_rebase', - result: failed ? 'failed' : 'passed', + status: failed ? 'failed' : 'passed', }, mr: { onlyAllowMergeIfPipelineSucceeds }, canCreatePipelineInTargetProject, diff --git a/app/assets/stylesheets/application_utilities.scss b/app/assets/stylesheets/application_utilities.scss index 817e983a0ec..8bec12784ed 100644 --- a/app/assets/stylesheets/application_utilities.scss +++ b/app/assets/stylesheets/application_utilities.scss @@ -10,3 +10,5 @@ // Gitlab UI util classes @import '@gitlab/ui/src/scss/utilities'; + +@import 'tmp_utilities';
\ No newline at end of file diff --git a/app/assets/stylesheets/tmp_utilities.scss b/app/assets/stylesheets/tmp_utilities.scss new file mode 100644 index 00000000000..96464aa5a39 --- /dev/null +++ b/app/assets/stylesheets/tmp_utilities.scss @@ -0,0 +1,32 @@ +/** + * DISCLAIMER + * This is a temporary stylesheet meant to assist in migrating away from desktop-first responsive + * CSS utilities. + * DO NOT add utils in here unless you are actively taking part in in the migration. + * We needed this new file for temporary utils to be defined _after_ the main, non-responsive + * GitLab UI util. + * This file is scheduled to be removed by the end of 2023. + */ + .gl-sm-w-25p { + @include gl-media-breakpoint-up(sm) { + width: 25%; + } +} + +.gl-sm-w-30p { + @include gl-media-breakpoint-up(sm) { + width: 30%; + } +} + +.gl-sm-w-40p { + @include gl-media-breakpoint-up(sm) { + width: 40%; + } +} + +.gl-sm-w-75p { + @include gl-media-breakpoint-up(sm) { + width: 75%; + } +} diff --git a/app/controllers/profiles/preferences_controller.rb b/app/controllers/profiles/preferences_controller.rb index 931070ecdd4..7059e2a0371 100644 --- a/app/controllers/profiles/preferences_controller.rb +++ b/app/controllers/profiles/preferences_controller.rb @@ -48,6 +48,7 @@ class Profiles::PreferencesController < Profiles::ApplicationController :first_day_of_week, :preferred_language, :time_display_relative, + :time_display_format, :show_whitespace_in_diffs, :view_diffs_file_by_file, :tab_width, diff --git a/app/helpers/preferences_helper.rb b/app/helpers/preferences_helper.rb index d5bbd3a081d..204e3b149b9 100644 --- a/app/helpers/preferences_helper.rb +++ b/app/helpers/preferences_helper.rb @@ -59,6 +59,10 @@ module PreferencesHelper ] end + def time_display_format_choices + UserPreference.time_display_formats + end + def first_day_of_week_choices_with_default first_day_of_week_choices.unshift([_('System default (%{default})') % { default: default_first_day_of_week }, nil]) end diff --git a/app/models/ci/catalog/resource.rb b/app/models/ci/catalog/resource.rb index 0da69e6ece0..6ade90809b0 100644 --- a/app/models/ci/catalog/resource.rb +++ b/app/models/ci/catalog/resource.rb @@ -56,9 +56,14 @@ module Ci private + # These columns are denormalized from the `projects` table. We first sync these + # columns when the catalog resource record is created. Then any updates to the + # `projects` columns will be synced to the `catalog_resources` table by a worker + # (to be implemented in https://gitlab.com/gitlab-org/gitlab/-/issues/429376.) def sync_with_project self.name = project.name self.description = project.description + self.visibility_level = project.visibility_level end end end diff --git a/app/models/project.rb b/app/models/project.rb index 06c8ce57eb3..ba8180853e0 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -142,7 +142,9 @@ class Project < ApplicationRecord after_create :set_timestamps_for_create after_create :check_repository_absence! - after_update :update_catalog_resource, if: -> { (saved_change_to_name? || saved_change_to_description?) && catalog_resource } + # TODO: Remove this callback after background syncing is implemented. See https://gitlab.com/gitlab-org/gitlab/-/issues/429376. + after_update :update_catalog_resource, + if: -> { (saved_change_to_name? || saved_change_to_description? || saved_change_to_visibility_level?) && catalog_resource } before_destroy :remove_private_deploy_keys after_destroy :remove_exports diff --git a/app/models/upload.rb b/app/models/upload.rb index 59ce9a1f37a..745a6174931 100644 --- a/app/models/upload.rb +++ b/app/models/upload.rb @@ -174,7 +174,7 @@ class Upload < ApplicationRecord end def update_project_statistics - ProjectCacheWorker.perform_async(model_id, [], [:uploads_size]) + ProjectCacheWorker.perform_async(model_id, [], ['uploads_size']) end end diff --git a/app/models/user.rb b/app/models/user.rb index 2fefa92f0a3..f12304d5069 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -391,6 +391,7 @@ class User < MainClusterwide::ApplicationRecord :first_day_of_week, :first_day_of_week=, :timezone, :timezone=, :time_display_relative, :time_display_relative=, + :time_display_format, :time_display_format=, :show_whitespace_in_diffs, :show_whitespace_in_diffs=, :view_diffs_file_by_file, :view_diffs_file_by_file=, :pass_user_identities_to_ci_jwt, :pass_user_identities_to_ci_jwt=, diff --git a/app/models/user_preference.rb b/app/models/user_preference.rb index 8fc9f4617d0..59cfe9a8426 100644 --- a/app/models/user_preference.rb +++ b/app/models/user_preference.rb @@ -7,6 +7,7 @@ class UserPreference < MainClusterwide::ApplicationRecord # enum options with same name for multiple fields, also it creates # extra methods that aren't really needed here. NOTES_FILTERS = { all_notes: 0, only_comments: 1, only_activity: 2 }.freeze + TIME_DISPLAY_FORMATS = { system: 0, non_iso_format: 1, iso_format: 2 }.freeze belongs_to :user @@ -27,12 +28,15 @@ class UserPreference < MainClusterwide::ApplicationRecord validates :pinned_nav_items, json_schema: { filename: 'pinned_nav_items' } + validates :time_display_format, inclusion: { in: TIME_DISPLAY_FORMATS.values }, presence: true + ignore_columns :experience_level, remove_with: '14.10', remove_after: '2021-03-22' # 2023-06-22 is after 16.1 release and during 16.2 release https://docs.gitlab.com/ee/development/database/avoiding_downtime_in_migrations.html#ignoring-the-column-release-m ignore_columns :use_legacy_web_ide, remove_with: '16.2', remove_after: '2023-06-22' attribute :tab_width, default: -> { Gitlab::TabWidth::DEFAULT } attribute :time_display_relative, default: true + attribute :time_display_format, default: 0 attribute :render_whitespace_in_code, default: false attribute :project_shortcut_buttons, default: true attribute :keyboard_shortcuts_enabled, default: true @@ -80,6 +84,16 @@ class UserPreference < MainClusterwide::ApplicationRecord end end + class << self + def time_display_formats + { + s_('Time Display|System') => TIME_DISPLAY_FORMATS[:system], + s_('Time Display|12-hour: 2:34 PM') => TIME_DISPLAY_FORMATS[:non_iso_format], + s_('Time Display|24-hour: 14:34') => TIME_DISPLAY_FORMATS[:iso_format] + } + end + end + def time_display_relative value = read_attribute(:time_display_relative) return value unless value.nil? diff --git a/app/services/projects/update_service.rb b/app/services/projects/update_service.rb index 2d81bbdaa3b..336e887c241 100644 --- a/app/services/projects/update_service.rb +++ b/app/services/projects/update_service.rb @@ -58,11 +58,11 @@ module Projects def validate! unless valid_visibility_level_change?(project, project.visibility_attribute_value(params)) - raise ValidationError, s_('UpdateProject|New visibility level not allowed!') + raise_validation_error(s_('UpdateProject|New visibility level not allowed!')) end if renaming_project_with_container_registry_tags? - raise ValidationError, s_('UpdateProject|Cannot rename project because it contains container registry tags!') + raise_validation_error(s_('UpdateProject|Cannot rename project because it contains container registry tags!')) end validate_default_branch_change @@ -78,16 +78,17 @@ module Projects params[:previous_default_branch] = previous_default_branch if !project.root_ref?(new_default_branch) && has_custom_head_branch? - raise ValidationError, + raise_validation_error( format( s_("UpdateProject|Could not set the default branch. Do you have a branch named 'HEAD' in your repository? (%{linkStart}How do I fix this?%{linkEnd})"), linkStart: ambiguous_head_documentation_link, linkEnd: '</a>' ).html_safe + ) end after_default_branch_change(previous_default_branch) else - raise ValidationError, s_("UpdateProject|Could not set the default branch") + raise_validation_error(s_("UpdateProject|Could not set the default branch")) end end @@ -144,6 +145,10 @@ module Projects AfterRenameService.new(project, path_before: project.path_before_last_save, full_path_before: project.full_path_before_last_save) end + def raise_validation_error(message) + raise ValidationError, message + end + def update_failed! model_errors = project.errors.full_messages.to_sentence error_message = model_errors.presence || s_('UpdateProject|Project could not be updated!') diff --git a/app/services/web_hook_service.rb b/app/services/web_hook_service.rb index 0a8351d187b..854eb41c8a6 100644 --- a/app/services/web_hook_service.rb +++ b/app/services/web_hook_service.rb @@ -113,7 +113,7 @@ class WebHookService "recursion_detection_request_uuid" => Gitlab::WebHooks::RecursionDetection::UUID.instance.request_uuid }.compact - WebHookWorker.perform_async(hook.id, data.deep_stringify_keys, hook_name, params) + WebHookWorker.perform_async(hook.id, data.deep_stringify_keys, hook_name.to_s, params) end end @@ -170,7 +170,9 @@ class WebHookService def queue_log_execution_with_retry(log_data, category) retried = false begin - ::WebHooks::LogExecutionWorker.perform_async(hook.id, log_data.deep_stringify_keys, category, uniqueness_token) + ::WebHooks::LogExecutionWorker.perform_async( + hook.id, log_data.deep_stringify_keys, category.to_s, uniqueness_token.to_s + ) rescue Gitlab::SidekiqMiddleware::SizeLimiter::ExceedLimitError raise if retried diff --git a/app/views/clusters/clusters/connect.html.haml b/app/views/clusters/clusters/connect.html.haml index a6e1837badf..68e5fcb277b 100644 --- a/app/views/clusters/clusters/connect.html.haml +++ b/app/views/clusters/clusters/connect.html.haml @@ -5,7 +5,7 @@ = render 'deprecation_alert' .gl-md-display-flex.gl-mt-3 - .gl-w-quarter.gl-xs-w-full.gl-flex-shrink-0.gl-md-mr-5 + .gl-w-full.gl-sm-w-25p.gl-flex-shrink-0.gl-md-mr-5 = render 'sidebar', is_connect_page: true .gl-w-full #js-cluster-new diff --git a/app/views/clusters/clusters/new_cluster_docs.html.haml b/app/views/clusters/clusters/new_cluster_docs.html.haml index 72c70f35e22..d58c844382d 100644 --- a/app/views/clusters/clusters/new_cluster_docs.html.haml +++ b/app/views/clusters/clusters/new_cluster_docs.html.haml @@ -5,7 +5,7 @@ = render_gcp_signup_offer .gl-md-display-flex.gl-mt-3 - .gl-w-quarter.gl-xs-w-full.gl-flex-shrink-0.gl-md-mr-5 + .gl-w-full.gl-sm-w-25p.gl-flex-shrink-0.gl-md-mr-5 = render 'sidebar', is_connect_page: false .gl-w-full = render 'clusters/clusters/cloud_providers/cloud_provider_selector' diff --git a/app/views/invites/decline.html.haml b/app/views/invites/decline.html.haml index 4a57d70cb6e..40e4455e565 100644 --- a/app/views/invites/decline.html.haml +++ b/app/views/invites/decline.html.haml @@ -1,5 +1,5 @@ - page_title _('Invitation declined') -.decline-page.gl-display-flex.gl-flex-direction-column.gl-mx-auto{ class: 'gl-xs-w-full!' } +.decline-page.gl-display-flex.gl-flex-direction-column.gl-mx-auto.gl-w-full.gl-sm-w-auto .gl-align-self-center.gl-mb-4.gl-mt-7.gl-sm-mt-0= sprite_icon('check-circle', size: 48, css_class: 'gl-text-green-400') %h2.gl-font-size-h2= _('You successfully declined the invitation') %p diff --git a/app/views/layouts/devise.html.haml b/app/views/layouts/devise.html.haml index dcc239a2700..6a65b31a002 100644 --- a/app/views/layouts/devise.html.haml +++ b/app/views/layouts/devise.html.haml @@ -31,7 +31,7 @@ %h1.mb-3.gl-font-size-h2 = brand_title .mb-3 - .gl-w-half.gl-xs-w-full.gl-ml-auto.gl-mr-auto.bar + .gl-w-full.gl-sm-w-half.gl-ml-auto.gl-mr-auto.bar = yield = render 'devise/shared/footer' diff --git a/app/views/profiles/preferences/show.html.haml b/app/views/profiles/preferences/show.html.haml index 4b0e030db24..96375412f94 100644 --- a/app/views/profiles/preferences/show.html.haml +++ b/app/views/profiles/preferences/show.html.haml @@ -155,6 +155,12 @@ = f.gitlab_ui_checkbox_component :time_display_relative, s_('Preferences|Use relative times'), help_text: s_('Preferences|For example: 30 minutes ago.') + .form-group + = f.label :time_display_format, class: 'label-bold' do + = s_('Preferences|Time format') + - time_display_format_choices.each_entry do |time_display_format_option| + .gl-mb-4 + = f.gitlab_ui_radio_component :time_display_format, time_display_format_option[1], time_display_format_option[0] .settings-section.js-preferences-form.js-search-settings-section#enabled_following .settings-sticky-header .settings-sticky-header-inner diff --git a/app/workers/concerns/gitlab/github_import/rescheduling_methods.rb b/app/workers/concerns/gitlab/github_import/rescheduling_methods.rb index f6feb6d1598..316d30d94da 100644 --- a/app/workers/concerns/gitlab/github_import/rescheduling_methods.rb +++ b/app/workers/concerns/gitlab/github_import/rescheduling_methods.rb @@ -52,8 +52,7 @@ module Gitlab job_delay = client.rate_limit_resets_in + calculate_job_delay(enqueued_job_counter) - self.class - .perform_in(job_delay, project.id, hash, notify_key) + self.class.perform_in(job_delay, project.id, hash.deep_stringify_keys, notify_key.to_s) end end end diff --git a/app/workers/gitlab/github_import/stage/import_attachments_worker.rb b/app/workers/gitlab/github_import/stage/import_attachments_worker.rb index 6f8190fc7e6..a5d085a82c0 100644 --- a/app/workers/gitlab/github_import/stage/import_attachments_worker.rb +++ b/app/workers/gitlab/github_import/stage/import_attachments_worker.rb @@ -50,8 +50,8 @@ module Gitlab def move_to_next_stage(project, waiters = {}) AdvanceStageWorker.perform_async( project.id, - waiters, - :protected_branches + waiters.deep_stringify_keys, + 'protected_branches' ) end end diff --git a/app/workers/gitlab/github_import/stage/import_collaborators_worker.rb b/app/workers/gitlab/github_import/stage/import_collaborators_worker.rb index 8118f7f60c0..037b529b866 100644 --- a/app/workers/gitlab/github_import/stage/import_collaborators_worker.rb +++ b/app/workers/gitlab/github_import/stage/import_collaborators_worker.rb @@ -43,7 +43,7 @@ module Gitlab def move_to_next_stage(project, waiters = {}) AdvanceStageWorker.perform_async( - project.id, waiters, :pull_requests_merged_by + project.id, waiters.deep_stringify_keys, 'pull_requests_merged_by' ) end end diff --git a/app/workers/gitlab/github_import/stage/import_issue_events_worker.rb b/app/workers/gitlab/github_import/stage/import_issue_events_worker.rb index 77d286dc466..35779d7bfc5 100644 --- a/app/workers/gitlab/github_import/stage/import_issue_events_worker.rb +++ b/app/workers/gitlab/github_import/stage/import_issue_events_worker.rb @@ -32,7 +32,7 @@ module Gitlab end def move_to_next_stage(project, waiters = {}) - AdvanceStageWorker.perform_async(project.id, waiters, :notes) + AdvanceStageWorker.perform_async(project.id, waiters.deep_stringify_keys, 'notes') end end end diff --git a/app/workers/gitlab/github_import/stage/import_issues_and_diff_notes_worker.rb b/app/workers/gitlab/github_import/stage/import_issues_and_diff_notes_worker.rb index e70f10e3ce9..58e1f637b6a 100644 --- a/app/workers/gitlab/github_import/stage/import_issues_and_diff_notes_worker.rb +++ b/app/workers/gitlab/github_import/stage/import_issues_and_diff_notes_worker.rb @@ -22,7 +22,7 @@ module Gitlab hash[waiter.key] = waiter.jobs_remaining end - AdvanceStageWorker.perform_async(project.id, waiters, :issue_events) + AdvanceStageWorker.perform_async(project.id, waiters.deep_stringify_keys, 'issue_events') end # The importers to run in this stage. Issues can't be imported earlier diff --git a/app/workers/gitlab/github_import/stage/import_lfs_objects_worker.rb b/app/workers/gitlab/github_import/stage/import_lfs_objects_worker.rb index 9db72de59b7..8d7bd98f303 100644 --- a/app/workers/gitlab/github_import/stage/import_lfs_objects_worker.rb +++ b/app/workers/gitlab/github_import/stage/import_lfs_objects_worker.rb @@ -33,7 +33,7 @@ module Gitlab AdvanceStageWorker.perform_async( project.id, { waiter.key => waiter.jobs_remaining }, - :finish + 'finish' ) end end diff --git a/app/workers/gitlab/github_import/stage/import_notes_worker.rb b/app/workers/gitlab/github_import/stage/import_notes_worker.rb index 8e88034ba15..0459545d8e1 100644 --- a/app/workers/gitlab/github_import/stage/import_notes_worker.rb +++ b/app/workers/gitlab/github_import/stage/import_notes_worker.rb @@ -22,7 +22,7 @@ module Gitlab hash[waiter.key] = waiter.jobs_remaining end - AdvanceStageWorker.perform_async(project.id, waiters, :attachments) + AdvanceStageWorker.perform_async(project.id, waiters.deep_stringify_keys, 'attachments') end def importers(project) diff --git a/app/workers/gitlab/github_import/stage/import_protected_branches_worker.rb b/app/workers/gitlab/github_import/stage/import_protected_branches_worker.rb index f48da86af3a..e281e965f94 100644 --- a/app/workers/gitlab/github_import/stage/import_protected_branches_worker.rb +++ b/app/workers/gitlab/github_import/stage/import_protected_branches_worker.rb @@ -22,7 +22,7 @@ module Gitlab AdvanceStageWorker.perform_async( project.id, { waiter.key => waiter.jobs_remaining }, - :lfs_objects + 'lfs_objects' ) end end diff --git a/app/workers/gitlab/github_import/stage/import_pull_requests_merged_by_worker.rb b/app/workers/gitlab/github_import/stage/import_pull_requests_merged_by_worker.rb index 376581c633f..2f543951bf3 100644 --- a/app/workers/gitlab/github_import/stage/import_pull_requests_merged_by_worker.rb +++ b/app/workers/gitlab/github_import/stage/import_pull_requests_merged_by_worker.rb @@ -23,7 +23,7 @@ module Gitlab AdvanceStageWorker.perform_async( project.id, { waiter.key => waiter.jobs_remaining }, - :pull_request_review_requests + 'pull_request_review_requests' ) end end diff --git a/app/workers/gitlab/github_import/stage/import_pull_requests_review_requests_worker.rb b/app/workers/gitlab/github_import/stage/import_pull_requests_review_requests_worker.rb index f2907006d9c..db76545ae87 100644 --- a/app/workers/gitlab/github_import/stage/import_pull_requests_review_requests_worker.rb +++ b/app/workers/gitlab/github_import/stage/import_pull_requests_review_requests_worker.rb @@ -23,7 +23,7 @@ module Gitlab AdvanceStageWorker.perform_async( project.id, { waiter.key => waiter.jobs_remaining }, - :pull_request_reviews + 'pull_request_reviews' ) end end diff --git a/app/workers/gitlab/github_import/stage/import_pull_requests_reviews_worker.rb b/app/workers/gitlab/github_import/stage/import_pull_requests_reviews_worker.rb index 5c516555387..31b7c57a524 100644 --- a/app/workers/gitlab/github_import/stage/import_pull_requests_reviews_worker.rb +++ b/app/workers/gitlab/github_import/stage/import_pull_requests_reviews_worker.rb @@ -23,7 +23,7 @@ module Gitlab AdvanceStageWorker.perform_async( project.id, { waiter.key => waiter.jobs_remaining }, - :issues_and_diff_notes + 'issues_and_diff_notes' ) end end diff --git a/app/workers/gitlab/github_import/stage/import_pull_requests_worker.rb b/app/workers/gitlab/github_import/stage/import_pull_requests_worker.rb index 50527dfa2d8..c68b95b5111 100644 --- a/app/workers/gitlab/github_import/stage/import_pull_requests_worker.rb +++ b/app/workers/gitlab/github_import/stage/import_pull_requests_worker.rb @@ -30,7 +30,7 @@ module Gitlab AdvanceStageWorker.perform_async( project.id, { waiter.key => waiter.jobs_remaining }, - :collaborators + 'collaborators' ) end diff --git a/app/workers/gitlab/import/advance_stage.rb b/app/workers/gitlab/import/advance_stage.rb index 180c08905ff..782439894c0 100644 --- a/app/workers/gitlab/import/advance_stage.rb +++ b/app/workers/gitlab/import/advance_stage.rb @@ -19,7 +19,7 @@ module Gitlab # completed. # timeout_timer - Time the sidekiq worker was first initiated with the current job_count # previous_job_count - Number of jobs remaining on last invocation of this worker - def perform(project_id, waiters, next_stage, timeout_timer = Time.zone.now, previous_job_count = nil) + def perform(project_id, waiters, next_stage, timeout_timer = Time.zone.now.to_s, previous_job_count = nil) import_state_jid = find_import_state_jid(project_id) # If the import state is nil the project may have been deleted or the import @@ -45,7 +45,9 @@ module Gitlab handle_timeout(import_state_jid, next_stage, project_id, new_waiters, new_job_count) else - self.class.perform_in(INTERVAL, project_id, new_waiters, next_stage, timeout_timer, previous_job_count) + self.class.perform_in(INTERVAL, + project_id, new_waiters.deep_stringify_keys, next_stage.to_s, timeout_timer.to_s, previous_job_count + ) end end diff --git a/db/migrate/20231106212340_add_visibility_level_to_catalog_resources.rb b/db/migrate/20231106212340_add_visibility_level_to_catalog_resources.rb new file mode 100644 index 00000000000..46150396c1e --- /dev/null +++ b/db/migrate/20231106212340_add_visibility_level_to_catalog_resources.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddVisibilityLevelToCatalogResources < Gitlab::Database::Migration[2.2] + milestone '16.6' + + enable_lock_retries! + + def change + # This column must match the settings of `visibility_level` in the `projects` table. + # Backfill will be done as part of https://gitlab.com/gitlab-org/gitlab/-/issues/429056. + add_column :catalog_resources, :visibility_level, :integer, default: 0, null: false + end +end diff --git a/db/migrate/20231108072342_add_display_time_format_preference.rb b/db/migrate/20231108072342_add_display_time_format_preference.rb new file mode 100644 index 00000000000..2f3773f73ef --- /dev/null +++ b/db/migrate/20231108072342_add_display_time_format_preference.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +class AddDisplayTimeFormatPreference < Gitlab::Database::Migration[2.2] + milestone '16.6' + enable_lock_retries! + + def change + add_column :user_preferences, :time_display_format, :integer, limit: 2, default: 0, null: false + end +end diff --git a/db/schema_migrations/20231106212340 b/db/schema_migrations/20231106212340 new file mode 100644 index 00000000000..1731e94d37a --- /dev/null +++ b/db/schema_migrations/20231106212340 @@ -0,0 +1 @@ +c049aa4242cf88bb418e3285de83cf837e6855a709d68970c2f460a7e86bbf26
\ No newline at end of file diff --git a/db/schema_migrations/20231108072342 b/db/schema_migrations/20231108072342 new file mode 100644 index 00000000000..69228af4769 --- /dev/null +++ b/db/schema_migrations/20231108072342 @@ -0,0 +1 @@ +6798b462ec86a98c9f901ba10f6c8b904295091ff9aae48b76289699534f39c4
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 870ae4727f1..f19fcbe3f53 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -13479,7 +13479,8 @@ CREATE TABLE catalog_resources ( state smallint DEFAULT 0 NOT NULL, latest_released_at timestamp with time zone, name character varying, - description text + description text, + visibility_level integer DEFAULT 0 NOT NULL ); CREATE SEQUENCE catalog_resources_id_seq @@ -24496,6 +24497,7 @@ CREATE TABLE user_preferences ( project_shortcut_buttons boolean DEFAULT true NOT NULL, enabled_zoekt boolean DEFAULT true NOT NULL, keyboard_shortcuts_enabled boolean DEFAULT true NOT NULL, + time_display_format smallint DEFAULT 0 NOT NULL, CONSTRAINT check_89bf269f41 CHECK ((char_length(diffs_deletion_color) <= 7)), CONSTRAINT check_d07ccd35f7 CHECK ((char_length(diffs_addition_color) <= 7)) ); diff --git a/doc/administration/backup_restore/backup_gitlab.md b/doc/administration/backup_restore/backup_gitlab.md index 117d3f2f080..b4cc2b48e37 100644 --- a/doc/administration/backup_restore/backup_gitlab.md +++ b/doc/administration/backup_restore/backup_gitlab.md @@ -1272,7 +1272,7 @@ Gitaly Cluster [does not support snapshot backups](../gitaly/index.md#snapshot-b When considering using file system data transfer or snapshots: - Don't use these methods to migrate from one operating system to another. The operating systems of the source and destination should be as similar as possible. For example, - don't use these methods to migrate from Ubuntu to Fedora. + don't use these methods to migrate from Ubuntu to RHEL. - Data consistency is very important. You should stop GitLab with `sudo gitlab-ctl stop` before taking doing a file system transfer (with `rsync`, for example) or taking a snapshot. diff --git a/doc/user/profile/preferences.md b/doc/user/profile/preferences.md index 170545d851f..34f083e0b48 100644 --- a/doc/user/profile/preferences.md +++ b/doc/user/profile/preferences.md @@ -268,6 +268,22 @@ To use exact times on the GitLab UI: 1. Clear the **Use relative times** checkbox. 1. Select **Save changes**. +### Customize time format + +> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/15206) in GitLab 16.6. + +You can customize the format used to display times of activities on your group and project overview pages and user profiles. You can display times as: + +- 12 hour format. For example: `2:34 PM`. +- 24 hour format. For example: `14:34`. + +To customize the time format: + +1. On the left sidebar, select your avatar. +1. Select **Preferences** > **Time preferences**. +1. In **Time format**, select either the **12-hour** or **24-hour** option. +1. Select **Save changes**. + ## User identities in CI job JSON web tokens > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/387537) in GitLab 16.0. diff --git a/doc/user/project/merge_requests/status_checks.md b/doc/user/project/merge_requests/status_checks.md index 9249af0f25c..c330af0fc9b 100644 --- a/doc/user/project/merge_requests/status_checks.md +++ b/doc/user/project/merge_requests/status_checks.md @@ -11,7 +11,7 @@ type: reference, concepts > - [Feature flag removed](https://gitlab.com/gitlab-org/gitlab/-/issues/320783) in GitLab 14.1. > - `failed` status [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/329636) in GitLab 14.9. > - `pending` status [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/413723) in GitLab 16.5 -> - Timeout interval of two minutes for `pending` status checks [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/388725) in GitLab 16.5. +> - Timeout interval of two minutes for `pending` status checks [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/388725) in GitLab 16.6. Status checks are API calls to external systems that request the status of an external requirement. diff --git a/lib/gitlab/github_import/job_delay_calculator.rb b/lib/gitlab/github_import/job_delay_calculator.rb index 52b211c92d6..077a27df16c 100644 --- a/lib/gitlab/github_import/job_delay_calculator.rb +++ b/lib/gitlab/github_import/job_delay_calculator.rb @@ -15,7 +15,7 @@ module Gitlab def calculate_job_delay(job_index) multiplier = (job_index / parallel_import_batch[:size]) - (multiplier * parallel_import_batch[:delay]) + 1.second + (multiplier * parallel_import_batch[:delay]).to_i + 1 end end end diff --git a/lib/gitlab/github_import/parallel_scheduling.rb b/lib/gitlab/github_import/parallel_scheduling.rb index cccd99f48b1..ce93b5203df 100644 --- a/lib/gitlab/github_import/parallel_scheduling.rb +++ b/lib/gitlab/github_import/parallel_scheduling.rb @@ -6,7 +6,7 @@ module Gitlab include JobDelayCalculator attr_reader :project, :client, :page_counter, :already_imported_cache_key, - :job_waiter_cache_key, :job_waiter_remaining_cache_key + :job_waiter_cache_key, :job_waiter_remaining_cache_key # The base cache key to use for tracking already imported objects. ALREADY_IMPORTED_CACHE_KEY = @@ -26,12 +26,11 @@ module Gitlab @client = client @parallel = parallel @page_counter = PageCounter.new(project, collection_method) - @already_imported_cache_key = ALREADY_IMPORTED_CACHE_KEY % - { project: project.id, collection: collection_method } - @job_waiter_cache_key = JOB_WAITER_CACHE_KEY % - { project: project.id, collection: collection_method } - @job_waiter_remaining_cache_key = JOB_WAITER_REMAINING_CACHE_KEY % - { project: project.id, collection: collection_method } + @already_imported_cache_key = format(ALREADY_IMPORTED_CACHE_KEY, project: project.id, + collection: collection_method) + @job_waiter_cache_key = format(JOB_WAITER_CACHE_KEY, project: project.id, collection: collection_method) + @job_waiter_remaining_cache_key = format(JOB_WAITER_REMAINING_CACHE_KEY, project: project.id, + collection: collection_method) end def parallel? @@ -57,7 +56,8 @@ module Gitlab # still scheduling duplicates while. Since all work has already been # completed those jobs will just cycle through any remaining pages while # not scheduling anything. - Gitlab::Cache::Import::Caching.expire(already_imported_cache_key, Gitlab::Cache::Import::Caching::SHORTER_TIMEOUT) + Gitlab::Cache::Import::Caching.expire(already_imported_cache_key, + Gitlab::Cache::Import::Caching::SHORTER_TIMEOUT) info(project.id, message: "importer finished") retval @@ -97,7 +97,7 @@ module Gitlab repr = object_representation(object) job_delay = calculate_job_delay(enqueued_job_counter) - sidekiq_worker_class.perform_in(job_delay, project.id, repr.to_hash, job_waiter.key) + sidekiq_worker_class.perform_in(job_delay, project.id, repr.to_hash.deep_stringify_keys, job_waiter.key.to_s) enqueued_job_counter += 1 job_waiter.jobs_remaining = Gitlab::Cache::Import::Caching.increment(job_waiter_remaining_cache_key) diff --git a/lib/gitlab/github_import/representation/to_hash.rb b/lib/gitlab/github_import/representation/to_hash.rb index 4a0f36ab8f0..54faa51a787 100644 --- a/lib/gitlab/github_import/representation/to_hash.rb +++ b/lib/gitlab/github_import/representation/to_hash.rb @@ -16,11 +16,15 @@ module Gitlab hash end + # This method allow objects to be safely passed directly to Sidekiq without errors. + # It returns JSON datatypes: string, integer, float, boolean, null(nil), array and hash. def convert_value_for_to_hash(value) if value.is_a?(Array) value.map { |v| convert_value_for_to_hash(v) } elsif value.respond_to?(:to_hash) value.to_hash + elsif value.respond_to?(:strftime) || value.is_a?(Symbol) + value.to_s else value end diff --git a/lib/gitlab/gon_helper.rb b/lib/gitlab/gon_helper.rb index f491b00c461..59813e4f5a0 100644 --- a/lib/gitlab/gon_helper.rb +++ b/lib/gitlab/gon_helper.rb @@ -50,6 +50,7 @@ module Gitlab gon.suggested_label_colors = LabelsHelper.suggested_colors gon.first_day_of_week = current_user&.first_day_of_week || Gitlab::CurrentSettings.first_day_of_week gon.time_display_relative = true + gon.time_display_format = 0 gon.ee = Gitlab.ee? gon.jh = Gitlab.jh? gon.dot_com = Gitlab.com? @@ -67,6 +68,7 @@ module Gitlab gon.current_user_fullname = current_user.name gon.current_user_avatar_url = current_user.avatar_url gon.time_display_relative = current_user.time_display_relative + gon.time_display_format = current_user.time_display_format end # Initialize gon.features with any flags that should be diff --git a/locale/gitlab.pot b/locale/gitlab.pot index dbe4be7456b..7a488a1cdb9 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -36134,6 +36134,9 @@ msgstr "" msgid "Preferences|This feature is experimental and translations are not yet complete." msgstr "" +msgid "Preferences|Time format" +msgstr "" + msgid "Preferences|Time preferences" msgstr "" @@ -49554,6 +49557,15 @@ msgstr "" msgid "Time (in hours) that users are allowed to skip forced configuration of two-factor authentication." msgstr "" +msgid "Time Display|12-hour: 2:34 PM" +msgstr "" + +msgid "Time Display|24-hour: 14:34" +msgstr "" + +msgid "Time Display|System" +msgstr "" + msgid "Time based: Yes" msgstr "" @@ -51433,6 +51445,9 @@ msgstr "" msgid "UpdateProject|Pruning unreachable objects can lead to repository corruption." msgstr "" +msgid "UpdateProject|Updating default branch is blocked by security policy" +msgstr "" + msgid "UpdateRepositoryStorage|Timeout waiting for %{type} repository pushes" msgstr "" diff --git a/spec/frontend/lib/utils/datetime/timeago_utility_spec.js b/spec/frontend/lib/utils/datetime/timeago_utility_spec.js index 74ce8175357..44db4cf88a2 100644 --- a/spec/frontend/lib/utils/datetime/timeago_utility_spec.js +++ b/spec/frontend/lib/utils/datetime/timeago_utility_spec.js @@ -160,5 +160,24 @@ describe('TimeAgo utils', () => { ); }, ); + + describe('With User Setting Time Format', () => { + it.each` + timeDisplayFormat | display | text + ${0} | ${'System'} | ${'Feb 18, 2020, 10:22 PM'} + ${1} | ${'12-hour'} | ${'Feb 18, 2020, 10:22 PM'} + ${2} | ${'24-hour'} | ${'Feb 18, 2020, 22:22'} + `(`'$display' renders as '$text'`, ({ timeDisplayFormat, text }) => { + gon.time_display_relative = false; + gon.time_display_format = timeDisplayFormat; + + const element = document.querySelector('time'); + localTimeAgo([element]); + + jest.runAllTimers(); + + expect(element.innerText).toBe(text); + }); + }); }); }); diff --git a/spec/helpers/preferences_helper_spec.rb b/spec/helpers/preferences_helper_spec.rb index 9d1564dfef1..0bd8792ae83 100644 --- a/spec/helpers/preferences_helper_spec.rb +++ b/spec/helpers/preferences_helper_spec.rb @@ -71,6 +71,16 @@ RSpec.describe PreferencesHelper do end end + describe '#time_display_format_choices_with_default' do + it 'returns choices' do + expect(helper.time_display_format_choices).to eq({ + "12-hour: 2:34 PM" => 1, + "24-hour: 14:34" => 2, + "System" => 0 + }) + end + end + describe '#user_application_theme' do context 'with a user' do it "returns user's theme's css_class" do diff --git a/spec/lib/gitlab/github_import/importer/collaborators_importer_spec.rb b/spec/lib/gitlab/github_import/importer/collaborators_importer_spec.rb index dcb02f32a28..6f602531d23 100644 --- a/spec/lib/gitlab/github_import/importer/collaborators_importer_spec.rb +++ b/spec/lib/gitlab/github_import/importer/collaborators_importer_spec.rb @@ -82,7 +82,7 @@ RSpec.describe Gitlab::GithubImport::Importer::CollaboratorsImporter, feature_ca it 'imports each collaborator in parallel' do expect(Gitlab::GithubImport::ImportCollaboratorWorker).to receive(:perform_in) - .with(1.second, project.id, an_instance_of(Hash), an_instance_of(String)) + .with(1, project.id, an_instance_of(Hash), an_instance_of(String)) waiter = importer.parallel_import diff --git a/spec/lib/gitlab/github_import/importer/diff_notes_importer_spec.rb b/spec/lib/gitlab/github_import/importer/diff_notes_importer_spec.rb index 945b742b025..4e8066ecb69 100644 --- a/spec/lib/gitlab/github_import/importer/diff_notes_importer_spec.rb +++ b/spec/lib/gitlab/github_import/importer/diff_notes_importer_spec.rb @@ -98,7 +98,7 @@ RSpec.describe Gitlab::GithubImport::Importer::DiffNotesImporter, feature_catego .and_yield(github_comment) expect(Gitlab::GithubImport::ImportDiffNoteWorker).to receive(:perform_in) - .with(1.second, project.id, an_instance_of(Hash), an_instance_of(String)) + .with(1, project.id, an_instance_of(Hash), an_instance_of(String)) waiter = importer.parallel_import diff --git a/spec/lib/gitlab/github_import/importer/issue_events_importer_spec.rb b/spec/lib/gitlab/github_import/importer/issue_events_importer_spec.rb index 04b694dc0cb..9aba6a2b02c 100644 --- a/spec/lib/gitlab/github_import/importer/issue_events_importer_spec.rb +++ b/spec/lib/gitlab/github_import/importer/issue_events_importer_spec.rb @@ -78,7 +78,7 @@ RSpec.describe Gitlab::GithubImport::Importer::IssueEventsImporter, feature_cate allow(importer).to receive(:each_object_to_import).and_yield(issue_event) expect(Gitlab::GithubImport::ImportIssueEventWorker).to receive(:perform_in).with( - 1.second, project.id, an_instance_of(Hash), an_instance_of(String) + 1, project.id, an_instance_of(Hash), an_instance_of(String) ) waiter = importer.parallel_import diff --git a/spec/lib/gitlab/github_import/importer/issues_importer_spec.rb b/spec/lib/gitlab/github_import/importer/issues_importer_spec.rb index d6fd1a4739c..1bfdce04187 100644 --- a/spec/lib/gitlab/github_import/importer/issues_importer_spec.rb +++ b/spec/lib/gitlab/github_import/importer/issues_importer_spec.rb @@ -92,7 +92,7 @@ RSpec.describe Gitlab::GithubImport::Importer::IssuesImporter, feature_category: expect(Gitlab::GithubImport::ImportIssueWorker) .to receive(:perform_in) - .with(1.second, project.id, an_instance_of(Hash), an_instance_of(String)) + .with(1, project.id, an_instance_of(Hash), an_instance_of(String)) waiter = importer.parallel_import diff --git a/spec/lib/gitlab/github_import/importer/lfs_objects_importer_spec.rb b/spec/lib/gitlab/github_import/importer/lfs_objects_importer_spec.rb index fab9d26532d..3f5ee68d264 100644 --- a/spec/lib/gitlab/github_import/importer/lfs_objects_importer_spec.rb +++ b/spec/lib/gitlab/github_import/importer/lfs_objects_importer_spec.rb @@ -119,7 +119,7 @@ RSpec.describe Gitlab::GithubImport::Importer::LfsObjectsImporter, feature_categ end expect(Gitlab::GithubImport::ImportLfsObjectWorker).to receive(:perform_in) - .with(1.second, project.id, an_instance_of(Hash), an_instance_of(String)) + .with(1, project.id, an_instance_of(Hash), an_instance_of(String)) waiter = importer.parallel_import diff --git a/spec/lib/gitlab/github_import/importer/notes_importer_spec.rb b/spec/lib/gitlab/github_import/importer/notes_importer_spec.rb index 841cc8178ea..8c93963f325 100644 --- a/spec/lib/gitlab/github_import/importer/notes_importer_spec.rb +++ b/spec/lib/gitlab/github_import/importer/notes_importer_spec.rb @@ -84,7 +84,7 @@ RSpec.describe Gitlab::GithubImport::Importer::NotesImporter, feature_category: .and_yield(github_comment) expect(Gitlab::GithubImport::ImportNoteWorker).to receive(:perform_in) - .with(1.second, project.id, an_instance_of(Hash), an_instance_of(String)) + .with(1, project.id, an_instance_of(Hash), an_instance_of(String)) waiter = importer.parallel_import diff --git a/spec/lib/gitlab/github_import/importer/protected_branches_importer_spec.rb b/spec/lib/gitlab/github_import/importer/protected_branches_importer_spec.rb index 6a8b14a2690..8e99585109b 100644 --- a/spec/lib/gitlab/github_import/importer/protected_branches_importer_spec.rb +++ b/spec/lib/gitlab/github_import/importer/protected_branches_importer_spec.rb @@ -144,7 +144,7 @@ RSpec.describe Gitlab::GithubImport::Importer::ProtectedBranchesImporter, featur it 'imports each protected branch in parallel' do expect(Gitlab::GithubImport::ImportProtectedBranchWorker) .to receive(:perform_in) - .with(1.second, project.id, an_instance_of(Hash), an_instance_of(String)) + .with(1, project.id, an_instance_of(Hash), an_instance_of(String)) expect(Gitlab::GithubImport::ObjectCounter) .to receive(:increment).with(project, :protected_branch, :fetched) diff --git a/spec/lib/gitlab/github_import/importer/pull_requests/review_requests_importer_spec.rb b/spec/lib/gitlab/github_import/importer/pull_requests/review_requests_importer_spec.rb index d0145ba1120..1977815e3a0 100644 --- a/spec/lib/gitlab/github_import/importer/pull_requests/review_requests_importer_spec.rb +++ b/spec/lib/gitlab/github_import/importer/pull_requests/review_requests_importer_spec.rb @@ -97,7 +97,7 @@ RSpec.describe Gitlab::GithubImport::Importer::PullRequests::ReviewRequestsImpor { id: 4, login: 'alice' }, { id: 5, login: 'bob' } ] - }, + }.deep_stringify_keys, instance_of(String) ], [ @@ -108,7 +108,7 @@ RSpec.describe Gitlab::GithubImport::Importer::PullRequests::ReviewRequestsImpor users: [ { id: 4, login: 'alice' } ] - }, + }.deep_stringify_keys, instance_of(String) ] ] @@ -116,10 +116,10 @@ RSpec.describe Gitlab::GithubImport::Importer::PullRequests::ReviewRequestsImpor it 'schedule import for each merge request reviewers' do expect(Gitlab::GithubImport::PullRequests::ImportReviewRequestWorker) - .to receive(:perform_in).with(1.second, *expected_worker_payload.first) + .to receive(:perform_in).with(1, *expected_worker_payload.first) expect(Gitlab::GithubImport::PullRequests::ImportReviewRequestWorker) - .to receive(:perform_in).with(1.second, *expected_worker_payload.second) + .to receive(:perform_in).with(1, *expected_worker_payload.second) expect(Gitlab::GithubImport::ObjectCounter) .to receive(:increment).twice.with(project, :pull_request_review_request, :fetched) @@ -137,7 +137,7 @@ RSpec.describe Gitlab::GithubImport::Importer::PullRequests::ReviewRequestsImpor it "doesn't schedule import this merge request reviewers" do expect(Gitlab::GithubImport::PullRequests::ImportReviewRequestWorker) - .to receive(:perform_in).with(1.second, *expected_worker_payload.second) + .to receive(:perform_in).with(1, *expected_worker_payload.second) expect(Gitlab::GithubImport::ObjectCounter) .to receive(:increment).once.with(project, :pull_request_review_request, :fetched) diff --git a/spec/lib/gitlab/github_import/importer/pull_requests_importer_spec.rb b/spec/lib/gitlab/github_import/importer/pull_requests_importer_spec.rb index cfd75fba849..10e413fdfe5 100644 --- a/spec/lib/gitlab/github_import/importer/pull_requests_importer_spec.rb +++ b/spec/lib/gitlab/github_import/importer/pull_requests_importer_spec.rb @@ -102,7 +102,7 @@ RSpec.describe Gitlab::GithubImport::Importer::PullRequestsImporter, feature_cat expect(Gitlab::GithubImport::ImportPullRequestWorker) .to receive(:perform_in) - .with(1.second, project.id, an_instance_of(Hash), an_instance_of(String)) + .with(1, project.id, an_instance_of(Hash), an_instance_of(String)) waiter = importer.parallel_import diff --git a/spec/lib/gitlab/github_import/parallel_scheduling_spec.rb b/spec/lib/gitlab/github_import/parallel_scheduling_spec.rb index 9de39a3ff7e..e0b1ff1bc33 100644 --- a/spec/lib/gitlab/github_import/parallel_scheduling_spec.rb +++ b/spec/lib/gitlab/github_import/parallel_scheduling_spec.rb @@ -296,11 +296,11 @@ RSpec.describe Gitlab::GithubImport::ParallelScheduling, feature_category: :impo expect(importer).to receive(:each_object_to_import) .and_yield(object).and_yield(object).and_yield(object) expect(worker_class).to receive(:perform_in) - .with(1.second, project.id, { title: 'One' }, 'waiter-key').ordered + .with(1, project.id, { 'title' => 'One' }, 'waiter-key').ordered expect(worker_class).to receive(:perform_in) - .with(1.second, project.id, { title: 'Two' }, 'waiter-key').ordered + .with(1, project.id, { 'title' => 'Two' }, 'waiter-key').ordered expect(worker_class).to receive(:perform_in) - .with(1.minute + 1.second, project.id, { title: 'Three' }, 'waiter-key').ordered + .with(61, project.id, { 'title' => 'Three' }, 'waiter-key').ordered job_waiter = importer.parallel_import @@ -325,11 +325,11 @@ RSpec.describe Gitlab::GithubImport::ParallelScheduling, feature_category: :impo expect(importer).to receive(:each_object_to_import).and_yield(object).and_yield(object).and_yield(object) expect(worker_class).to receive(:perform_in) - .with(1.second, project.id, { title: 'One' }, 'waiter-key').ordered + .with(1, project.id, { 'title' => 'One' }, 'waiter-key').ordered expect(worker_class).to receive(:perform_in) - .with(1.minute + 1.second, project.id, { title: 'Two' }, 'waiter-key').ordered + .with(61, project.id, { 'title' => 'Two' }, 'waiter-key').ordered expect(worker_class).to receive(:perform_in) - .with(2.minutes + 1.second, project.id, { title: 'Three' }, 'waiter-key').ordered + .with(121, project.id, { 'title' => 'Three' }, 'waiter-key').ordered job_waiter = importer.parallel_import diff --git a/spec/lib/gitlab/github_import/representation/to_hash_spec.rb b/spec/lib/gitlab/github_import/representation/to_hash_spec.rb index 739c832025c..52edffe586d 100644 --- a/spec/lib/gitlab/github_import/representation/to_hash_spec.rb +++ b/spec/lib/gitlab/github_import/representation/to_hash_spec.rb @@ -2,14 +2,14 @@ require 'fast_spec_helper' -RSpec.describe Gitlab::GithubImport::Representation::ToHash do +RSpec.describe Gitlab::GithubImport::Representation::ToHash, feature_category: :importers do describe '#to_hash' do let(:user) { double(:user, attributes: { login: 'alice' }) } let(:issue) do double( :issue, - attributes: { user: user, assignees: [user], number: 42 } + attributes: { user: user, assignees: [user], number: 42, created_at: 5.days.ago, status: :valid } ) end @@ -35,5 +35,13 @@ RSpec.describe Gitlab::GithubImport::Representation::ToHash do it 'keeps values as-is if they do not respond to #to_hash' do expect(issue_hash[:number]).to eq(42) end + + it 'converts Date value to String' do + expect(issue_hash[:created_at]).to be_an_instance_of(String) + end + + it 'converts Symbol value to String' do + expect(issue_hash[:status]).to be_an_instance_of(String) + end end end diff --git a/spec/lib/gitlab/usage/metrics/instrumentations/aggregated_metric_spec.rb b/spec/lib/gitlab/usage/metrics/instrumentations/aggregated_metric_spec.rb index 3e7b13e21c1..f6b9da68184 100644 --- a/spec/lib/gitlab/usage/metrics/instrumentations/aggregated_metric_spec.rb +++ b/spec/lib/gitlab/usage/metrics/instrumentations/aggregated_metric_spec.rb @@ -2,7 +2,8 @@ require 'spec_helper' -RSpec.describe Gitlab::Usage::Metrics::Instrumentations::AggregatedMetric, :clean_gitlab_redis_shared_state do +RSpec.describe Gitlab::Usage::Metrics::Instrumentations::AggregatedMetric, :clean_gitlab_redis_shared_state, + feature_category: :service_ping do using RSpec::Parameterized::TableSyntax before do # weekly AND 1 weekly OR 2 diff --git a/spec/lib/gitlab/usage/metrics/instrumentations/database_metric_spec.rb b/spec/lib/gitlab/usage/metrics/instrumentations/database_metric_spec.rb index 8ca42a6f007..9fcec56d019 100644 --- a/spec/lib/gitlab/usage/metrics/instrumentations/database_metric_spec.rb +++ b/spec/lib/gitlab/usage/metrics/instrumentations/database_metric_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::Usage::Metrics::Instrumentations::DatabaseMetric do +RSpec.describe Gitlab::Usage::Metrics::Instrumentations::DatabaseMetric, feature_category: :service_ping do let(:database_metric_class) { Class.new(described_class) } subject do diff --git a/spec/lib/gitlab/usage/metrics/instrumentations/generic_metric_spec.rb b/spec/lib/gitlab/usage/metrics/instrumentations/generic_metric_spec.rb index cc4df696b37..e65d5d30d9d 100644 --- a/spec/lib/gitlab/usage/metrics/instrumentations/generic_metric_spec.rb +++ b/spec/lib/gitlab/usage/metrics/instrumentations/generic_metric_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::Usage::Metrics::Instrumentations::GenericMetric do +RSpec.describe Gitlab::Usage::Metrics::Instrumentations::GenericMetric, feature_category: :service_ping do shared_examples 'custom fallback' do |custom_fallback| subject do Class.new(described_class) do diff --git a/spec/lib/gitlab/usage/metrics/instrumentations/numbers_metric_spec.rb b/spec/lib/gitlab/usage/metrics/instrumentations/numbers_metric_spec.rb index 180c76d56f3..008e30eca9c 100644 --- a/spec/lib/gitlab/usage/metrics/instrumentations/numbers_metric_spec.rb +++ b/spec/lib/gitlab/usage/metrics/instrumentations/numbers_metric_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::Usage::Metrics::Instrumentations::NumbersMetric do +RSpec.describe Gitlab::Usage::Metrics::Instrumentations::NumbersMetric, feature_category: :service_ping do subject do described_class.tap do |metric_class| metric_class.operation :add diff --git a/spec/lib/gitlab/usage/metrics/instrumentations/redis_hll_metric_spec.rb b/spec/lib/gitlab/usage/metrics/instrumentations/redis_hll_metric_spec.rb index 97306051533..33868d365a5 100644 --- a/spec/lib/gitlab/usage/metrics/instrumentations/redis_hll_metric_spec.rb +++ b/spec/lib/gitlab/usage/metrics/instrumentations/redis_hll_metric_spec.rb @@ -2,7 +2,8 @@ require 'spec_helper' -RSpec.describe Gitlab::Usage::Metrics::Instrumentations::RedisHLLMetric, :clean_gitlab_redis_shared_state do +RSpec.describe Gitlab::Usage::Metrics::Instrumentations::RedisHLLMetric, :clean_gitlab_redis_shared_state, + feature_category: :service_ping do before do Gitlab::UsageDataCounters::HLLRedisCounter.track_event(:i_quickactions_approve, values: 1, time: 1.week.ago) Gitlab::UsageDataCounters::HLLRedisCounter.track_event(:i_quickactions_approve, values: 1, time: 2.weeks.ago) diff --git a/spec/lib/gitlab/usage/metrics/instrumentations/redis_metric_spec.rb b/spec/lib/gitlab/usage/metrics/instrumentations/redis_metric_spec.rb index c4d6edd43e1..90568f4731e 100644 --- a/spec/lib/gitlab/usage/metrics/instrumentations/redis_metric_spec.rb +++ b/spec/lib/gitlab/usage/metrics/instrumentations/redis_metric_spec.rb @@ -2,7 +2,8 @@ require 'spec_helper' -RSpec.describe Gitlab::Usage::Metrics::Instrumentations::RedisMetric, :clean_gitlab_redis_shared_state do +RSpec.describe Gitlab::Usage::Metrics::Instrumentations::RedisMetric, :clean_gitlab_redis_shared_state, + feature_category: :service_ping do before do 4.times do Gitlab::UsageDataCounters::SourceCodeCounter.count(:pushes) diff --git a/spec/models/ci/catalog/resource_spec.rb b/spec/models/ci/catalog/resource_spec.rb index 34268b92e1d..14c9d95bb11 100644 --- a/spec/models/ci/catalog/resource_spec.rb +++ b/spec/models/ci/catalog/resource_spec.rb @@ -174,15 +174,16 @@ RSpec.describe Ci::Catalog::Resource, feature_category: :pipeline_composition do end describe 'sync with project' do - shared_examples 'name and description of the catalog resource matches the project' do + shared_examples 'denormalized columns of the catalog resource match the project' do it do - expect(resource.reload.name).to eq(project.name) - expect(resource.reload.description).to eq(project.description) + expect(resource.name).to eq(project.name) + expect(resource.description).to eq(project.description) + expect(resource.visibility_level).to eq(project.visibility_level) end end context 'when the catalog resource is created' do - it_behaves_like 'name and description of the catalog resource matches the project' + it_behaves_like 'denormalized columns of the catalog resource match the project' end context 'when the project name is updated' do @@ -190,7 +191,7 @@ RSpec.describe Ci::Catalog::Resource, feature_category: :pipeline_composition do project.update!(name: 'My new project name') end - it_behaves_like 'name and description of the catalog resource matches the project' + it_behaves_like 'denormalized columns of the catalog resource match the project' end context 'when the project description is updated' do @@ -198,7 +199,15 @@ RSpec.describe Ci::Catalog::Resource, feature_category: :pipeline_composition do project.update!(description: 'My new description') end - it_behaves_like 'name and description of the catalog resource matches the project' + it_behaves_like 'denormalized columns of the catalog resource match the project' + end + + context 'when the project visibility_level is updated' do + before do + project.update!(visibility_level: 10) + end + + it_behaves_like 'denormalized columns of the catalog resource match the project' end end end diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index ce896af0799..096edb40511 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -9120,18 +9120,20 @@ RSpec.describe Project, factory_default: :keep, feature_category: :groups_and_pr end end + # TODO: Remove/update this spec after background syncing is implemented. See https://gitlab.com/gitlab-org/gitlab/-/issues/429376. describe '#update_catalog_resource' do let_it_be_with_reload(:project) { create(:project, name: 'My project name', description: 'My description') } - let_it_be(:resource) { create(:ci_catalog_resource, project: project) } + let_it_be_with_reload(:resource) { create(:ci_catalog_resource, project: project) } - shared_examples 'name and description of the catalog resource matches the project' do + shared_examples 'name, description, and visibility_level of the catalog resource match the project' do it do expect(project).to receive(:update_catalog_resource).once.and_call_original project.save! - expect(resource.reload.name).to eq(project.name) - expect(resource.reload.description).to eq(project.description) + expect(resource.name).to eq(project.name) + expect(resource.description).to eq(project.description) + expect(resource.visibility_level).to eq(project.visibility_level) end end @@ -9140,7 +9142,7 @@ RSpec.describe Project, factory_default: :keep, feature_category: :groups_and_pr project.name = 'My new project name' end - it_behaves_like 'name and description of the catalog resource matches the project' + it_behaves_like 'name, description, and visibility_level of the catalog resource match the project' end context 'when the project description is updated' do @@ -9148,10 +9150,18 @@ RSpec.describe Project, factory_default: :keep, feature_category: :groups_and_pr project.description = 'My new description' end - it_behaves_like 'name and description of the catalog resource matches the project' + it_behaves_like 'name, description, and visibility_level of the catalog resource match the project' end - context 'when neither the project name nor description are updated' do + context 'when the project visibility_level is updated' do + before do + project.visibility_level = 10 + end + + it_behaves_like 'name, description, and visibility_level of the catalog resource match the project' + end + + context 'when neither the project name, description, nor visibility_level are updated' do it 'does not call update_catalog_resource' do expect(project).not_to receive(:update_catalog_resource) diff --git a/spec/models/upload_spec.rb b/spec/models/upload_spec.rb index 27e2060a94b..ff38edb73b6 100644 --- a/spec/models/upload_spec.rb +++ b/spec/models/upload_spec.rb @@ -266,7 +266,7 @@ RSpec.describe Upload do it 'updates project statistics when upload is added' do expect(ProjectCacheWorker).to receive(:perform_async) - .with(project.id, [], [:uploads_size]) + .with(project.id, [], ['uploads_size']) subject.save! end @@ -275,7 +275,7 @@ RSpec.describe Upload do subject.save! expect(ProjectCacheWorker).to receive(:perform_async) - .with(project.id, [], [:uploads_size]) + .with(project.id, [], ['uploads_size']) subject.destroy! end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 1c4b0fafc94..fd4b3dbb548 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -44,6 +44,9 @@ RSpec.describe User, feature_category: :user_profile do it { is_expected.to delegate_method(:time_display_relative).to(:user_preference) } it { is_expected.to delegate_method(:time_display_relative=).to(:user_preference).with_arguments(:args) } + it { is_expected.to delegate_method(:time_display_format).to(:user_preference) } + it { is_expected.to delegate_method(:time_display_format=).to(:user_preference).with_arguments(:args) } + it { is_expected.to delegate_method(:show_whitespace_in_diffs).to(:user_preference) } it { is_expected.to delegate_method(:show_whitespace_in_diffs=).to(:user_preference).with_arguments(:args) } diff --git a/spec/policies/project_policy_spec.rb b/spec/policies/project_policy_spec.rb index 7cd8879e114..fda889ff422 100644 --- a/spec/policies/project_policy_spec.rb +++ b/spec/policies/project_policy_spec.rb @@ -2395,44 +2395,48 @@ RSpec.describe ProjectPolicy, feature_category: :system_access do developer_permissions + [:create_cluster, :read_cluster, :update_cluster, :admin_cluster, :admin_terraform_state, :admin_project_google_cloud] end - where(:project_visibility, :access_level, :role, :allowed) do - :public | ProjectFeature::ENABLED | :maintainer | true - :public | ProjectFeature::ENABLED | :developer | true - :public | ProjectFeature::ENABLED | :guest | true - :public | ProjectFeature::ENABLED | :anonymous | true - :public | ProjectFeature::PRIVATE | :maintainer | true - :public | ProjectFeature::PRIVATE | :developer | true - :public | ProjectFeature::PRIVATE | :guest | true - :public | ProjectFeature::PRIVATE | :anonymous | false - :public | ProjectFeature::DISABLED | :maintainer | false - :public | ProjectFeature::DISABLED | :developer | false - :public | ProjectFeature::DISABLED | :guest | false - :public | ProjectFeature::DISABLED | :anonymous | false - :internal | ProjectFeature::ENABLED | :maintainer | true - :internal | ProjectFeature::ENABLED | :developer | true - :internal | ProjectFeature::ENABLED | :guest | true - :internal | ProjectFeature::ENABLED | :anonymous | false - :internal | ProjectFeature::PRIVATE | :maintainer | true - :internal | ProjectFeature::PRIVATE | :developer | true - :internal | ProjectFeature::PRIVATE | :guest | true - :internal | ProjectFeature::PRIVATE | :anonymous | false - :internal | ProjectFeature::DISABLED | :maintainer | false - :internal | ProjectFeature::DISABLED | :developer | false - :internal | ProjectFeature::DISABLED | :guest | false - :internal | ProjectFeature::DISABLED | :anonymous | false - :private | ProjectFeature::ENABLED | :maintainer | true - :private | ProjectFeature::ENABLED | :developer | true - :private | ProjectFeature::ENABLED | :guest | true - :private | ProjectFeature::ENABLED | :anonymous | false - :private | ProjectFeature::PRIVATE | :maintainer | true - :private | ProjectFeature::PRIVATE | :developer | true - :private | ProjectFeature::PRIVATE | :guest | true - :private | ProjectFeature::PRIVATE | :anonymous | false - :private | ProjectFeature::DISABLED | :maintainer | false - :private | ProjectFeature::DISABLED | :developer | false - :private | ProjectFeature::DISABLED | :guest | false - :private | ProjectFeature::DISABLED | :anonymous | false - end + shared_context 'with permission matrix' do + where(:project_visibility, :access_level, :role, :allowed) do + :public | ProjectFeature::ENABLED | :maintainer | true + :public | ProjectFeature::ENABLED | :developer | true + :public | ProjectFeature::ENABLED | :guest | true + :public | ProjectFeature::ENABLED | :anonymous | true + :public | ProjectFeature::PRIVATE | :maintainer | true + :public | ProjectFeature::PRIVATE | :developer | true + :public | ProjectFeature::PRIVATE | :guest | true + :public | ProjectFeature::PRIVATE | :anonymous | false + :public | ProjectFeature::DISABLED | :maintainer | false + :public | ProjectFeature::DISABLED | :developer | false + :public | ProjectFeature::DISABLED | :guest | false + :public | ProjectFeature::DISABLED | :anonymous | false + :internal | ProjectFeature::ENABLED | :maintainer | true + :internal | ProjectFeature::ENABLED | :developer | true + :internal | ProjectFeature::ENABLED | :guest | true + :internal | ProjectFeature::ENABLED | :anonymous | false + :internal | ProjectFeature::PRIVATE | :maintainer | true + :internal | ProjectFeature::PRIVATE | :developer | true + :internal | ProjectFeature::PRIVATE | :guest | true + :internal | ProjectFeature::PRIVATE | :anonymous | false + :internal | ProjectFeature::DISABLED | :maintainer | false + :internal | ProjectFeature::DISABLED | :developer | false + :internal | ProjectFeature::DISABLED | :guest | false + :internal | ProjectFeature::DISABLED | :anonymous | false + :private | ProjectFeature::ENABLED | :maintainer | true + :private | ProjectFeature::ENABLED | :developer | true + :private | ProjectFeature::ENABLED | :guest | true + :private | ProjectFeature::ENABLED | :anonymous | false + :private | ProjectFeature::PRIVATE | :maintainer | true + :private | ProjectFeature::PRIVATE | :developer | true + :private | ProjectFeature::PRIVATE | :guest | true + :private | ProjectFeature::PRIVATE | :anonymous | false + :private | ProjectFeature::DISABLED | :maintainer | false + :private | ProjectFeature::DISABLED | :developer | false + :private | ProjectFeature::DISABLED | :guest | false + :private | ProjectFeature::DISABLED | :anonymous | false + end + end + + include_context 'with permission matrix' with_them do let(:current_user) { user_subject(role) } @@ -2450,6 +2454,8 @@ RSpec.describe ProjectPolicy, feature_category: :system_access do end context 'when terraform state management is disabled' do + include_context 'with permission matrix' + before do stub_config(terraform_state: { enabled: false }) end diff --git a/spec/requests/api/graphql/mutations/notes/update/image_diff_note_spec.rb b/spec/requests/api/graphql/mutations/notes/update/image_diff_note_spec.rb index a5cd3c8b019..3f071a6d987 100644 --- a/spec/requests/api/graphql/mutations/notes/update/image_diff_note_spec.rb +++ b/spec/requests/api/graphql/mutations/notes/update/image_diff_note_spec.rb @@ -37,11 +37,13 @@ RSpec.describe 'Updating an image DiffNote', feature_category: :team_planning do end let!(:diff_note) do - create(:image_diff_note_on_merge_request, - noteable: noteable, - project: noteable.project, - note: original_body, - position: original_position) + create( + :image_diff_note_on_merge_request, + noteable: noteable, + project: noteable.project, + note: original_body, + position: original_position + ) end let(:mutation) do diff --git a/spec/requests/api/graphql/mutations/packages/cleanup/policy/update_spec.rb b/spec/requests/api/graphql/mutations/packages/cleanup/policy/update_spec.rb index 2540e06be9a..5843109f356 100644 --- a/spec/requests/api/graphql/mutations/packages/cleanup/policy/update_spec.rb +++ b/spec/requests/api/graphql/mutations/packages/cleanup/policy/update_spec.rb @@ -17,14 +17,16 @@ RSpec.describe 'Updating the packages cleanup policy', feature_category: :packag end let(:mutation) do - graphql_mutation(:update_packages_cleanup_policy, params, - <<~QUERY - packagesCleanupPolicy { - keepNDuplicatedPackageFiles - nextRunAt - } - errors - QUERY + graphql_mutation( + :update_packages_cleanup_policy, + params, + <<~QUERY + packagesCleanupPolicy { + keepNDuplicatedPackageFiles + nextRunAt + } + errors + QUERY ) end diff --git a/spec/requests/api/graphql/mutations/release_asset_links/update_spec.rb b/spec/requests/api/graphql/mutations/release_asset_links/update_spec.rb index 45028cba3ae..fdd4de865ad 100644 --- a/spec/requests/api/graphql/mutations/release_asset_links/update_spec.rb +++ b/spec/requests/api/graphql/mutations/release_asset_links/update_spec.rb @@ -10,12 +10,14 @@ RSpec.describe 'Updating an existing release asset link', feature_category: :rel let_it_be(:developer) { create(:user).tap { |u| project.add_developer(u) } } let_it_be(:release_link) do - create(:release_link, - release: release, - name: 'link name', - url: 'https://example.com/url', - filepath: '/permanent/path', - link_type: 'package') + create( + :release_link, + release: release, + name: 'link name', + url: 'https://example.com/url', + filepath: '/permanent/path', + link_type: 'package' + ) end let(:current_user) { developer } diff --git a/spec/requests/api/graphql/mutations/snippets/create_spec.rb b/spec/requests/api/graphql/mutations/snippets/create_spec.rb index 338964e094f..7094cb807b2 100644 --- a/spec/requests/api/graphql/mutations/snippets/create_spec.rb +++ b/spec/requests/api/graphql/mutations/snippets/create_spec.rb @@ -42,7 +42,7 @@ RSpec.describe 'Creating a Snippet', feature_category: :source_code_management d let(:current_user) { nil } it_behaves_like 'a mutation that returns top-level errors', - errors: [Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR] + errors: [Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR] it 'does not create the Snippet' do expect do @@ -122,7 +122,7 @@ RSpec.describe 'Creating a Snippet', feature_category: :source_code_management d let(:project_path) { 'foobar' } it_behaves_like 'a mutation that returns top-level errors', - errors: [Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR] + errors: [Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR] end context 'when the feature is disabled' do @@ -131,7 +131,7 @@ RSpec.describe 'Creating a Snippet', feature_category: :source_code_management d end it_behaves_like 'a mutation that returns top-level errors', - errors: [Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR] + errors: [Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR] end it_behaves_like 'snippet edit usage data counters' diff --git a/spec/requests/api/graphql/mutations/snippets/destroy_spec.rb b/spec/requests/api/graphql/mutations/snippets/destroy_spec.rb index 186b60a1dff..7b0de7a9fba 100644 --- a/spec/requests/api/graphql/mutations/snippets/destroy_spec.rb +++ b/spec/requests/api/graphql/mutations/snippets/destroy_spec.rb @@ -24,7 +24,7 @@ RSpec.describe 'Destroying a Snippet', feature_category: :source_code_management let(:current_user) { create(:user) } it_behaves_like 'a mutation that returns top-level errors', - errors: [Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR] + errors: [Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR] it 'does not destroy the Snippet' do expect do diff --git a/spec/requests/api/graphql/mutations/snippets/mark_as_spam_spec.rb b/spec/requests/api/graphql/mutations/snippets/mark_as_spam_spec.rb index 9a8c027da8a..6fd41437ce4 100644 --- a/spec/requests/api/graphql/mutations/snippets/mark_as_spam_spec.rb +++ b/spec/requests/api/graphql/mutations/snippets/mark_as_spam_spec.rb @@ -40,7 +40,7 @@ RSpec.describe 'Mark snippet as spam', feature_category: :source_code_management let(:current_user) { other_user } it_behaves_like 'a mutation that returns top-level errors', - errors: [Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR] + errors: [Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR] it_behaves_like 'does not mark the snippet as spam' end diff --git a/spec/requests/api/graphql/mutations/snippets/update_spec.rb b/spec/requests/api/graphql/mutations/snippets/update_spec.rb index 78df78cb2a0..0bc475c7105 100644 --- a/spec/requests/api/graphql/mutations/snippets/update_spec.rb +++ b/spec/requests/api/graphql/mutations/snippets/update_spec.rb @@ -46,7 +46,7 @@ RSpec.describe 'Updating a Snippet', feature_category: :source_code_management d let(:current_user) { create(:user) } it_behaves_like 'a mutation that returns top-level errors', - errors: [Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR] + errors: [Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR] it 'does not update the Snippet' do expect do @@ -118,13 +118,15 @@ RSpec.describe 'Updating a Snippet', feature_category: :source_code_management d describe 'PersonalSnippet' do let(:snippet) do - create(:personal_snippet, - :private, - :repository, - file_name: original_file_name, - title: original_title, - content: original_content, - description: original_description) + create( + :personal_snippet, + :private, + :repository, + file_name: original_file_name, + title: original_title, + content: original_content, + description: original_description + ) end it_behaves_like 'graphql update actions' @@ -139,15 +141,17 @@ RSpec.describe 'Updating a Snippet', feature_category: :source_code_management d let_it_be(:project) { create(:project, :private) } let(:snippet) do - create(:project_snippet, - :private, - :repository, - project: project, - author: create(:user), - file_name: original_file_name, - title: original_title, - content: original_content, - description: original_description) + create( + :project_snippet, + :private, + :repository, + project: project, + author: create(:user), + file_name: original_file_name, + title: original_title, + content: original_content, + description: original_description + ) end context 'when the author is not a member of the project' do diff --git a/spec/requests/api/graphql/mutations/todos/mark_all_done_spec.rb b/spec/requests/api/graphql/mutations/todos/mark_all_done_spec.rb index c611c6ee2a1..429aa06d9f1 100644 --- a/spec/requests/api/graphql/mutations/todos/mark_all_done_spec.rb +++ b/spec/requests/api/graphql/mutations/todos/mark_all_done_spec.rb @@ -21,12 +21,14 @@ RSpec.describe 'Marking all todos done', feature_category: :team_planning do let(:input) { {} } let(:mutation) do - graphql_mutation(:todos_mark_all_done, input, - <<-QL.strip_heredoc - clientMutationId - todos { id } - errors - QL + graphql_mutation( + :todos_mark_all_done, + input, + <<-QL.strip_heredoc + clientMutationId + todos { id } + errors + QL ) end diff --git a/spec/requests/api/graphql/mutations/todos/mark_done_spec.rb b/spec/requests/api/graphql/mutations/todos/mark_done_spec.rb index 60700d8024c..c09f89ef567 100644 --- a/spec/requests/api/graphql/mutations/todos/mark_done_spec.rb +++ b/spec/requests/api/graphql/mutations/todos/mark_done_spec.rb @@ -19,15 +19,17 @@ RSpec.describe 'Marking todos done', feature_category: :team_planning do let(:input) { { id: todo1.to_global_id.to_s } } let(:mutation) do - graphql_mutation(:todo_mark_done, input, - <<-QL.strip_heredoc - clientMutationId - errors - todo { - id - state - } - QL + graphql_mutation( + :todo_mark_done, + input, + <<-QL.strip_heredoc + clientMutationId + errors + todo { + id + state + } + QL ) end diff --git a/spec/requests/api/graphql/mutations/todos/restore_many_spec.rb b/spec/requests/api/graphql/mutations/todos/restore_many_spec.rb index 9daa243cf8e..4bbfc7b2f1d 100644 --- a/spec/requests/api/graphql/mutations/todos/restore_many_spec.rb +++ b/spec/requests/api/graphql/mutations/todos/restore_many_spec.rb @@ -20,15 +20,17 @@ RSpec.describe 'Restoring many Todos', feature_category: :team_planning do let(:input) { { ids: input_ids } } let(:mutation) do - graphql_mutation(:todo_restore_many, input, - <<-QL.strip_heredoc - clientMutationId - errors - todos { - id - state - } - QL + graphql_mutation( + :todo_restore_many, + input, + <<-QL.strip_heredoc + clientMutationId + errors + todos { + id + state + } + QL ) end diff --git a/spec/requests/api/graphql/mutations/todos/restore_spec.rb b/spec/requests/api/graphql/mutations/todos/restore_spec.rb index 868298763ec..1ebd04432be 100644 --- a/spec/requests/api/graphql/mutations/todos/restore_spec.rb +++ b/spec/requests/api/graphql/mutations/todos/restore_spec.rb @@ -19,15 +19,17 @@ RSpec.describe 'Restoring Todos', feature_category: :team_planning do let(:input) { { id: todo1.to_global_id.to_s } } let(:mutation) do - graphql_mutation(:todo_restore, input, - <<-QL.strip_heredoc - clientMutationId - errors - todo { - id - state - } - QL + graphql_mutation( + :todo_restore, + input, + <<-QL.strip_heredoc + clientMutationId + errors + todo { + id + state + } + QL ) end diff --git a/spec/services/web_hook_service_spec.rb b/spec/services/web_hook_service_spec.rb index b186d8ed0c2..c33273348f6 100644 --- a/spec/services/web_hook_service_spec.rb +++ b/spec/services/web_hook_service_spec.rb @@ -429,8 +429,8 @@ RSpec.describe WebHookService, :request_store, :clean_gitlab_redis_shared_state, .with( project_hook.id, hash_including(default_log_data.deep_stringify_keys), - :ok, - nil + 'ok', + '' ) service_instance.execute @@ -460,8 +460,8 @@ RSpec.describe WebHookService, :request_store, :clean_gitlab_redis_shared_state, response_status: 400 ).deep_stringify_keys ), - :failed, - nil + 'failed', + '' ) service_instance.execute @@ -484,8 +484,8 @@ RSpec.describe WebHookService, :request_store, :clean_gitlab_redis_shared_state, internal_error_message: 'Some HTTP Post error' ).deep_stringify_keys ), - :error, - nil + 'error', + '' ) service_instance.execute @@ -502,8 +502,8 @@ RSpec.describe WebHookService, :request_store, :clean_gitlab_redis_shared_state, .with( project_hook.id, hash_including(default_log_data.merge(response_body: '').deep_stringify_keys), - :ok, - nil + 'ok', + '' ) service_instance.execute @@ -523,8 +523,8 @@ RSpec.describe WebHookService, :request_store, :clean_gitlab_redis_shared_state, .with( project_hook.id, hash_including(default_log_data.merge(response_body: stripped_body).deep_stringify_keys), - :ok, - nil + 'ok', + '' ) service_instance.execute @@ -556,8 +556,8 @@ RSpec.describe WebHookService, :request_store, :clean_gitlab_redis_shared_state, .with( project_hook.id, hash_including(default_log_data.merge(response_headers: expected_response_headers).deep_stringify_keys), - :ok, - nil + 'ok', + '' ) service_instance.execute @@ -581,8 +581,8 @@ RSpec.describe WebHookService, :request_store, :clean_gitlab_redis_shared_state, .with( project_hook.id, hash_including(default_log_data.merge(response_headers: expected_response_headers).deep_stringify_keys), - :ok, - nil + 'ok', + '' ) service_instance.execute @@ -599,8 +599,8 @@ RSpec.describe WebHookService, :request_store, :clean_gitlab_redis_shared_state, .with( project_hook.id, hash_including(default_log_data.deep_stringify_keys), - :ok, - nil + 'ok', + '' ) .and_raise( Gitlab::SidekiqMiddleware::SizeLimiter::ExceedLimitError.new(WebHooks::LogExecutionWorker, 100, 50) @@ -612,8 +612,8 @@ RSpec.describe WebHookService, :request_store, :clean_gitlab_redis_shared_state, hash_including(default_log_data.merge( request_data: WebHookLog::OVERSIZE_REQUEST_DATA ).deep_stringify_keys), - :ok, - nil + 'ok', + '' ) .and_call_original .ordered diff --git a/spec/support/shared_examples/lib/gitlab/import/advance_stage_shared_examples.rb b/spec/support/shared_examples/lib/gitlab/import/advance_stage_shared_examples.rb index effa6a6f6f0..c172e73ce9e 100644 --- a/spec/support/shared_examples/lib/gitlab/import/advance_stage_shared_examples.rb +++ b/spec/support/shared_examples/lib/gitlab/import/advance_stage_shared_examples.rb @@ -4,7 +4,7 @@ RSpec.shared_examples Gitlab::Import::AdvanceStage do |factory:| let_it_be(:project) { create(:project) } let_it_be_with_reload(:import_state) { create(factory, :started, project: project, jid: '123') } let(:worker) { described_class.new } - let(:next_stage) { :finish } + let(:next_stage) { 'finish' } describe '#perform', :clean_gitlab_redis_shared_state do context 'when the project no longer exists' do @@ -60,7 +60,7 @@ RSpec.shared_examples Gitlab::Import::AdvanceStage do |factory:| end it 'schedules the next stage' do - next_worker = described_class::STAGES[next_stage] + next_worker = described_class::STAGES[next_stage.to_sym] expect_next_found_instance_of(import_state.class) do |state| expect(state).to receive(:refresh_jid_expiration) @@ -72,7 +72,7 @@ RSpec.shared_examples Gitlab::Import::AdvanceStage do |factory:| end it 'raises KeyError when the stage name is invalid' do - expect { worker.perform(project.id, { '123' => 2 }, :kittens) } + expect { worker.perform(project.id, { '123' => 2 }, 'kittens') } .to raise_error(KeyError) end end @@ -106,7 +106,7 @@ RSpec.shared_examples Gitlab::Import::AdvanceStage do |factory:| it 'advances to next stage' do freeze_time do - next_worker = described_class::STAGES[next_stage] + next_worker = described_class::STAGES[next_stage.to_sym] expect(next_worker).to receive(:perform_async).with(project.id) @@ -122,7 +122,7 @@ RSpec.shared_examples Gitlab::Import::AdvanceStage do |factory:| it 'logs error and fails import' do freeze_time do - next_worker = described_class::STAGES[next_stage] + next_worker = described_class::STAGES[next_stage.to_sym] expect(next_worker).not_to receive(:perform_async).with(project.id) expect_next_instance_of(described_class) do |klass| diff --git a/spec/workers/gitlab/bitbucket_import/advance_stage_worker_spec.rb b/spec/workers/gitlab/bitbucket_import/advance_stage_worker_spec.rb index c04ccafdcf8..673988a3275 100644 --- a/spec/workers/gitlab/bitbucket_import/advance_stage_worker_spec.rb +++ b/spec/workers/gitlab/bitbucket_import/advance_stage_worker_spec.rb @@ -32,7 +32,7 @@ RSpec.describe Gitlab::BitbucketImport::AdvanceStageWorker, :clean_gitlab_redis_ expect(described_class) .to receive(:perform_in) - .with(described_class::INTERVAL, project.id, { '123' => 1 }, :finish, Time.zone.now, 1) + .with(described_class::INTERVAL, project.id, { '123' => 1 }, 'finish', Time.zone.now.to_s, 1) worker.perform(project.id, { '123' => 2 }, :finish) end diff --git a/spec/workers/gitlab/github_import/stage/import_attachments_worker_spec.rb b/spec/workers/gitlab/github_import/stage/import_attachments_worker_spec.rb index 9a4b9106dae..c8b528593b9 100644 --- a/spec/workers/gitlab/github_import/stage/import_attachments_worker_spec.rb +++ b/spec/workers/gitlab/github_import/stage/import_attachments_worker_spec.rb @@ -51,7 +51,7 @@ RSpec.describe Gitlab::GithubImport::Stage::ImportAttachmentsWorker, feature_cat expect(Gitlab::GithubImport::AdvanceStageWorker) .to receive(:perform_async) - .with(project.id, { '123' => 2, '234' => 3, '345' => 4, '456' => 5 }, :protected_branches) + .with(project.id, { '123' => 2, '234' => 3, '345' => 4, '456' => 5 }, 'protected_branches') worker.import(client, project) end @@ -62,7 +62,7 @@ RSpec.describe Gitlab::GithubImport::Stage::ImportAttachmentsWorker, feature_cat it 'skips release attachments import and calls next stage' do importers.each { |importer| expect(importer[:klass]).not_to receive(:new) } expect(Gitlab::GithubImport::AdvanceStageWorker) - .to receive(:perform_async).with(project.id, {}, :protected_branches) + .to receive(:perform_async).with(project.id, {}, 'protected_branches') worker.import(client, project) end diff --git a/spec/workers/gitlab/github_import/stage/import_collaborators_worker_spec.rb b/spec/workers/gitlab/github_import/stage/import_collaborators_worker_spec.rb index 71170718721..6a55f575da8 100644 --- a/spec/workers/gitlab/github_import/stage/import_collaborators_worker_spec.rb +++ b/spec/workers/gitlab/github_import/stage/import_collaborators_worker_spec.rb @@ -35,7 +35,7 @@ RSpec.describe Gitlab::GithubImport::Stage::ImportCollaboratorsWorker, feature_c expect(Gitlab::GithubImport::AdvanceStageWorker) .to receive(:perform_async) - .with(project.id, { '123' => 2 }, :pull_requests_merged_by) + .with(project.id, { '123' => 2 }, 'pull_requests_merged_by') worker.import(client, project) end @@ -49,7 +49,7 @@ RSpec.describe Gitlab::GithubImport::Stage::ImportCollaboratorsWorker, feature_c expect(Gitlab::GithubImport::AdvanceStageWorker) .to receive(:perform_async) - .with(project.id, {}, :pull_requests_merged_by) + .with(project.id, {}, 'pull_requests_merged_by') worker.import(client, project) end @@ -63,7 +63,7 @@ RSpec.describe Gitlab::GithubImport::Stage::ImportCollaboratorsWorker, feature_c expect(Gitlab::GithubImport::AdvanceStageWorker) .to receive(:perform_async) - .with(project.id, {}, :pull_requests_merged_by) + .with(project.id, {}, 'pull_requests_merged_by') worker.import(client, project) end diff --git a/spec/workers/gitlab/github_import/stage/import_issue_events_worker_spec.rb b/spec/workers/gitlab/github_import/stage/import_issue_events_worker_spec.rb index 4b4d6a5b625..bad3a5beb0e 100644 --- a/spec/workers/gitlab/github_import/stage/import_issue_events_worker_spec.rb +++ b/spec/workers/gitlab/github_import/stage/import_issue_events_worker_spec.rb @@ -33,7 +33,7 @@ RSpec.describe Gitlab::GithubImport::Stage::ImportIssueEventsWorker, feature_cat expect(Gitlab::GithubImport::AdvanceStageWorker) .to receive(:perform_async) - .with(project.id, { '123' => 2 }, :notes) + .with(project.id, { '123' => 2 }, 'notes') worker.import(client, project) end @@ -44,7 +44,7 @@ RSpec.describe Gitlab::GithubImport::Stage::ImportIssueEventsWorker, feature_cat it 'skips issue events import and calls next stage' do expect(Gitlab::GithubImport::Importer::SingleEndpointIssueEventsImporter).not_to receive(:new) - expect(Gitlab::GithubImport::AdvanceStageWorker).to receive(:perform_async).with(project.id, {}, :notes) + expect(Gitlab::GithubImport::AdvanceStageWorker).to receive(:perform_async).with(project.id, {}, 'notes') worker.import(client, project) end diff --git a/spec/workers/gitlab/github_import/stage/import_issues_and_diff_notes_worker_spec.rb b/spec/workers/gitlab/github_import/stage/import_issues_and_diff_notes_worker_spec.rb index 7a5813122f4..10f6ebfbab9 100644 --- a/spec/workers/gitlab/github_import/stage/import_issues_and_diff_notes_worker_spec.rb +++ b/spec/workers/gitlab/github_import/stage/import_issues_and_diff_notes_worker_spec.rb @@ -35,7 +35,7 @@ RSpec.describe Gitlab::GithubImport::Stage::ImportIssuesAndDiffNotesWorker, feat expect(Gitlab::GithubImport::AdvanceStageWorker) .to receive(:perform_async) - .with(project.id, { '123' => 2 }, :issue_events) + .with(project.id, { '123' => 2 }, 'issue_events') worker.import(client, project) end diff --git a/spec/workers/gitlab/github_import/stage/import_lfs_objects_worker_spec.rb b/spec/workers/gitlab/github_import/stage/import_lfs_objects_worker_spec.rb index 5d476543743..40194a91b3a 100644 --- a/spec/workers/gitlab/github_import/stage/import_lfs_objects_worker_spec.rb +++ b/spec/workers/gitlab/github_import/stage/import_lfs_objects_worker_spec.rb @@ -24,7 +24,7 @@ RSpec.describe Gitlab::GithubImport::Stage::ImportLfsObjectsWorker, feature_cate expect(Gitlab::GithubImport::AdvanceStageWorker) .to receive(:perform_async) - .with(project.id, { '123' => 2 }, :finish) + .with(project.id, { '123' => 2 }, 'finish') worker.import(project) end diff --git a/spec/workers/gitlab/github_import/stage/import_notes_worker_spec.rb b/spec/workers/gitlab/github_import/stage/import_notes_worker_spec.rb index 9584708802a..69078a666a5 100644 --- a/spec/workers/gitlab/github_import/stage/import_notes_worker_spec.rb +++ b/spec/workers/gitlab/github_import/stage/import_notes_worker_spec.rb @@ -35,7 +35,7 @@ RSpec.describe Gitlab::GithubImport::Stage::ImportNotesWorker, feature_category: expect(Gitlab::GithubImport::AdvanceStageWorker) .to receive(:perform_async) - .with(project.id, { '123' => 2 }, :attachments) + .with(project.id, { '123' => 2 }, 'attachments') worker.import(client, project) end diff --git a/spec/workers/gitlab/github_import/stage/import_protected_branches_worker_spec.rb b/spec/workers/gitlab/github_import/stage/import_protected_branches_worker_spec.rb index 0bfae640e23..b73f8c6524d 100644 --- a/spec/workers/gitlab/github_import/stage/import_protected_branches_worker_spec.rb +++ b/spec/workers/gitlab/github_import/stage/import_protected_branches_worker_spec.rb @@ -27,7 +27,7 @@ RSpec.describe Gitlab::GithubImport::Stage::ImportProtectedBranchesWorker, featu expect(Gitlab::GithubImport::AdvanceStageWorker) .to receive(:perform_async) - .with(project.id, { '123' => 2 }, :lfs_objects) + .with(project.id, { '123' => 2 }, 'lfs_objects') worker.import(client, project) end diff --git a/spec/workers/gitlab/github_import/stage/import_pull_requests_merged_by_worker_spec.rb b/spec/workers/gitlab/github_import/stage/import_pull_requests_merged_by_worker_spec.rb index 158efce2a9e..b214f6a97d4 100644 --- a/spec/workers/gitlab/github_import/stage/import_pull_requests_merged_by_worker_spec.rb +++ b/spec/workers/gitlab/github_import/stage/import_pull_requests_merged_by_worker_spec.rb @@ -26,7 +26,7 @@ RSpec.describe Gitlab::GithubImport::Stage::ImportPullRequestsMergedByWorker, fe expect(Gitlab::GithubImport::AdvanceStageWorker) .to receive(:perform_async) - .with(project.id, { '123' => 2 }, :pull_request_review_requests) + .with(project.id, { '123' => 2 }, 'pull_request_review_requests') worker.import(client, project) end diff --git a/spec/workers/gitlab/github_import/stage/import_pull_requests_review_requests_worker_spec.rb b/spec/workers/gitlab/github_import/stage/import_pull_requests_review_requests_worker_spec.rb index 8f71a18036b..4468de7e691 100644 --- a/spec/workers/gitlab/github_import/stage/import_pull_requests_review_requests_worker_spec.rb +++ b/spec/workers/gitlab/github_import/stage/import_pull_requests_review_requests_worker_spec.rb @@ -24,7 +24,7 @@ RSpec.describe Gitlab::GithubImport::Stage::ImportPullRequestsReviewRequestsWork expect(Gitlab::GithubImport::AdvanceStageWorker) .to receive(:perform_async) - .with(project.id, { '123' => 2 }, :pull_request_reviews) + .with(project.id, { '123' => 2 }, 'pull_request_reviews') worker.import(client, project) end diff --git a/spec/workers/gitlab/github_import/stage/import_pull_requests_reviews_worker_spec.rb b/spec/workers/gitlab/github_import/stage/import_pull_requests_reviews_worker_spec.rb index f783baea349..48b41435adb 100644 --- a/spec/workers/gitlab/github_import/stage/import_pull_requests_reviews_worker_spec.rb +++ b/spec/workers/gitlab/github_import/stage/import_pull_requests_reviews_worker_spec.rb @@ -27,7 +27,7 @@ RSpec.describe Gitlab::GithubImport::Stage::ImportPullRequestsReviewsWorker, fea expect(Gitlab::GithubImport::AdvanceStageWorker) .to receive(:perform_async) - .with(project.id, { '123' => 2 }, :issues_and_diff_notes) + .with(project.id, { '123' => 2 }, 'issues_and_diff_notes') worker.import(client, project) end diff --git a/spec/workers/gitlab/github_import/stage/import_pull_requests_worker_spec.rb b/spec/workers/gitlab/github_import/stage/import_pull_requests_worker_spec.rb index c2b97335229..2ea66d8cdf3 100644 --- a/spec/workers/gitlab/github_import/stage/import_pull_requests_worker_spec.rb +++ b/spec/workers/gitlab/github_import/stage/import_pull_requests_worker_spec.rb @@ -35,7 +35,7 @@ RSpec.describe Gitlab::GithubImport::Stage::ImportPullRequestsWorker, feature_ca expect(Gitlab::GithubImport::AdvanceStageWorker) .to receive(:perform_async) - .with(project.id, { '123' => 2 }, :collaborators) + .with(project.id, { '123' => 2 }, 'collaborators') expect(MergeRequest).to receive(:track_target_project_iid!) @@ -64,7 +64,7 @@ RSpec.describe Gitlab::GithubImport::Stage::ImportPullRequestsWorker, feature_ca expect(Gitlab::GithubImport::AdvanceStageWorker) .to receive(:perform_async) - .with(project.id, { '123' => 2 }, :collaborators) + .with(project.id, { '123' => 2 }, 'collaborators') expect(MergeRequest).not_to receive(:track_target_project_iid!) |