diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-16 21:09:35 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-16 21:09:35 +0300 |
commit | dbfedde341ef6434d40c4c2495f2be751f8bb973 (patch) | |
tree | b99819d19e81e2c7c269005763e8840b2c5acd1f /app | |
parent | a6533d71f53cd7f97a31100334154a82a9f37deb (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
21 files changed, 143 insertions, 65 deletions
diff --git a/app/assets/javascripts/issuable/components/related_issuable_item.vue b/app/assets/javascripts/issuable/components/related_issuable_item.vue index e7d951fffaa..e6379b35f7a 100644 --- a/app/assets/javascripts/issuable/components/related_issuable_item.vue +++ b/app/assets/javascripts/issuable/components/related_issuable_item.vue @@ -171,7 +171,7 @@ export default { <issue-assignees v-if="assignees.length !== 0" :assignees="assignees" - class="item-assignees d-flex align-items-center align-self-end flex-shrink-0 d-md-none ml-2" + class="item-assignees d-flex align-items-center align-self-end flex-shrink-0 d-md-none gl-ml-3" /> </div> </div> diff --git a/app/assets/javascripts/pages/admin/application_settings/general/components/signup_form.vue b/app/assets/javascripts/pages/admin/application_settings/general/components/signup_form.vue index ccb449f96e1..5ecacb84d65 100644 --- a/app/assets/javascripts/pages/admin/application_settings/general/components/signup_form.vue +++ b/app/assets/javascripts/pages/admin/application_settings/general/components/signup_form.vue @@ -12,7 +12,6 @@ import { import { toSafeInteger } from 'lodash'; import csrf from '~/lib/utils/csrf'; import { __, n__, s__, sprintf } from '~/locale'; -import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import SignupCheckbox from './signup_checkbox.vue'; const DENYLIST_TYPE_RAW = 'raw'; @@ -32,12 +31,7 @@ export default { GlLink, SignupCheckbox, GlModal, - PasswordComplexityCheckboxGroup: () => - import( - 'ee_component/pages/admin/application_settings/general/components/password_complexity_checkbox_group.vue' - ), }, - mixins: [glFeatureFlagMixin()], inject: [ 'host', 'settingsPath', @@ -184,9 +178,6 @@ export default { this.submitForm(); }, - setPasswordComplexity({ name, value }) { - this.$set(this.form, name, value); - }, submitForm() { this.$refs.form.submit(); }, @@ -300,7 +291,9 @@ export default { <template #description> <gl-sprintf :message=" - s__('ApplicationSettings|See %{linkStart}password policy guidelines%{linkEnd}.') + s__( + 'ApplicationSettings|See GitLab\'s %{linkStart}Password Policy Guidelines%{linkEnd}.', + ) " > <template #link="{ content }"> @@ -312,10 +305,6 @@ export default { </template> </gl-form-group> - <password-complexity-checkbox-group - v-if="glFeatures.passwordComplexity" - @set-password-complexity="setPasswordComplexity" - /> <gl-form-group :description="$options.i18n.domainAllowListDescription" :label="$options.i18n.domainAllowListLabel" diff --git a/app/assets/javascripts/pages/admin/application_settings/signup_restrictions.js b/app/assets/javascripts/pages/admin/application_settings/signup_restrictions.js index 0d5c55cb87b..a50d8de0e88 100644 --- a/app/assets/javascripts/pages/admin/application_settings/signup_restrictions.js +++ b/app/assets/javascripts/pages/admin/application_settings/signup_restrictions.js @@ -18,10 +18,6 @@ export default function initSignupRestrictions(elementSelector = '#js-signup-for 'domainDenylistEnabled', 'denylistTypeRawSelected', 'emailRestrictionsEnabled', - 'passwordNumberRequired', - 'passwordLowercaseRequired', - 'passwordUppercaseRequired', - 'passwordSymbolRequired', ], }); diff --git a/app/assets/javascripts/vue_shared/components/source_viewer/components/chunk_line.vue b/app/assets/javascripts/vue_shared/components/source_viewer/components/chunk_line.vue index c30ca5369ee..7b62f0cdb7d 100644 --- a/app/assets/javascripts/vue_shared/components/source_viewer/components/chunk_line.vue +++ b/app/assets/javascripts/vue_shared/components/source_viewer/components/chunk_line.vue @@ -72,7 +72,7 @@ export default { </div> <pre - class="gl-p-0! gl-w-full gl-overflow-visible! gl-ml-11! gl-border-none! code highlight" + class="gl-p-0! gl-w-full gl-overflow-visible! gl-ml-11! gl-border-none! code highlight gl-line-height-normal" :class="firstLineClass" ><code><span :id="`LC${number}`" v-safe-html="formattedContent" :lang="language" class="line" data-testid="content"></span></code></pre> </div> diff --git a/app/assets/stylesheets/framework/highlight.scss b/app/assets/stylesheets/framework/highlight.scss index a80643e695b..1c43212f501 100644 --- a/app/assets/stylesheets/framework/highlight.scss +++ b/app/assets/stylesheets/framework/highlight.scss @@ -11,7 +11,6 @@ border-radius: 0 0 $border-radius-default; font-family: $monospace-font; font-size: $code-font-size; - line-height: 1.5; margin: 0; overflow: auto; overflow-y: hidden; diff --git a/app/assets/stylesheets/pages/profiles/preferences.scss b/app/assets/stylesheets/pages/profiles/preferences.scss index b583d40de79..518ec181e5e 100644 --- a/app/assets/stylesheets/pages/profiles/preferences.scss +++ b/app/assets/stylesheets/pages/profiles/preferences.scss @@ -1,6 +1,6 @@ .application-theme { - $ui-dark-bg: #2e2e2e; - $ui-light-bg: #dfdfdf; + $ui-gray-bg: #2e2e2e; + $ui-light-gray-bg: #dfdfdf; $ui-dark-mode-bg: #1f1f1f; .preview { @@ -42,13 +42,13 @@ background-color: $theme-light-red-700; } - &.ui-dark { - background-color: $ui-dark-bg; + &.ui-gray { + background-color: $ui-gray-bg; border: solid 1px $border-color; } - &.ui-light { - background-color: $ui-light-bg; + &.ui-light-gray { + background-color: $ui-light-gray-bg; } &.gl-dark { diff --git a/app/assets/stylesheets/themes/theme_dark.scss b/app/assets/stylesheets/themes/theme_gray.scss index 4c52cdc30df..75b111f90c7 100644 --- a/app/assets/stylesheets/themes/theme_dark.scss +++ b/app/assets/stylesheets/themes/theme_gray.scss @@ -1,7 +1,7 @@ @import './theme_helper'; body { - &.ui-dark { + &.ui-gray { @include gitlab-theme( $gray-200, $gray-300, diff --git a/app/assets/stylesheets/themes/theme_light.scss b/app/assets/stylesheets/themes/theme_light_gray.scss index cbd14246d91..ad19438d79a 100644 --- a/app/assets/stylesheets/themes/theme_light.scss +++ b/app/assets/stylesheets/themes/theme_light_gray.scss @@ -1,7 +1,7 @@ @import './theme_helper'; body { - &.ui-light { + &.ui-light-gray { @include gitlab-theme( $gray-500, $gray-700, diff --git a/app/controllers/omniauth_callbacks_controller.rb b/app/controllers/omniauth_callbacks_controller.rb index 927b50245a4..45decccfc36 100644 --- a/app/controllers/omniauth_callbacks_controller.rb +++ b/app/controllers/omniauth_callbacks_controller.rb @@ -178,6 +178,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController flash[:notice] = _('Welcome back! Your account had been deactivated due to inactivity but is now reactivated.') end + store_after_sign_up_path_for_user if intent_to_register? sign_in_and_redirect(user, event: :authentication) end else @@ -259,6 +260,11 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController (request_params['remember_me'] == '1') if request_params.present? end + def intent_to_register? + request_params = request.env['omniauth.params'] + (request_params['intent'] == 'register') if request_params.present? + end + def store_redirect_fragment(redirect_fragment) key = stored_location_key_for(:user) location = session[key] @@ -291,6 +297,10 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController def fail_admin_mode_invalid_credentials redirect_to new_admin_session_path, alert: _('Invalid login or password') end + + def store_after_sign_up_path_for_user + store_location_for(:user, users_sign_up_welcome_path) + end end OmniauthCallbacksController.prepend_mod_with('OmniauthCallbacksController') diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb index 7101f5d772f..f974b16468c 100644 --- a/app/controllers/projects/issues_controller.rb +++ b/app/controllers/projects/issues_controller.rb @@ -20,6 +20,8 @@ class Projects::IssuesController < Projects::ApplicationController before_action :disable_query_limiting, only: [:create_merge_request, :move, :bulk_update] before_action :check_issues_available! before_action :issue, unless: ->(c) { ISSUES_EXCEPT_ACTIONS.include?(c.action_name.to_sym) } + before_action :redirect_if_task, unless: ->(c) { ISSUES_EXCEPT_ACTIONS.include?(c.action_name.to_sym) } + after_action :log_issue_show, unless: ->(c) { ISSUES_EXCEPT_ACTIONS.include?(c.action_name.to_sym) } before_action :set_issuables_index, if: ->(c) { @@ -402,6 +404,13 @@ class Projects::IssuesController < Projects::ApplicationController # Overridden in EE def create_vulnerability_issue_feedback(issue); end + + def redirect_if_task + return render_404 if issue.task? && !project.work_items_feature_flag_enabled? + return unless issue.task? + + redirect_to project_work_items_path(project, issue.id, params: request.query_parameters) + end end Projects::IssuesController.prepend_mod_with('Projects::IssuesController') diff --git a/app/graphql/resolvers/ci/runner_owner_project_resolver.rb b/app/graphql/resolvers/ci/runner_owner_project_resolver.rb new file mode 100644 index 00000000000..14b5f8f90eb --- /dev/null +++ b/app/graphql/resolvers/ci/runner_owner_project_resolver.rb @@ -0,0 +1,65 @@ +# frozen_string_literal: true + +module Resolvers + module Ci + class RunnerOwnerProjectResolver < BaseResolver + include LooksAhead + + type Types::ProjectType, null: true + + alias_method :runner, :object + + def resolve_with_lookahead(**args) + resolve_owner + end + + def preloads + { + full_path: [:route] + } + end + + def filtered_preloads + selection = lookahead + + preloads.each.flat_map do |name, requirements| + selection&.selects?(name) ? requirements : [] + end + end + + private + + def resolve_owner + return unless runner.project_type? + + BatchLoader::GraphQL.for(runner.id).batch(key: :runner_owner_projects) do |runner_ids, loader| + # rubocop: disable CodeReuse/ActiveRecord + runner_and_projects_with_row_number = + ::Ci::RunnerProject + .where(runner_id: runner_ids) + .select('id, runner_id, project_id, ROW_NUMBER() OVER (PARTITION BY runner_id ORDER BY id ASC)') + runner_and_owner_projects = + ::Ci::RunnerProject + .select(:id, :runner_id, :project_id) + .from("(#{runner_and_projects_with_row_number.to_sql}) temp WHERE row_number = 1") + owner_project_id_by_runner_id = + runner_and_owner_projects + .group_by(&:runner_id) + .transform_values { |runner_projects| runner_projects.first.project_id } + project_ids = owner_project_id_by_runner_id.values.uniq + + all_preloads = unconditional_includes + filtered_preloads + owner_relation = Project.all + owner_relation = owner_relation.preload(*all_preloads) if all_preloads.any? + projects = owner_relation.where(id: project_ids).index_by(&:id) + + runner_ids.each do |runner_id| + owner_project_id = owner_project_id_by_runner_id[runner_id] + loader.call(runner_id, projects[owner_project_id]) + end + # rubocop: enable CodeReuse/ActiveRecord + end + end + end + end +end diff --git a/app/graphql/types/ci/runner_type.rb b/app/graphql/types/ci/runner_type.rb index 173dc95bf13..949e216a982 100644 --- a/app/graphql/types/ci/runner_type.rb +++ b/app/graphql/types/ci/runner_type.rb @@ -85,6 +85,9 @@ module Types method: :token_expires_at field :version, GraphQL::Types::String, null: true, description: 'Version of the runner.' + field :owner_project, ::Types::ProjectType, null: true, + description: 'Project that owns the runner. For project runners only.', + resolver: ::Resolvers::Ci::RunnerOwnerProjectResolver markdown_field :maintenance_note_html, null: true diff --git a/app/models/integrations/bamboo.rb b/app/models/integrations/bamboo.rb index 4e144a688f6..4e30c1ccc69 100644 --- a/app/models/integrations/bamboo.rb +++ b/app/models/integrations/bamboo.rb @@ -6,25 +6,25 @@ module Integrations prepend EnableSslVerification field :bamboo_url, - title: s_('BambooService|Bamboo URL'), - placeholder: s_('https://bamboo.example.com'), - help: s_('BambooService|Bamboo service root URL.'), + title: -> { s_('BambooService|Bamboo URL') }, + placeholder: -> { s_('https://bamboo.example.com') }, + help: -> { s_('BambooService|Bamboo service root URL.') }, required: true field :build_key, - help: s_('BambooService|Bamboo build plan key.'), - non_empty_password_title: s_('BambooService|Enter new build key'), - non_empty_password_help: s_('BambooService|Leave blank to use your current build key.'), - placeholder: s_('KEY'), + help: -> { s_('BambooService|Bamboo build plan key.') }, + non_empty_password_title: -> { s_('BambooService|Enter new build key') }, + non_empty_password_help: -> { s_('BambooService|Leave blank to use your current build key.') }, + placeholder: -> { s_('KEY') }, required: true field :username, - help: s_('BambooService|The user with API access to the Bamboo server.') + help: -> { s_('BambooService|The user with API access to the Bamboo server.') } field :password, type: 'password', - non_empty_password_title: s_('ProjectService|Enter new password'), - non_empty_password_help: s_('ProjectService|Leave blank to use your current password') + non_empty_password_title: -> { s_('ProjectService|Enter new password') }, + non_empty_password_help: -> { s_('ProjectService|Leave blank to use your current password') } validates :bamboo_url, presence: true, public_url: true, if: :activated? validates :build_key, presence: true, if: :activated? diff --git a/app/models/integrations/buildkite.rb b/app/models/integrations/buildkite.rb index d1e54ce86ee..def646c6d49 100644 --- a/app/models/integrations/buildkite.rb +++ b/app/models/integrations/buildkite.rb @@ -11,16 +11,18 @@ module Integrations ENDPOINT = "https://buildkite.com" field :project_url, - title: _('Pipeline URL'), + title: -> { _('Pipeline URL') }, placeholder: "#{ENDPOINT}/example-org/test-pipeline", required: true field :token, type: 'password', - title: _('Token'), - help: s_('ProjectService|The token you get after you create a Buildkite pipeline with a GitLab repository.'), - non_empty_password_title: s_('ProjectService|Enter new token'), - non_empty_password_help: s_('ProjectService|Leave blank to use your current token.'), + title: -> { _('Token') }, + help: -> do + s_('ProjectService|The token you get after you create a Buildkite pipeline with a GitLab repository.') + end, + non_empty_password_title: -> { s_('ProjectService|Enter new token') }, + non_empty_password_help: -> { s_('ProjectService|Leave blank to use your current token.') }, required: true validates :project_url, presence: true, public_url: true, if: :activated? diff --git a/app/models/integrations/drone_ci.rb b/app/models/integrations/drone_ci.rb index 0c65ed8cd5f..35524503dea 100644 --- a/app/models/integrations/drone_ci.rb +++ b/app/models/integrations/drone_ci.rb @@ -11,15 +11,15 @@ module Integrations DRONE_SAAS_HOSTNAME = 'cloud.drone.io' field :drone_url, - title: s_('ProjectService|Drone server URL'), + title: -> { s_('ProjectService|Drone server URL') }, placeholder: 'http://drone.example.com', required: true field :token, type: 'password', - help: s_('ProjectService|Token for the Drone project.'), - non_empty_password_title: s_('ProjectService|Enter new token'), - non_empty_password_help: s_('ProjectService|Leave blank to use your current token.'), + help: -> { s_('ProjectService|Token for the Drone project.') }, + non_empty_password_title: -> { s_('ProjectService|Enter new token') }, + non_empty_password_help: -> { s_('ProjectService|Leave blank to use your current token.') }, required: true validates :drone_url, presence: true, public_url: true, if: :activated? diff --git a/app/models/integrations/jenkins.rb b/app/models/integrations/jenkins.rb index a1abbce72bc..ab39d1f7b77 100644 --- a/app/models/integrations/jenkins.rb +++ b/app/models/integrations/jenkins.rb @@ -8,24 +8,24 @@ module Integrations extend Gitlab::Utils::Override field :jenkins_url, - title: s_('ProjectService|Jenkins server URL'), + title: -> { s_('ProjectService|Jenkins server URL') }, required: true, placeholder: 'http://jenkins.example.com', - help: s_('The URL of the Jenkins server.') + help: -> { s_('The URL of the Jenkins server.') } field :project_name, required: true, placeholder: 'my_project_name', - help: s_('The name of the Jenkins project. Copy the name from the end of the URL to the project.') + help: -> { s_('The name of the Jenkins project. Copy the name from the end of the URL to the project.') } field :username, - help: s_('The username for the Jenkins server.') + help: -> { s_('The username for the Jenkins server.') } field :password, type: 'password', - help: s_('The password for the Jenkins server.'), - non_empty_password_title: s_('ProjectService|Enter new password.'), - non_empty_password_help: s_('ProjectService|Leave blank to use your current password.') + help: -> { s_('The password for the Jenkins server.') }, + non_empty_password_title: -> { s_('ProjectService|Enter new password.') }, + non_empty_password_help: -> { s_('ProjectService|Leave blank to use your current password.') } before_validation :reset_password diff --git a/app/models/integrations/jira.rb b/app/models/integrations/jira.rb index 992bd01bf5f..125f52104d4 100644 --- a/app/models/integrations/jira.rb +++ b/app/models/integrations/jira.rb @@ -24,7 +24,10 @@ module Integrations validates :password, presence: true, if: :activated? validates :jira_issue_transition_id, - format: { with: Gitlab::Regex.jira_transition_id_regex, message: s_("JiraService|IDs must be a list of numbers that can be split with , or ;") }, + format: { + with: Gitlab::Regex.jira_transition_id_regex, + message: ->(*_) { s_("JiraService|IDs must be a list of numbers that can be split with , or ;") } + }, allow_blank: true # Jira Cloud version is deprecating authentication via username and password. diff --git a/app/models/integrations/mock_ci.rb b/app/models/integrations/mock_ci.rb index cd2928136ef..0b3a9bc5405 100644 --- a/app/models/integrations/mock_ci.rb +++ b/app/models/integrations/mock_ci.rb @@ -8,7 +8,7 @@ module Integrations ALLOWED_STATES = %w[failed canceled running pending success success-with-warnings skipped not_found].freeze field :mock_service_url, - title: s_('ProjectService|Mock service URL'), + title: -> { s_('ProjectService|Mock service URL') }, placeholder: 'http://localhost:4004', required: true diff --git a/app/models/integrations/teamcity.rb b/app/models/integrations/teamcity.rb index 1205173e40b..a23aa5f783d 100644 --- a/app/models/integrations/teamcity.rb +++ b/app/models/integrations/teamcity.rb @@ -9,21 +9,21 @@ module Integrations TEAMCITY_SAAS_HOSTNAME = /\A[^\.]+\.teamcity\.com\z/i.freeze field :teamcity_url, - title: s_('ProjectService|TeamCity server URL'), + title: -> { s_('ProjectService|TeamCity server URL') }, placeholder: 'https://teamcity.example.com', required: true field :build_type, - help: s_('ProjectService|The build configuration ID of the TeamCity project.'), + help: -> { s_('ProjectService|The build configuration ID of the TeamCity project.') }, required: true field :username, - help: s_('ProjectService|Must have permission to trigger a manual build in TeamCity.') + help: -> { s_('ProjectService|Must have permission to trigger a manual build in TeamCity.') } field :password, type: 'password', - non_empty_password_title: s_('ProjectService|Enter new password'), - non_empty_password_help: s_('ProjectService|Leave blank to use your current password') + non_empty_password_title: -> { s_('ProjectService|Enter new password') }, + non_empty_password_help: -> { s_('ProjectService|Leave blank to use your current password') } validates :teamcity_url, presence: true, public_url: true, if: :activated? validates :build_type, presence: true, if: :activated? diff --git a/app/views/devise/shared/_signup_omniauth_provider_list.haml b/app/views/devise/shared/_signup_omniauth_provider_list.haml index 6688308cd71..84aabbe0efd 100644 --- a/app/views/devise/shared/_signup_omniauth_provider_list.haml +++ b/app/views/devise/shared/_signup_omniauth_provider_list.haml @@ -1,8 +1,10 @@ +- register_omniauth_params = Feature.enabled?(:update_oauth_registration_flow) ? { intent: :register } : {} + %label.gl-font-weight-bold = _("Create an account using:") .gl-display-flex.gl-justify-content-between.gl-flex-wrap - providers.each do |provider| - = link_to omniauth_authorize_path(:user, provider), method: :post, class: "btn gl-button btn-default gl-w-full gl-mb-3 js-oauth-login #{qa_class_for_provider(provider)}", data: { provider: provider }, id: "oauth-login-#{provider}" do + = link_to omniauth_authorize_path(:user, provider, register_omniauth_params), method: :post, class: "btn gl-button btn-default gl-w-full gl-mb-3 js-oauth-login #{qa_class_for_provider(provider)}", data: { provider: provider }, id: "oauth-login-#{provider}" do - if provider_has_icon?(provider) = provider_image_tag(provider) %span.gl-button-text diff --git a/app/views/profiles/preferences/show.html.haml b/app/views/profiles/preferences/show.html.haml index 37fdba141ee..a63e02fca1d 100644 --- a/app/views/profiles/preferences/show.html.haml +++ b/app/views/profiles/preferences/show.html.haml @@ -13,9 +13,9 @@ .row.gl-mt-3.js-preferences-form.js-search-settings-section .col-lg-4.application-theme#navigation-theme %h4.gl-mt-0 - = s_('Preferences|Navigation theme') + = s_('Preferences|Color theme') %p - = s_('Preferences|Customize the appearance of the application header and navigation sidebar.') + = s_('Preferences|Customize the color of GitLab.') .col-lg-8.application-theme .row - Gitlab::Themes.each do |theme| |