diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-03 00:12:50 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-03 00:12:50 +0300 |
commit | 3a72ac775065b61bbdb285a8f4f6f152ccb4db49 (patch) | |
tree | 3e03be3d792b6693a57f7ef3da8b228c694fb45a /app | |
parent | 0cea0a8f44d2cef1d4d132c72a07f8995962115c (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
13 files changed, 52 insertions, 50 deletions
diff --git a/app/assets/javascripts/work_items/components/work_item_detail.vue b/app/assets/javascripts/work_items/components/work_item_detail.vue index 485d85b8872..85b981d9370 100644 --- a/app/assets/javascripts/work_items/components/work_item_detail.vue +++ b/app/assets/javascripts/work_items/components/work_item_detail.vue @@ -449,6 +449,7 @@ export default { class="gl-mt-3 gl-sm-display-block!" :is-editing="editMode" :title="workItem.title" + @updateWorkItem="updateWorkItem" @updateDraft="updateDraft('title', $event)" /> <work-item-title @@ -518,6 +519,7 @@ export default { :is-editing="editMode" :class="titleClassComponent" :title="workItem.title" + @updateWorkItem="updateWorkItem" @updateDraft="updateDraft('title', $event)" /> <work-item-title diff --git a/app/assets/javascripts/work_items/components/work_item_title_with_edit.vue b/app/assets/javascripts/work_items/components/work_item_title_with_edit.vue index 02ed25f98e4..6af564a6a91 100644 --- a/app/assets/javascripts/work_items/components/work_item_title_with_edit.vue +++ b/app/assets/javascripts/work_items/components/work_item_title_with_edit.vue @@ -27,10 +27,12 @@ export default { <template> <gl-form-group v-if="isEditing" :label="$options.i18n.titleLabel" label-for="work-item-title"> <gl-form-input - id="work-item-title" class="gl-w-full" :value="title" - @change="$emit('updateDraft', $event)" + data-testid="work-item-title-with-edit" + @keydown.meta.enter="$emit('updateWorkItem')" + @keydown.ctrl.enter="$emit('updateWorkItem')" + @input="$emit('updateDraft', $event)" /> </gl-form-group> <h1 diff --git a/app/controllers/ldap/omniauth_callbacks_controller.rb b/app/controllers/ldap/omniauth_callbacks_controller.rb index 955dfe58449..1c79bd3a668 100644 --- a/app/controllers/ldap/omniauth_callbacks_controller.rb +++ b/app/controllers/ldap/omniauth_callbacks_controller.rb @@ -28,7 +28,7 @@ class Ldap::OmniauthCallbacksController < OmniauthCallbacksController define_providers! override :set_remember_me - def set_remember_me(user) + def set_remember_me(user, _auth_user) user.remember_me = params[:remember_me] if user.persisted? end diff --git a/app/controllers/omniauth_callbacks_controller.rb b/app/controllers/omniauth_callbacks_controller.rb index 907ece1a06e..0701b1ee977 100644 --- a/app/controllers/omniauth_callbacks_controller.rb +++ b/app/controllers/omniauth_callbacks_controller.rb @@ -139,9 +139,11 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController identity_linker ||= auth_module::IdentityLinker.new(current_user, oauth, session) link_identity(identity_linker) - set_remember_me(current_user) - store_idp_two_factor_status(build_auth_user(auth_module::User).bypass_two_factor?) + current_auth_user = build_auth_user(auth_module::User) + set_remember_me(current_user, current_auth_user) + + store_idp_two_factor_status(current_auth_user.bypass_two_factor?) if identity_linker.changed? redirect_identity_linked @@ -193,7 +195,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController track_event(@user, oauth['provider'], 'succeeded') Gitlab::Tracking.event(self.class.name, "#{oauth['provider']}_sso", user: @user) if new_user - set_remember_me(@user) + set_remember_me(@user, auth_user) set_session_active_since(oauth['provider']) if ::AuthHelper.saml_providers.include?(oauth['provider'].to_sym) if @user.two_factor_enabled? && !auth_user.bypass_two_factor? @@ -278,10 +280,10 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController .for_authentication.security_event end - def set_remember_me(user) + def set_remember_me(user, auth_user) return unless remember_me? - if user.two_factor_enabled? + if user.two_factor_enabled? && !auth_user.bypass_two_factor? params[:remember_me] = '1' else remember_me(user) diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index f863c1e5093..aa8bea1bd83 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -1712,8 +1712,6 @@ class MergeRequest < ApplicationRecord actual_head_pipeline&.complete_and_has_reports?(Ci::JobArtifact.of_report_type(:test)) end - # rubocop: disable Metrics/AbcSize - # Delete a rubocop annotation once FF truncate_ci_merge_request_description is cleaned up def predefined_variables Gitlab::Ci::Variables::Collection.new.tap do |variables| variables.append(key: 'CI_MERGE_REQUEST_ID', value: id.to_s) @@ -1726,14 +1724,9 @@ class MergeRequest < ApplicationRecord variables.append(key: 'CI_MERGE_REQUEST_TARGET_BRANCH_PROTECTED', value: ProtectedBranch.protected?(target_project, target_branch).to_s) variables.append(key: 'CI_MERGE_REQUEST_TITLE', value: title) - if ::Feature.enabled?(:truncate_ci_merge_request_description) - mr_description, mr_description_truncated = truncate_mr_description - variables.append(key: 'CI_MERGE_REQUEST_DESCRIPTION', value: mr_description) - variables.append(key: 'CI_MERGE_REQUEST_DESCRIPTION_IS_TRUNCATED', value: mr_description_truncated) - else - variables.append(key: 'CI_MERGE_REQUEST_DESCRIPTION', value: description) - end - + mr_description, mr_description_truncated = truncate_mr_description + variables.append(key: 'CI_MERGE_REQUEST_DESCRIPTION', value: mr_description) + variables.append(key: 'CI_MERGE_REQUEST_DESCRIPTION_IS_TRUNCATED', value: mr_description_truncated) variables.append(key: 'CI_MERGE_REQUEST_ASSIGNEES', value: assignee_username_list) if assignees.present? variables.append(key: 'CI_MERGE_REQUEST_MILESTONE', value: milestone.title) if milestone variables.append(key: 'CI_MERGE_REQUEST_LABELS', value: label_names.join(',')) if labels.present? @@ -1741,8 +1734,6 @@ class MergeRequest < ApplicationRecord variables.concat(source_project_variables) end end - # rubocop: enable Metrics/AbcSize - # Delete a rubocop annotation once FF truncate_ci_merge_request_description is cleaned up def compare_test_reports unless has_test_reports? diff --git a/app/models/organizations/organization.rb b/app/models/organizations/organization.rb index 4a30cfc8f0e..be96939daa8 100644 --- a/app/models/organizations/organization.rb +++ b/app/models/organizations/organization.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module Organizations - class Organization < ApplicationRecord + class Organization < MainClusterwide::ApplicationRecord DEFAULT_ORGANIZATION_ID = 1 scope :without_default, -> { where.not(id: DEFAULT_ORGANIZATION_ID) } diff --git a/app/views/devise/shared/_omniauth_box.html.haml b/app/views/devise/shared/_omniauth_box.html.haml index 5ba58ecb974..be559b30ce9 100644 --- a/app/views/devise/shared/_omniauth_box.html.haml +++ b/app/views/devise/shared/_omniauth_box.html.haml @@ -4,14 +4,14 @@ .omniauth-divider.gl-display-flex.gl-align-items-center = _("or sign in with") -.gl-mt-5.gl-px-5.omniauth-container.gl-text-center.gl-ml-auto.gl-mr-auto +.gl-mt-5.gl-px-5.omniauth-container.gl-text-center.gl-display-flex.gl-flex-direction-column.gl-gap-3 - enabled_button_based_providers.each do |provider| - - has_icon = provider_has_icon?(provider) - = button_to omniauth_authorize_path(:user, provider), id: "oauth-login-#{provider}", data: { testid: "#{test_id_for_provider(provider)}" }, class: "btn gl-button btn-default gl-mb-2 js-oauth-login gl-w-full", form: { class: 'gl-mb-3' } do - - if has_icon - = provider_image_tag(provider) - %span.gl-button-text - = label_for_provider(provider) + = render 'devise/shared/omniauth_provider_button', + href: omniauth_authorize_path(:user, provider), + provider: provider, + classes: 'js-oauth-login', + data: { testid: test_id_for_provider(provider) }, + id: "oauth-login-#{provider}" - if render_remember_me = render Pajamas::CheckboxTagComponent.new(name: 'remember_me_omniauth', value: nil) do |c| - c.with_label do diff --git a/app/views/devise/shared/_omniauth_provider_button.haml b/app/views/devise/shared/_omniauth_provider_button.haml new file mode 100644 index 00000000000..e92b41a6254 --- /dev/null +++ b/app/views/devise/shared/_omniauth_provider_button.haml @@ -0,0 +1,7 @@ +- button_options = { class: classes, data: data, id: id } + += render Pajamas::ButtonComponent.new(href: href, method: :post, form: true, block: true, button_options: button_options) do + - if provider_has_icon?(provider) + = provider_image_tag(provider) + %span.gl-button-text + = label_for_provider(provider) diff --git a/app/views/devise/shared/_signup_omniauth_provider_button.haml b/app/views/devise/shared/_signup_omniauth_provider_button.haml index e280259ca49..9870e90cfff 100644 --- a/app/views/devise/shared/_signup_omniauth_provider_button.haml +++ b/app/views/devise/shared/_signup_omniauth_provider_button.haml @@ -1,8 +1,6 @@ -- data = { provider: provider, track_action: "#{provider}_sso", track_label: tracking_label } -- button_options = { class: 'js-track-omni-auth', data: data, id: "oauth-login-#{provider}" } - -= render Pajamas::ButtonComponent.new(href: href, method: :post, form: true, block: true, button_options: button_options) do - - if provider_has_icon?(provider) - = provider_image_tag(provider) - %span.gl-button-text - = label_for_provider(provider) += render 'devise/shared/omniauth_provider_button', + href: href, + provider: provider, + classes: 'js-track-omni-auth', + data: { provider: provider, track_action: "#{provider}_sso", track_label: tracking_label }, + id: "oauth-login-#{provider}" diff --git a/app/views/profiles/emails/index.html.haml b/app/views/profiles/emails/index.html.haml index 6dcd661ecdb..3f18a7bbda6 100644 --- a/app/views/profiles/emails/index.html.haml +++ b/app/views/profiles/emails/index.html.haml @@ -24,7 +24,7 @@ = sprite_icon('mail', css_class: 'gl-mr-2') = @emails.load.size .gl-new-card-actions - = render Pajamas::ButtonComponent.new(size: :small, button_options: { class: "js-toggle-button js-toggle-content", data: { testid: 'toggle_email_address_field' } }) do + = render Pajamas::ButtonComponent.new(size: :small, button_options: { class: "js-toggle-button js-toggle-content", data: { testid: 'toggle-email-address-field' } }) do = s_('Profiles|Add new email') - c.with_body do .gl-new-card-add-form.gl-m-3.gl-mb-4.gl-display-none.js-toggle-content @@ -33,9 +33,9 @@ = gitlab_ui_form_for 'email', url: profile_emails_path do |f| .form-group = f.label :email, s_('Profiles|Email address'), class: 'label-bold' - = f.text_field :email, class: 'form-control gl-form-input gl-form-input-xl', data: { qa_selector: 'email_address_field' } + = f.text_field :email, class: 'form-control gl-form-input gl-form-input-xl', data: { testid: 'email-address-field' } .gl-mt-3 - = f.submit s_('Profiles|Add email address'), data: { qa_selector: 'add_email_address_button' }, pajamas_button: true + = f.submit s_('Profiles|Add email address'), data: { testid: 'add-email-address-button' }, pajamas_button: true = render Pajamas::ButtonComponent.new(button_options: { type: 'reset', class: 'gl-ml-2 js-toggle-button' }) do = _('Cancel') - if @emails.any? @@ -59,7 +59,7 @@ = s_('Profiles|Default notification email') .gl-text-secondary.gl-font-sm= notification_message.html_safe - @emails.reject(&:user_primary_email?).each do |email| - %li{ class: 'gl-px-5!', data: { qa_selector: 'email_row_content' } } + %li{ class: 'gl-px-5!', data: { testid: 'email-row-content' } } .gl-display-flex.gl-justify-content-space-between.gl-flex-wrap.gl-gap-3 %div = render partial: 'shared/email_with_badge', locals: { email: email.email, verified: email.confirmed? } @@ -81,4 +81,4 @@ - confirm_title = "#{email.confirmation_sent_at ? s_('Profiles|Resend confirmation email') : s_('Profiles|Send confirmation email')}" = link_button_to confirm_title, resend_confirmation_instructions_profile_email_path(email), method: :put, size: :small - = link_button_to nil, profile_email_path(email), data: { confirm: _('Are you sure?'), confirm_btn_variant: 'danger', qa_selector: 'delete_email_link'}, method: :delete, size: :small, icon: 'remove', 'aria-label': _('Remove') + = link_button_to nil, profile_email_path(email), data: { confirm: _('Are you sure?'), confirm_btn_variant: 'danger', testid: 'delete-email-link'}, method: :delete, size: :small, icon: 'remove', 'aria-label': _('Remove') diff --git a/app/views/profiles/gpg_keys/_key_table.html.haml b/app/views/profiles/gpg_keys/_key_table.html.haml index 0a50ce55b50..ea7068e0484 100644 --- a/app/views/profiles/gpg_keys/_key_table.html.haml +++ b/app/views/profiles/gpg_keys/_key_table.html.haml @@ -3,7 +3,7 @@ - if @gpg_keys.any? .table-holder - %table.table.b-table.gl-table.b-table-stacked-md.gl-mt-n1.gl-mb-n2.ssh-keys-list{ data: { qa_selector: 'ssh_keys_list' } } + %table.table.b-table.gl-table.b-table-stacked-md.gl-mt-n1.gl-mb-n2.ssh-keys-list %thead.d-none.d-md-table-header-group %tr %th= s_('Profiles|Key') diff --git a/app/views/user_settings/passwords/edit.html.haml b/app/views/user_settings/passwords/edit.html.haml index afe6ee2c0b3..179f54ac45e 100644 --- a/app/views/user_settings/passwords/edit.html.haml +++ b/app/views/user_settings/passwords/edit.html.haml @@ -18,18 +18,18 @@ - unless @user.password_automatically_set? .form-group = f.label :password, _('Current password'), class: 'label-bold' - = f.password_field :password, required: true, autocomplete: 'current-password', class: 'form-control gl-form-input gl-max-w-80', data: { qa_selector: 'current_password_field' } + = f.password_field :password, required: true, autocomplete: 'current-password', class: 'form-control gl-form-input gl-max-w-80', data: { testid: 'current-password-field' } %p.form-text.text-muted = _('You must provide your current password in order to change it.') .form-group = f.label :new_password, _('New password'), class: 'label-bold' - = f.password_field :new_password, required: true, autocomplete: 'new-password', class: 'form-control gl-form-input js-password-complexity-validation gl-max-w-80', data: { qa_selector: 'new_password_field' } + = f.password_field :new_password, required: true, autocomplete: 'new-password', class: 'form-control gl-form-input js-password-complexity-validation gl-max-w-80', data: { testid: 'new-password-field' } = render_if_exists 'shared/password_requirements_list' .form-group = f.label :password_confirmation, _('Password confirmation'), class: 'label-bold' - = f.password_field :password_confirmation, required: true, autocomplete: 'new-password', class: 'form-control gl-form-input gl-max-w-80', data: { qa_selector: 'confirm_password_field' } + = f.password_field :password_confirmation, required: true, autocomplete: 'new-password', class: 'form-control gl-form-input gl-max-w-80', data: { testid: 'confirm-password-field' } .gl-mt-3.gl-mb-3 - = f.submit _('Save password'), class: "gl-mr-3", data: { qa_selector: 'save_password_button' }, pajamas_button: true + = f.submit _('Save password'), class: "gl-mr-3", data: { testid: 'save-password-button' }, pajamas_button: true - unless @user.password_automatically_set? = render Pajamas::ButtonComponent.new(href: reset_user_settings_password_path, variant: :link, method: :put) do = _('I forgot my password') diff --git a/app/views/user_settings/passwords/new.html.haml b/app/views/user_settings/passwords/new.html.haml index 3616c9ec252..4b47dfa3e83 100644 --- a/app/views/user_settings/passwords/new.html.haml +++ b/app/views/user_settings/passwords/new.html.haml @@ -16,17 +16,17 @@ .col-sm-2.col-form-label = f.label :password, _('Current password') .col-sm-10 - = f.password_field :password, required: true, autocomplete: 'current-password', class: 'form-control gl-form-input', data: { qa_selector: 'current_password_field' } + = f.password_field :password, required: true, autocomplete: 'current-password', class: 'form-control gl-form-input', data: { testid: 'current-password-field' } .form-group.row .col-sm-2.col-form-label = f.label :new_password, _('New password') .col-sm-10 - = f.password_field :new_password, required: true, autocomplete: 'new-password', class: 'form-control gl-form-input js-password-complexity-validation', data: { qa_selector: 'new_password_field' } + = f.password_field :new_password, required: true, autocomplete: 'new-password', class: 'form-control gl-form-input js-password-complexity-validation', data: { testid: 'new-password-field' } = render_if_exists 'shared/password_requirements_list' .form-group.row .col-sm-2.col-form-label = f.label :password_confirmation, _('Password confirmation') .col-sm-10 - = f.password_field :password_confirmation, required: true, autocomplete: 'new-password', class: 'form-control gl-form-input', data: { qa_selector: 'confirm_password_field' } + = f.password_field :password_confirmation, required: true, autocomplete: 'new-password', class: 'form-control gl-form-input', data: { testid: 'confirm-password-field' } .form-actions - = f.submit _('Set new password'), data: { qa_selector: 'set_new_password_button' }, pajamas_button: true + = f.submit _('Set new password'), data: { testid: 'set-new-password-button' }, pajamas_button: true |