From 27852d1997e461079865ca6bd35145ed5cc5ccaf Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Fri, 25 Sep 2020 21:09:51 +0000 Subject: [PATCH] Add latest changes from gitlab-org/gitlab@master --- app/assets/javascripts/behaviors/index.js | 3 ++ .../javascripts/behaviors/load_startup_css.js | 15 +++++++ .../admin/application_settings_controller.rb | 3 ++ .../admin/integrations_controller.rb | 3 +- .../concerns/integrations_actions.rb | 2 +- app/helpers/preferences_helper.rb | 4 +- app/helpers/services_helper.rb | 4 ++ app/models/ci/pipeline.rb | 2 +- .../merge_request_poll_widget_entity.rb | 12 +---- .../dashboard/_billable_users_text.html.haml | 1 + app/views/admin/dashboard/stats.html.haml | 2 - app/views/layouts/_head.html.haml | 2 +- app/views/layouts/_startup_css.haml | 2 +- .../layouts/_startup_css_activation.haml | 1 - .../layouts/nav/sidebar/_admin.html.haml | 9 ++-- app/views/profiles/preferences/show.html.haml | 2 +- .../periodic_recalculate_worker.rb | 4 +- .../user_refresh_over_user_range_worker.rb | 4 +- app/workers/propagate_integration_worker.rb | 3 +- ...tance-level-integrations-on-gitlab-com.yml | 5 +++ .../246793-mr-coverage-only-latest-build.yml | 5 +++ changelogs/unreleased/fix-theme-switcher.yml | 5 +++ .../development/cleanup_lfs_during_gc.yml | 6 +-- .../development/group_export_ndjson.yml | 6 +-- .../development/group_import_ndjson.yml | 6 +-- ...erge_request_short_pipeline_serializer.yml | 7 --- .../development/migrate_user_mentions.yml | 4 +- .../development/paginated_notes.yml | 6 +-- ...ic_project_authorization_recalculation.yml | 7 --- .../repack_after_shard_migration.yml | 6 +-- ...ect_authorization_project_share_worker.yml | 6 +-- ...cialized_project_authorization_workers.yml | 6 +-- .../store_mentioned_users_to_db.yml | 4 +- doc/.vale/gitlab/InclusionAbleism.yml | 2 +- doc/.vale/gitlab/InclusionCultural.yml | 2 +- doc/user/clusters/agent/index.md | 17 +++++-- lib/gitlab/themes.rb | 24 +++++----- locale/gitlab.pot | 12 ++--- .../application_settings_controller_spec.rb | 31 +++++++++++++ .../admin/integrations_controller_spec.rb | 14 +++++- spec/features/admin/dashboard_spec.rb | 6 +-- .../behaviors/load_startup_css_spec.js | 44 +++++++++++++++++++ spec/lib/gitlab/themes_spec.rb | 14 ++++++ spec/models/ci/pipeline_spec.rb | 10 +++++ .../merge_request_poll_widget_entity_spec.rb | 27 ------------ .../admin/dashboard/index.html.haml_spec.rb | 2 +- .../nav/sidebar/_admin.html.haml_spec.rb | 18 ++++++++ .../preferences/show.html.haml_spec.rb | 8 ++++ .../periodic_recalculate_worker_spec.rb | 12 ----- ...ser_refresh_over_user_range_worker_spec.rb | 12 ----- 50 files changed, 261 insertions(+), 151 deletions(-) create mode 100644 app/assets/javascripts/behaviors/load_startup_css.js create mode 100644 app/views/admin/dashboard/_billable_users_text.html.haml create mode 100644 changelogs/unreleased/238570-hide-instance-level-integrations-on-gitlab-com.yml create mode 100644 changelogs/unreleased/246793-mr-coverage-only-latest-build.yml create mode 100644 changelogs/unreleased/fix-theme-switcher.yml delete mode 100644 config/feature_flags/development/merge_request_short_pipeline_serializer.yml delete mode 100644 config/feature_flags/development/periodic_project_authorization_recalculation.yml create mode 100644 spec/frontend/behaviors/load_startup_css_spec.js diff --git a/app/assets/javascripts/behaviors/index.js b/app/assets/javascripts/behaviors/index.js index fd12c282b62..613309a1c5a 100644 --- a/app/assets/javascripts/behaviors/index.js +++ b/app/assets/javascripts/behaviors/index.js @@ -13,6 +13,9 @@ import './toggler_behavior'; import './preview_markdown'; import initCollapseSidebarOnWindowResize from './collapse_sidebar_on_window_resize'; import initSelect2Dropdowns from './select2'; +import { loadStartupCSS } from './load_startup_css'; + +loadStartupCSS(); installGlEmojiElement(); diff --git a/app/assets/javascripts/behaviors/load_startup_css.js b/app/assets/javascripts/behaviors/load_startup_css.js new file mode 100644 index 00000000000..1d7bf716475 --- /dev/null +++ b/app/assets/javascripts/behaviors/load_startup_css.js @@ -0,0 +1,15 @@ +export const loadStartupCSS = () => { + // We need to fallback to dispatching `load` in case our event listener was added too late + // or the browser environment doesn't load media=print. + // Do this on `window.load` so that the default deferred behavior takes precedence. + // https://gitlab.com/gitlab-org/gitlab/-/issues/239357 + window.addEventListener( + 'load', + () => { + document + .querySelectorAll('link[media=print]') + .forEach(x => x.dispatchEvent(new Event('load'))); + }, + { once: true }, + ); +}; diff --git a/app/controllers/admin/application_settings_controller.rb b/app/controllers/admin/application_settings_controller.rb index 73f71f7ad55..c05153921fe 100644 --- a/app/controllers/admin/application_settings_controller.rb +++ b/app/controllers/admin/application_settings_controller.rb @@ -2,6 +2,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController include InternalRedirect + include ServicesHelper # NOTE: Use @application_setting in this controller when you need to access # application_settings after it has been modified. This is because the @@ -32,6 +33,8 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController end def integrations + return not_found unless instance_level_integrations? + @integrations = Service.find_or_initialize_all(Service.for_instance).sort_by(&:title) end diff --git a/app/controllers/admin/integrations_controller.rb b/app/controllers/admin/integrations_controller.rb index 1e2a99f7078..003a5d427f5 100644 --- a/app/controllers/admin/integrations_controller.rb +++ b/app/controllers/admin/integrations_controller.rb @@ -2,6 +2,7 @@ class Admin::IntegrationsController < Admin::ApplicationController include IntegrationsActions + include ServicesHelper private @@ -10,7 +11,7 @@ class Admin::IntegrationsController < Admin::ApplicationController end def integrations_enabled? - true + instance_level_integrations? end def scoped_edit_integration_path(integration) diff --git a/app/controllers/concerns/integrations_actions.rb b/app/controllers/concerns/integrations_actions.rb index 6060dc729af..39f63bbaaec 100644 --- a/app/controllers/concerns/integrations_actions.rb +++ b/app/controllers/concerns/integrations_actions.rb @@ -20,7 +20,7 @@ module IntegrationsActions respond_to do |format| format.html do if saved - PropagateIntegrationWorker.perform_async(integration.id, false) + PropagateIntegrationWorker.perform_async(integration.id) redirect_to scoped_edit_integration_path(integration), notice: success_message else render 'shared/integrations/edit' diff --git a/app/helpers/preferences_helper.rb b/app/helpers/preferences_helper.rb index 2c406641882..9bf819febb0 100644 --- a/app/helpers/preferences_helper.rb +++ b/app/helpers/preferences_helper.rb @@ -61,8 +61,8 @@ module PreferencesHelper @user_application_theme ||= Gitlab::Themes.for_user(current_user).css_class end - def user_application_theme_name - @user_application_theme_name ||= Gitlab::Themes.for_user(current_user).name.downcase.tr(' ', '_') + def user_application_theme_css_filename + @user_application_theme_css_filename ||= Gitlab::Themes.for_user(current_user).css_filename end def user_color_scheme diff --git a/app/helpers/services_helper.rb b/app/helpers/services_helper.rb index 6b5de73a831..ae59f84e7da 100644 --- a/app/helpers/services_helper.rb +++ b/app/helpers/services_helper.rb @@ -124,6 +124,10 @@ module ServicesHelper @group.present? && Feature.enabled?(:group_level_integrations, @group) end + def instance_level_integrations? + !Gitlab.com? + end + extend self private diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index 47eba685afe..7e9e24b2418 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -875,7 +875,7 @@ module Ci end def builds_with_coverage - builds.with_coverage + builds.latest.with_coverage end def has_reports?(reports_scope) diff --git a/app/serializers/merge_request_poll_widget_entity.rb b/app/serializers/merge_request_poll_widget_entity.rb index 41ab5005091..462fdcb8c4d 100644 --- a/app/serializers/merge_request_poll_widget_entity.rb +++ b/app/serializers/merge_request_poll_widget_entity.rb @@ -20,19 +20,11 @@ class MergeRequestPollWidgetEntity < Grape::Entity expose :merge_user, using: UserEntity expose :actual_head_pipeline, as: :pipeline, if: -> (mr, _) { presenter(mr).can_read_pipeline? } do |merge_request, options| - if Feature.enabled?(:merge_request_short_pipeline_serializer, merge_request.project, default_enabled: true) - MergeRequests::PipelineEntity.represent(merge_request.actual_head_pipeline, options) - else - PipelineDetailsEntity.represent(merge_request.actual_head_pipeline, options) - end + MergeRequests::PipelineEntity.represent(merge_request.actual_head_pipeline, options) end expose :merge_pipeline, if: ->(mr, _) { mr.merged? && can?(request.current_user, :read_pipeline, mr.target_project)} do |merge_request, options| - if Feature.enabled?(:merge_request_short_pipeline_serializer, merge_request.project, default_enabled: true) - MergeRequests::PipelineEntity.represent(merge_request.merge_pipeline, options) - else - PipelineDetailsEntity.represent(merge_request.merge_pipeline, options) - end + MergeRequests::PipelineEntity.represent(merge_request.merge_pipeline, options) end expose :default_merge_commit_message diff --git a/app/views/admin/dashboard/_billable_users_text.html.haml b/app/views/admin/dashboard/_billable_users_text.html.haml new file mode 100644 index 00000000000..e9485d23228 --- /dev/null +++ b/app/views/admin/dashboard/_billable_users_text.html.haml @@ -0,0 +1 @@ += s_('AdminArea|Active users') diff --git a/app/views/admin/dashboard/stats.html.haml b/app/views/admin/dashboard/stats.html.haml index 78707235cb5..9a89bf12365 100644 --- a/app/views/admin/dashboard/stats.html.haml +++ b/app/views/admin/dashboard/stats.html.haml @@ -50,11 +50,9 @@ = s_('AdminArea|Bots') %td.p-3.text-right = @users_statistics&.bots.to_i - %tr.bg-gray-light.gl-text-gray-900 %td.p-3 %strong - = s_('AdminArea|Active users') = render_if_exists 'admin/dashboard/billable_users_text' %td.p-3.text-right %strong diff --git a/app/views/layouts/_head.html.haml b/app/views/layouts/_head.html.haml index b741e6d5381..8c7c7024f9f 100644 --- a/app/views/layouts/_head.html.haml +++ b/app/views/layouts/_head.html.haml @@ -53,7 +53,7 @@ - else = stylesheet_link_tag_defer "application" - unless use_startup_css? - = stylesheet_link_tag_defer "themes/theme_#{user_application_theme_name}" + = stylesheet_link_tag_defer "themes/#{user_application_theme_css_filename}" if user_application_theme_css_filename = stylesheet_link_tag "disable_animations", media: "all" if Rails.env.test? || Gitlab.config.gitlab['disable_animations'] = stylesheet_link_tag_defer 'performance_bar' if performance_bar_enabled? diff --git a/app/views/layouts/_startup_css.haml b/app/views/layouts/_startup_css.haml index ea05157ed19..2f674f79b2f 100644 --- a/app/views/layouts/_startup_css.haml +++ b/app/views/layouts/_startup_css.haml @@ -3,5 +3,5 @@ - startup_filename = current_path?("sessions#new") ? 'signin' : user_application_theme == 'gl-dark' ? 'dark' : 'general' %style{ type: "text/css" } - = Rails.application.assets_manifest.find_sources("themes/theme_#{user_application_theme_name}.css").first.to_s.html_safe + = Rails.application.assets_manifest.find_sources("themes/#{user_application_theme_css_filename}.css").first.to_s.html_safe if user_application_theme_css_filename = Rails.application.assets_manifest.find_sources("startup/startup-#{startup_filename}.css").first.to_s.html_safe diff --git a/app/views/layouts/_startup_css_activation.haml b/app/views/layouts/_startup_css_activation.haml index 022b9a695bc..a426d686c34 100644 --- a/app/views/layouts/_startup_css_activation.haml +++ b/app/views/layouts/_startup_css_activation.haml @@ -7,4 +7,3 @@ const startupLinkLoadedEvent = new CustomEvent('CSSStartupLinkLoaded'); linkTag.addEventListener('load',function(){this.media='all';this.setAttribute('data-startupcss', 'loaded');document.dispatchEvent(startupLinkLoadedEvent);},{once: true}); }) -- return unless use_startup_css? diff --git a/app/views/layouts/nav/sidebar/_admin.html.haml b/app/views/layouts/nav/sidebar/_admin.html.haml index cb5277c02f0..0da4d4f7ddd 100644 --- a/app/views/layouts/nav/sidebar/_admin.html.haml +++ b/app/views/layouts/nav/sidebar/_admin.html.haml @@ -260,10 +260,11 @@ = link_to general_admin_application_settings_path, title: _('General'), class: 'qa-admin-settings-general-item' do %span = _('General') - = nav_link(path: ['application_settings#integrations', 'integrations#edit']) do - = link_to integrations_admin_application_settings_path, title: _('Integrations'), data: { qa_selector: 'integration_settings_link' } do - %span - = _('Integrations') + - if instance_level_integrations? + = nav_link(path: ['application_settings#integrations', 'integrations#edit']) do + = link_to integrations_admin_application_settings_path, title: _('Integrations'), data: { qa_selector: 'integration_settings_link' } do + %span + = _('Integrations') = nav_link(path: 'application_settings#repository') do = link_to repository_admin_application_settings_path, title: _('Repository'), class: 'qa-admin-settings-repository-item' do %span diff --git a/app/views/profiles/preferences/show.html.haml b/app/views/profiles/preferences/show.html.haml index 2c705886f47..ea1126fb30f 100644 --- a/app/views/profiles/preferences/show.html.haml +++ b/app/views/profiles/preferences/show.html.haml @@ -2,7 +2,7 @@ - @content_class = "limit-container-width" unless fluid_layout - Gitlab::Themes.each do |theme| - = stylesheet_link_tag "themes/theme_#{theme.css_class.gsub('ui-', '')}" + = stylesheet_link_tag "themes/#{theme.css_filename}" if theme.css_filename = form_for @user, url: profile_preferences_path, remote: true, method: :put, html: { class: 'row gl-mt-3 js-preferences-form' } do |f| .col-lg-4.application-theme#navigation-theme diff --git a/app/workers/authorized_project_update/periodic_recalculate_worker.rb b/app/workers/authorized_project_update/periodic_recalculate_worker.rb index 0d1ad67d7bb..78ffdbca4d6 100644 --- a/app/workers/authorized_project_update/periodic_recalculate_worker.rb +++ b/app/workers/authorized_project_update/periodic_recalculate_worker.rb @@ -12,9 +12,7 @@ module AuthorizedProjectUpdate idempotent! def perform - if ::Feature.enabled?(:periodic_project_authorization_recalculation, default_enabled: true) - AuthorizedProjectUpdate::PeriodicRecalculateService.new.execute - end + AuthorizedProjectUpdate::PeriodicRecalculateService.new.execute end end end diff --git a/app/workers/authorized_project_update/user_refresh_over_user_range_worker.rb b/app/workers/authorized_project_update/user_refresh_over_user_range_worker.rb index 336b1c5443e..9bd1ad2ed30 100644 --- a/app/workers/authorized_project_update/user_refresh_over_user_range_worker.rb +++ b/app/workers/authorized_project_update/user_refresh_over_user_range_worker.rb @@ -12,9 +12,7 @@ module AuthorizedProjectUpdate idempotent! def perform(start_user_id, end_user_id) - if ::Feature.enabled?(:periodic_project_authorization_recalculation, default_enabled: true) - AuthorizedProjectUpdate::RecalculateForUserRangeService.new(start_user_id, end_user_id).execute - end + AuthorizedProjectUpdate::RecalculateForUserRangeService.new(start_user_id, end_user_id).execute end end end diff --git a/app/workers/propagate_integration_worker.rb b/app/workers/propagate_integration_worker.rb index 68e38386372..bb954b12a25 100644 --- a/app/workers/propagate_integration_worker.rb +++ b/app/workers/propagate_integration_worker.rb @@ -7,7 +7,8 @@ class PropagateIntegrationWorker idempotent! loggable_arguments 1 - # Keep overwrite parameter for backwards compatibility. + # TODO: Keep overwrite parameter for backwards compatibility. Remove after >= 14.0 + # https://gitlab.com/gitlab-org/gitlab/-/issues/255382 def perform(integration_id, overwrite = nil) Admin::PropagateIntegrationService.propagate(Service.find(integration_id)) end diff --git a/changelogs/unreleased/238570-hide-instance-level-integrations-on-gitlab-com.yml b/changelogs/unreleased/238570-hide-instance-level-integrations-on-gitlab-com.yml new file mode 100644 index 00000000000..3a68c265a86 --- /dev/null +++ b/changelogs/unreleased/238570-hide-instance-level-integrations-on-gitlab-com.yml @@ -0,0 +1,5 @@ +--- +title: Hide instance-level integrations on GitLab.com +merge_request: 42808 +author: +type: changed diff --git a/changelogs/unreleased/246793-mr-coverage-only-latest-build.yml b/changelogs/unreleased/246793-mr-coverage-only-latest-build.yml new file mode 100644 index 00000000000..5bd6ef4739a --- /dev/null +++ b/changelogs/unreleased/246793-mr-coverage-only-latest-build.yml @@ -0,0 +1,5 @@ +--- +title: Do not show retried builds in the MR code coverage +merge_request: 42402 +author: Simon Lenz @koala7 +type: fixed diff --git a/changelogs/unreleased/fix-theme-switcher.yml b/changelogs/unreleased/fix-theme-switcher.yml new file mode 100644 index 00000000000..39c8dff2df9 --- /dev/null +++ b/changelogs/unreleased/fix-theme-switcher.yml @@ -0,0 +1,5 @@ +--- +title: Fix theme selector not working immediately for some themes +merge_request: 43239 +author: +type: fixed diff --git a/config/feature_flags/development/cleanup_lfs_during_gc.yml b/config/feature_flags/development/cleanup_lfs_during_gc.yml index 836784b1d9c..fdf34249f0b 100644 --- a/config/feature_flags/development/cleanup_lfs_during_gc.yml +++ b/config/feature_flags/development/cleanup_lfs_during_gc.yml @@ -1,7 +1,7 @@ --- name: cleanup_lfs_during_gc -introduced_by_url: -rollout_issue_url: -group: +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/38813 +rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/238605 +group: group::source code type: development default_enabled: false diff --git a/config/feature_flags/development/group_export_ndjson.yml b/config/feature_flags/development/group_export_ndjson.yml index af495df2e48..e156d1e0299 100644 --- a/config/feature_flags/development/group_export_ndjson.yml +++ b/config/feature_flags/development/group_export_ndjson.yml @@ -1,7 +1,7 @@ --- name: group_export_ndjson -introduced_by_url: -rollout_issue_url: -group: +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/29590 +rollout_issue_url: +group: import type: development default_enabled: true diff --git a/config/feature_flags/development/group_import_ndjson.yml b/config/feature_flags/development/group_import_ndjson.yml index cf438abe8cb..4a38debe286 100644 --- a/config/feature_flags/development/group_import_ndjson.yml +++ b/config/feature_flags/development/group_import_ndjson.yml @@ -1,7 +1,7 @@ --- name: group_import_ndjson -introduced_by_url: -rollout_issue_url: -group: +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/29716 +rollout_issue_url: +group: import type: development default_enabled: true diff --git a/config/feature_flags/development/merge_request_short_pipeline_serializer.yml b/config/feature_flags/development/merge_request_short_pipeline_serializer.yml deleted file mode 100644 index c24dd106547..00000000000 --- a/config/feature_flags/development/merge_request_short_pipeline_serializer.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -name: merge_request_short_pipeline_serializer -introduced_by_url: -rollout_issue_url: -group: -type: development -default_enabled: true diff --git a/config/feature_flags/development/migrate_user_mentions.yml b/config/feature_flags/development/migrate_user_mentions.yml index 3388fb020ad..5dd5667dfae 100644 --- a/config/feature_flags/development/migrate_user_mentions.yml +++ b/config/feature_flags/development/migrate_user_mentions.yml @@ -1,7 +1,7 @@ --- name: migrate_user_mentions -introduced_by_url: +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/34378 rollout_issue_url: -group: +group: group::project management type: development default_enabled: true diff --git a/config/feature_flags/development/paginated_notes.yml b/config/feature_flags/development/paginated_notes.yml index cd98b3b1bbf..a9209fbe4ae 100644 --- a/config/feature_flags/development/paginated_notes.yml +++ b/config/feature_flags/development/paginated_notes.yml @@ -1,7 +1,7 @@ --- name: paginated_notes -introduced_by_url: -rollout_issue_url: -group: +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/34628 +rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/254987 +group: group::source code type: development default_enabled: false diff --git a/config/feature_flags/development/periodic_project_authorization_recalculation.yml b/config/feature_flags/development/periodic_project_authorization_recalculation.yml deleted file mode 100644 index 90b9babcfca..00000000000 --- a/config/feature_flags/development/periodic_project_authorization_recalculation.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -name: periodic_project_authorization_recalculation -introduced_by_url: -rollout_issue_url: -group: -type: development -default_enabled: true diff --git a/config/feature_flags/development/repack_after_shard_migration.yml b/config/feature_flags/development/repack_after_shard_migration.yml index addfcf66537..18663a4e7af 100644 --- a/config/feature_flags/development/repack_after_shard_migration.yml +++ b/config/feature_flags/development/repack_after_shard_migration.yml @@ -1,7 +1,7 @@ --- name: repack_after_shard_migration -introduced_by_url: -rollout_issue_url: -group: +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/21502 +rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/195597 +group: group::source code type: development default_enabled: false diff --git a/config/feature_flags/development/specialized_project_authorization_project_share_worker.yml b/config/feature_flags/development/specialized_project_authorization_project_share_worker.yml index c09c5ad519b..951ea4b315f 100644 --- a/config/feature_flags/development/specialized_project_authorization_project_share_worker.yml +++ b/config/feature_flags/development/specialized_project_authorization_project_share_worker.yml @@ -1,7 +1,7 @@ --- name: specialized_project_authorization_project_share_worker -introduced_by_url: -rollout_issue_url: -group: +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/32864 +rollout_issue_url: +group: group::access type: development default_enabled: false diff --git a/config/feature_flags/development/specialized_project_authorization_workers.yml b/config/feature_flags/development/specialized_project_authorization_workers.yml index 7fceff532f3..48372cac765 100644 --- a/config/feature_flags/development/specialized_project_authorization_workers.yml +++ b/config/feature_flags/development/specialized_project_authorization_workers.yml @@ -1,7 +1,7 @@ --- name: specialized_project_authorization_workers -introduced_by_url: -rollout_issue_url: -group: +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/31377 +rollout_issue_url: +group: group::access type: development default_enabled: false diff --git a/config/feature_flags/development/store_mentioned_users_to_db.yml b/config/feature_flags/development/store_mentioned_users_to_db.yml index e19076f2b84..8b1e587b26b 100644 --- a/config/feature_flags/development/store_mentioned_users_to_db.yml +++ b/config/feature_flags/development/store_mentioned_users_to_db.yml @@ -1,7 +1,7 @@ --- name: store_mentioned_users_to_db -introduced_by_url: +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/19088 rollout_issue_url: -group: +group: group::project management type: development default_enabled: true diff --git a/doc/.vale/gitlab/InclusionAbleism.yml b/doc/.vale/gitlab/InclusionAbleism.yml index 5fd0f0c6be4..29b26547130 100644 --- a/doc/.vale/gitlab/InclusionAbleism.yml +++ b/doc/.vale/gitlab/InclusionAbleism.yml @@ -11,4 +11,4 @@ level: suggestion ignorecase: true swap: sanity (?:check|test): check for completeness - dummy: placeholder + dummy: placeholder, sample, fake diff --git a/doc/.vale/gitlab/InclusionCultural.yml b/doc/.vale/gitlab/InclusionCultural.yml index 1ab42bf15ee..5bfad84f100 100644 --- a/doc/.vale/gitlab/InclusionCultural.yml +++ b/doc/.vale/gitlab/InclusionCultural.yml @@ -12,5 +12,5 @@ ignorecase: true swap: blacklist(?:ed|ing|s)?: denylist whitelist(?:ed|ing|s)?: allowlist - master: primary + master: primary, main slave: secondary diff --git a/doc/user/clusters/agent/index.md b/doc/user/clusters/agent/index.md index ff4a3f58e03..f63306db5bb 100644 --- a/doc/user/clusters/agent/index.md +++ b/doc/user/clusters/agent/index.md @@ -177,9 +177,20 @@ Kubernetes resources required for the Agent to be installed. You can modify this example [`resources.yml` file](#example-resourcesyml-file) in the following ways: - You can replace `gitlab-agent` with ``. -- For the `kas-address` (Kubernetes Agent Server), you can replace - `grpc://host.docker.internal:5005` with the address of the `kas` agent initialized - in your Helm install. +- For the `kas-address` (Kubernetes Agent Server), the agent can use the WebSockets + or gRPC protocols to connect to the Agent Server. Depending on your cluster + configuration and GitLab architecture, you may need to use one or the other. + For the `gitlab-kas` Helm chart, an Ingress is created for the Agent Server using + the `/-/kubernetes-agent` endpoint. This can be used for the WebSockets protocol connection. + - Specify the `grpc` scheme (such as `grpc://gitlab-kas:5005`) to use gRPC directly. + Encrypted gRPC is not supported yet. Follow the + [Support TLS for gRPC communication issue](https://gitlab.com/gitlab-org/cluster-integration/gitlab-agent/-/issues/7) + for progress updates. + - Specify the `ws` scheme (such as `ws://gitlab-kas-ingress:80/-/kubernetes-agent`) + to use an unencrypted WebSockets connection. + - Specify the `wss` scheme (such as `wss://gitlab-kas-ingress:443/-/kubernetes-agent`) + to use an encrypted WebSockets connection. This is the recommended option if + installing the Agent into a separate cluster from your Agent Server. - If you defined your own secret name, replace `gitlab-agent-token` with your secret name. To apply this file, run the following command: diff --git a/lib/gitlab/themes.rb b/lib/gitlab/themes.rb index 72783a2d682..16e7b8a7eca 100644 --- a/lib/gitlab/themes.rb +++ b/lib/gitlab/themes.rb @@ -10,21 +10,21 @@ module Gitlab APPLICATION_DEFAULT = 1 # Struct class representing a single Theme - Theme = Struct.new(:id, :name, :css_class) + Theme = Struct.new(:id, :name, :css_class, :css_filename) # All available Themes THEMES = [ - Theme.new(1, 'Indigo', 'ui-indigo'), - Theme.new(6, 'Light Indigo', 'ui-light-indigo'), - Theme.new(4, 'Blue', 'ui-blue'), - Theme.new(7, 'Light Blue', 'ui-light-blue'), - Theme.new(5, 'Green', 'ui-green'), - Theme.new(8, 'Light Green', 'ui-light-green'), - Theme.new(9, 'Red', 'ui-red'), - Theme.new(10, 'Light Red', 'ui-light-red'), - Theme.new(2, 'Dark', 'ui-dark'), - Theme.new(3, 'Light', 'ui-light'), - Theme.new(11, 'Dark Mode (alpha)', 'gl-dark') + Theme.new(1, 'Indigo', 'ui-indigo', 'theme_indigo'), + Theme.new(6, 'Light Indigo', 'ui-light-indigo', 'theme_light_indigo'), + Theme.new(4, 'Blue', 'ui-blue', 'theme_blue'), + Theme.new(7, 'Light Blue', 'ui-light-blue', 'theme_light_blue'), + Theme.new(5, 'Green', 'ui-green', 'theme_green'), + Theme.new(8, 'Light Green', 'ui-light-green', 'theme_light_green'), + Theme.new(9, 'Red', 'ui-red', 'theme_red'), + Theme.new(10, 'Light Red', 'ui-light-red', 'theme_light_red'), + Theme.new(2, 'Dark', 'ui-dark', 'theme_dark'), + Theme.new(3, 'Light', 'ui-light', 'theme_light'), + Theme.new(11, 'Dark Mode (alpha)', 'gl-dark', nil) ].freeze # Convenience method to get a space-separated String of all the theme diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 6b3c901dee3..97075cc11a1 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -1465,12 +1465,6 @@ msgstr "" msgid "Active Sessions" msgstr "" -msgid "Active Users:" -msgstr "" - -msgid "Active users" -msgstr "" - msgid "Activity" msgstr "" @@ -3982,6 +3976,9 @@ msgstr "" msgid "Bi-weekly code coverage" msgstr "" +msgid "Billable Users:" +msgstr "" + msgid "Billing" msgstr "" @@ -27983,6 +27980,9 @@ msgstr "" msgid "Users" msgstr "" +msgid "Users in License" +msgstr "" + msgid "Users in License:" msgstr "" diff --git a/spec/controllers/admin/application_settings_controller_spec.rb b/spec/controllers/admin/application_settings_controller_spec.rb index 4f223811be8..ec7d18caa16 100644 --- a/spec/controllers/admin/application_settings_controller_spec.rb +++ b/spec/controllers/admin/application_settings_controller_spec.rb @@ -15,6 +15,37 @@ RSpec.describe Admin::ApplicationSettingsController do stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') end + describe 'GET #integrations' do + before do + sign_in(admin) + end + + context 'when GitLab.com' do + before do + allow(::Gitlab).to receive(:com?) { true } + end + + it 'returns 404' do + get :integrations + + expect(response).to have_gitlab_http_status(:not_found) + end + end + + context 'when not GitLab.com' do + before do + allow(::Gitlab).to receive(:com?) { false } + end + + it 'renders correct template' do + get :integrations + + expect(response).to have_gitlab_http_status(:ok) + expect(response).to render_template('admin/application_settings/integrations') + end + end + end + describe 'GET #usage_data with no access' do before do stub_usage_data_connections diff --git a/spec/controllers/admin/integrations_controller_spec.rb b/spec/controllers/admin/integrations_controller_spec.rb index 4b1806a43d2..1a13d016b73 100644 --- a/spec/controllers/admin/integrations_controller_spec.rb +++ b/spec/controllers/admin/integrations_controller_spec.rb @@ -20,6 +20,18 @@ RSpec.describe Admin::IntegrationsController do end end end + + context 'when GitLab.com' do + before do + allow(::Gitlab).to receive(:com?) { true } + end + + it 'returns 404' do + get :edit, params: { id: Service.available_services_names.sample } + + expect(response).to have_gitlab_http_status(:not_found) + end + end end describe '#update' do @@ -43,7 +55,7 @@ RSpec.describe Admin::IntegrationsController do end it 'calls to PropagateIntegrationWorker' do - expect(PropagateIntegrationWorker).to have_received(:perform_async).with(integration.id, false) + expect(PropagateIntegrationWorker).to have_received(:perform_async).with(integration.id) end end diff --git a/spec/features/admin/dashboard_spec.rb b/spec/features/admin/dashboard_spec.rb index 4ffa5e3be0b..acb8fb54e11 100644 --- a/spec/features/admin/dashboard_spec.rb +++ b/spec/features/admin/dashboard_spec.rb @@ -28,11 +28,9 @@ RSpec.describe 'admin visits dashboard' do describe 'Users statistic' do let_it_be(:users_statistics) { create(:users_statistics) } + let_it_be(:users_count_label) { Gitlab.ee? ? 'Billable users 71' : 'Active users 71' } it 'shows correct amounts of users', :aggregate_failures do - expected_active_users_text = Gitlab.ee? ? 'Active users (Billable users) 71' : 'Active users 71' - - sign_in(create(:admin)) visit admin_dashboard_stats_path expect(page).to have_content('Users without a Group and Project 23') @@ -42,9 +40,9 @@ RSpec.describe 'admin visits dashboard' do expect(page).to have_content('Users with highest role Maintainer 6') expect(page).to have_content('Users with highest role Owner 5') expect(page).to have_content('Bots 2') - expect(page).to have_content(expected_active_users_text) expect(page).to have_content('Blocked users 7') expect(page).to have_content('Total users 78') + expect(page).to have_content(users_count_label) end end end diff --git a/spec/frontend/behaviors/load_startup_css_spec.js b/spec/frontend/behaviors/load_startup_css_spec.js new file mode 100644 index 00000000000..81222ac5aaa --- /dev/null +++ b/spec/frontend/behaviors/load_startup_css_spec.js @@ -0,0 +1,44 @@ +import { setHTMLFixture } from 'helpers/fixtures'; +import { loadStartupCSS } from '~/behaviors/load_startup_css'; + +describe('behaviors/load_startup_css', () => { + let loadListener; + + const setupListeners = () => { + document + .querySelectorAll('link') + .forEach(x => x.addEventListener('load', () => loadListener(x))); + }; + + beforeEach(() => { + loadListener = jest.fn(); + + setHTMLFixture(` + + + + + `); + + setupListeners(); + + loadStartupCSS(); + }); + + it('does nothing at first', () => { + expect(loadListener).not.toHaveBeenCalled(); + }); + + describe('on window load', () => { + beforeEach(() => { + window.dispatchEvent(new Event('load')); + }); + + it('dispatches load to the print links', () => { + expect(loadListener.mock.calls.map(([el]) => el.getAttribute('src'))).toEqual([ + './lorem-print.css', + './ipsum-print.css', + ]); + }); + }); +}); diff --git a/spec/lib/gitlab/themes_spec.rb b/spec/lib/gitlab/themes_spec.rb index 68ff28becfa..6d03cf496b8 100644 --- a/spec/lib/gitlab/themes_spec.rb +++ b/spec/lib/gitlab/themes_spec.rb @@ -47,4 +47,18 @@ RSpec.describe Gitlab::Themes, lib: true do expect(ids).not_to be_empty end end + + describe 'theme.css_filename' do + described_class.each do |theme| + next unless theme.css_filename + + context "for #{theme.name}" do + it 'returns an existing CSS filename' do + css_file_path = Rails.root.join('app/assets/stylesheets/themes', theme.css_filename + '.scss') + + expect(File.exist?(css_file_path)).to eq(true) + end + end + end + end end diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb index 228a1e8f7a2..a07ef705357 100644 --- a/spec/models/ci/pipeline_spec.rb +++ b/spec/models/ci/pipeline_spec.rb @@ -3628,6 +3628,16 @@ RSpec.describe Ci::Pipeline, :mailer, factory_default: :keep do expect(builds).to include(rspec, jest) expect(builds).not_to include(karma) end + + it 'returns only latest builds' do + obsolete = create(:ci_build, name: "jest", coverage: 10.12, pipeline: pipeline, retried: true) + retried = create(:ci_build, name: "jest", coverage: 20.11, pipeline: pipeline) + + builds = pipeline.builds_with_coverage + + expect(builds).to include(retried) + expect(builds).not_to include(obsolete) + end end describe '#base_and_ancestors' do diff --git a/spec/serializers/merge_request_poll_widget_entity_spec.rb b/spec/serializers/merge_request_poll_widget_entity_spec.rb index 161940dd01a..e0ea35623f6 100644 --- a/spec/serializers/merge_request_poll_widget_entity_spec.rb +++ b/spec/serializers/merge_request_poll_widget_entity_spec.rb @@ -44,20 +44,6 @@ RSpec.describe MergeRequestPollWidgetEntity do expect(subject[:merge_pipeline]).to eq(pipeline_payload) end - context 'when merge_request_short_pipeline_serializer is disabled' do - it 'returns detailed info about pipeline' do - stub_feature_flags(merge_request_short_pipeline_serializer: false) - - pipeline.reload - pipeline_payload = - PipelineDetailsEntity - .represent(pipeline, request: request) - .as_json - - expect(subject[:merge_pipeline]).to eq(pipeline_payload) - end - end - context 'when user cannot read pipelines on target project' do before do project.add_guest(user) @@ -245,19 +231,6 @@ RSpec.describe MergeRequestPollWidgetEntity do expect(subject[:pipeline]).to eq(pipeline_payload) end - context 'when merge_request_short_pipeline_serializer is disabled' do - it 'returns detailed info about pipeline' do - stub_feature_flags(merge_request_short_pipeline_serializer: false) - - pipeline_payload = - PipelineDetailsEntity - .represent(pipeline, request: req) - .as_json - - expect(subject[:pipeline]).to eq(pipeline_payload) - end - end - it 'returns ci_status' do expect(subject[:ci_status]).to eq('pending') end diff --git a/spec/views/admin/dashboard/index.html.haml_spec.rb b/spec/views/admin/dashboard/index.html.haml_spec.rb index 70fb77944cc..e9223c84674 100644 --- a/spec/views/admin/dashboard/index.html.haml_spec.rb +++ b/spec/views/admin/dashboard/index.html.haml_spec.rb @@ -37,7 +37,7 @@ RSpec.describe 'admin/dashboard/index.html.haml' do render expect(rendered).not_to have_content "Users in License" - expect(rendered).not_to have_content "Active Users" + expect(rendered).not_to have_content "Billable Users" expect(rendered).not_to have_content "Maximum Users" expect(rendered).not_to have_content "Users over License" end diff --git a/spec/views/layouts/nav/sidebar/_admin.html.haml_spec.rb b/spec/views/layouts/nav/sidebar/_admin.html.haml_spec.rb index 777dc0c8571..2c37565328a 100644 --- a/spec/views/layouts/nav/sidebar/_admin.html.haml_spec.rb +++ b/spec/views/layouts/nav/sidebar/_admin.html.haml_spec.rb @@ -92,7 +92,11 @@ RSpec.describe 'layouts/nav/sidebar/_admin' do end context 'on settings' do + let(:gitlab_com?) { false } + before do + allow(::Gitlab).to receive(:com?) { gitlab_com? } + render end @@ -100,6 +104,20 @@ RSpec.describe 'layouts/nav/sidebar/_admin' do expect(rendered).to have_link('General', href: general_admin_application_settings_path) end + context 'when GitLab.com' do + let(:gitlab_com?) { true } + + it 'does not include Integrations link' do + expect(rendered).not_to have_link('Integrations', href: integrations_admin_application_settings_path) + end + end + + context 'when not GitLab.com' do + it 'includes Integrations link' do + expect(rendered).to have_link('Integrations', href: integrations_admin_application_settings_path) + end + end + context 'when GitLab FOSS' do it 'does not include Templates link' do expect(rendered).not_to have_link('Templates', href: '/admin/application_settings/templates') diff --git a/spec/views/profiles/preferences/show.html.haml_spec.rb b/spec/views/profiles/preferences/show.html.haml_spec.rb index 1b8b28367c1..1dae953227d 100644 --- a/spec/views/profiles/preferences/show.html.haml_spec.rb +++ b/spec/views/profiles/preferences/show.html.haml_spec.rb @@ -20,6 +20,14 @@ RSpec.describe 'profiles/preferences/show' do it 'has an id for anchoring' do expect(rendered).to have_css('#navigation-theme') end + + it 'has correct stylesheet tags' do + Gitlab::Themes.each do |theme| + next unless theme.css_filename + + expect(rendered).to have_selector("link[href*=\"themes/#{theme.css_filename}\"]", visible: false) + end + end end context 'syntax highlighting theme' do diff --git a/spec/workers/authorized_project_update/periodic_recalculate_worker_spec.rb b/spec/workers/authorized_project_update/periodic_recalculate_worker_spec.rb index 2d633828ae3..9d4d48d0568 100644 --- a/spec/workers/authorized_project_update/periodic_recalculate_worker_spec.rb +++ b/spec/workers/authorized_project_update/periodic_recalculate_worker_spec.rb @@ -11,17 +11,5 @@ RSpec.describe AuthorizedProjectUpdate::PeriodicRecalculateWorker do subject.perform end - - context 'feature flag :periodic_project_authorization_recalculation is disabled' do - before do - stub_feature_flags(periodic_project_authorization_recalculation: false) - end - - it 'does not call AuthorizedProjectUpdate::PeriodicRecalculateService' do - expect(AuthorizedProjectUpdate::PeriodicRecalculateService).not_to receive(:new) - - subject.perform - end - end end end diff --git a/spec/workers/authorized_project_update/user_refresh_over_user_range_worker_spec.rb b/spec/workers/authorized_project_update/user_refresh_over_user_range_worker_spec.rb index c49e4c453bf..a27c431523e 100644 --- a/spec/workers/authorized_project_update/user_refresh_over_user_range_worker_spec.rb +++ b/spec/workers/authorized_project_update/user_refresh_over_user_range_worker_spec.rb @@ -14,17 +14,5 @@ RSpec.describe AuthorizedProjectUpdate::UserRefreshOverUserRangeWorker do subject.perform(start_user_id, end_user_id) end - - context 'feature flag :periodic_project_authorization_recalculation is disabled' do - before do - stub_feature_flags(periodic_project_authorization_recalculation: false) - end - - it 'does not call AuthorizedProjectUpdate::RecalculateForUserRangeService' do - expect(AuthorizedProjectUpdate::RecalculateForUserRangeService).not_to receive(:new) - - subject.perform(start_user_id, end_user_id) - end - end end end