Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
9ee7e62c29
commit
98bec8db98
17 changed files with 166 additions and 70 deletions
|
@ -69,39 +69,31 @@ module ApplicationSettingsHelper
|
|||
end
|
||||
end
|
||||
|
||||
# Return a group of checkboxes that use Bootstrap's button plugin for a
|
||||
# toggle button effect.
|
||||
def restricted_level_checkboxes(help_block_id, checkbox_name, options = {})
|
||||
def restricted_level_checkboxes(form)
|
||||
Gitlab::VisibilityLevel.values.map do |level|
|
||||
checked = restricted_visibility_levels(true).include?(level)
|
||||
css_class = checked ? 'active' : ''
|
||||
tag_name = "application_setting_visibility_level_#{level}"
|
||||
|
||||
label_tag(tag_name, class: css_class) do
|
||||
check_box_tag(checkbox_name, level, checked,
|
||||
autocomplete: 'off',
|
||||
'aria-describedby' => help_block_id,
|
||||
'class' => options[:class],
|
||||
id: tag_name) + visibility_level_icon(level) + visibility_level_label(level)
|
||||
end
|
||||
form.gitlab_ui_checkbox_component(
|
||||
:restricted_visibility_levels,
|
||||
"#{visibility_level_icon(level)} #{visibility_level_label(level)}".html_safe,
|
||||
checkbox_options: { checked: checked, multiple: true, autocomplete: 'off' },
|
||||
checked_value: level,
|
||||
unchecked_value: nil
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
# Return a group of checkboxes that use Bootstrap's button plugin for a
|
||||
# toggle button effect.
|
||||
def import_sources_checkboxes(help_block_id, options = {})
|
||||
def import_sources_checkboxes(form)
|
||||
Gitlab::ImportSources.options.map do |name, source|
|
||||
checked = @application_setting.import_sources.include?(source)
|
||||
css_class = checked ? 'active' : ''
|
||||
checkbox_name = 'application_setting[import_sources][]'
|
||||
|
||||
label_tag(name, class: css_class) do
|
||||
check_box_tag(checkbox_name, source, checked,
|
||||
autocomplete: 'off',
|
||||
'aria-describedby' => help_block_id,
|
||||
'class' => options[:class],
|
||||
id: name.tr(' ', '_')) + name
|
||||
end
|
||||
form.gitlab_ui_checkbox_component(
|
||||
:import_sources,
|
||||
name,
|
||||
checkbox_options: { checked: checked, multiple: true, autocomplete: 'off' },
|
||||
checked_value: source,
|
||||
unchecked_value: nil
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ class Environment < ApplicationRecord
|
|||
has_many :self_managed_prometheus_alert_events, inverse_of: :environment
|
||||
has_many :alert_management_alerts, class_name: 'AlertManagement::Alert', inverse_of: :environment
|
||||
|
||||
has_one :last_deployment, -> { Feature.enabled?(:env_last_deployment_by_finished_at) ? success.ordered : success.distinct_on_environment }, class_name: 'Deployment', inverse_of: :environment
|
||||
has_one :last_deployment, -> { Feature.enabled?(:env_last_deployment_by_finished_at, default_enabled: :yaml) ? success.ordered : success.distinct_on_environment }, class_name: 'Deployment', inverse_of: :environment
|
||||
has_one :last_visible_deployment, -> { visible.distinct_on_environment }, inverse_of: :environment, class_name: 'Deployment'
|
||||
has_one :last_visible_deployable, through: :last_visible_deployment, source: 'deployable', source_type: 'CommitStatus', disable_joins: true
|
||||
has_one :last_visible_pipeline, through: :last_visible_deployable, source: 'pipeline', disable_joins: true
|
||||
|
|
|
@ -17,18 +17,16 @@
|
|||
= render('shared/visibility_radios', model_method: :default_group_visibility, form: f, selected_level: @application_setting.default_group_visibility, form_model: Group.new)
|
||||
.form-group
|
||||
= f.label :restricted_visibility_levels, class: 'label-bold'
|
||||
- checkbox_name = 'application_setting[restricted_visibility_levels][]'
|
||||
= hidden_field_tag(checkbox_name)
|
||||
- restricted_level_checkboxes('restricted-visibility-help', checkbox_name, class: 'form-check-input').each do |level|
|
||||
.form-check
|
||||
= level
|
||||
= hidden_field_tag 'application_setting[restricted_visibility_levels][]'
|
||||
- restricted_level_checkboxes(f).each do |level|
|
||||
= level
|
||||
%span.form-text.text-muted#restricted-visibility-help
|
||||
= _('Selected levels cannot be used by non-admin users for groups, projects or snippets. If the public level is restricted, user profiles are only visible to logged in users.')
|
||||
.form-group
|
||||
= f.label :import_sources, class: 'label-bold'
|
||||
= hidden_field_tag 'application_setting[import_sources][]'
|
||||
- import_sources_checkboxes('import-sources-help', class: 'form-check-input').each do |source|
|
||||
.form-check= source
|
||||
- import_sources_checkboxes(f).each do |source|
|
||||
= source
|
||||
%span.form-text.text-muted#import-sources-help
|
||||
= _('Enabled sources for code import during project creation. OmniAuth must be configured for GitHub')
|
||||
= link_to sprite_icon('question-o'), help_page_path("integration/github")
|
||||
|
@ -40,10 +38,7 @@
|
|||
= render_if_exists 'admin/application_settings/ldap_access_setting', form: f
|
||||
|
||||
.form-group
|
||||
.form-check
|
||||
= f.check_box :project_export_enabled, class: 'form-check-input'
|
||||
= f.label :project_export_enabled, class: 'form-check-label' do
|
||||
= _('Project export enabled')
|
||||
= f.gitlab_ui_checkbox_component :project_export_enabled, s_('AdminSettings|Project export enabled')
|
||||
|
||||
.form-group
|
||||
%label.label-bold= _('Enabled Git access protocols')
|
||||
|
@ -65,9 +60,6 @@
|
|||
|
||||
.form-group
|
||||
%label.label-bold= s_('AdminSettings|Feed token')
|
||||
.form-check
|
||||
= f.check_box :disable_feed_token, class: 'form-check-input'
|
||||
= f.label :disable_feed_token, class: 'form-check-label' do
|
||||
= s_('AdminSettings|Disable feed token')
|
||||
= f.gitlab_ui_checkbox_component :disable_feed_token, s_('AdminSettings|Disable feed token')
|
||||
|
||||
= f.submit _('Save changes'), class: "gl-button btn btn-confirm"
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
= form_for [@project, @issue],
|
||||
= gitlab_ui_form_for [@project, @issue],
|
||||
html: { class: 'issue-form common-note-form gl-mt-3 js-quick-submit gl-show-field-errors', data: issues_form_data(@project) } do |f|
|
||||
= render 'shared/issuable/form', f: f, issuable: @issue
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
= form_for [@project, @merge_request],
|
||||
= gitlab_ui_form_for [@project, @merge_request],
|
||||
html: { class: 'merge-request-form common-note-form js-requires-input js-quick-submit' } do |f|
|
||||
= render 'shared/issuable/form', f: f, issuable: @merge_request, presenter: @mr_presenter
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
%h3.page-title
|
||||
= _('New merge request')
|
||||
= form_for [@project, @merge_request], html: { class: 'merge-request-form common-note-form js-requires-input js-quick-submit' } do |f|
|
||||
= gitlab_ui_form_for [@project, @merge_request], html: { class: 'merge-request-form common-note-form js-requires-input js-quick-submit' } do |f|
|
||||
= render 'shared/issuable/form', f: f, issuable: @merge_request, commits: @commits, presenter: @mr_presenter
|
||||
= f.hidden_field :source_project_id
|
||||
= f.hidden_field :source_branch
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
- issuable = local_assigns.fetch(:issuable)
|
||||
- form = local_assigns.fetch(:form)
|
||||
- contribution_help_link = help_page_path('user/project/merge_requests/allow_collaboration')
|
||||
- contribution_help_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: contribution_help_link }
|
||||
|
||||
- return unless issuable.is_a?(MergeRequest)
|
||||
- return unless issuable.for_fork?
|
||||
|
@ -11,10 +13,7 @@
|
|||
%label.col-form-label.col-sm-2
|
||||
= _('Contribution')
|
||||
.col-sm-10
|
||||
.form-check.gl-mt-2
|
||||
= form.check_box :allow_collaboration, disabled: !issuable.can_allow_collaboration?(current_user), class: 'form-check-input'
|
||||
= form.label :allow_collaboration, class: 'form-check-label' do
|
||||
= _('Allow commits from members who can merge to the target branch.')
|
||||
= link_to 'About this feature', help_page_path('user/project/merge_requests/allow_collaboration'), target: '_blank', rel: 'noopener noreferrer nofollow'
|
||||
.form-text.text-muted
|
||||
= allow_collaboration_unavailable_reason(issuable)
|
||||
= form.gitlab_ui_checkbox_component :allow_collaboration,
|
||||
_('Allow commits from members who can merge to the target branch. %{link_start}About this feature.%{link_end}').html_safe % { link_start: contribution_help_link_start, link_end: '</a>'.html_safe },
|
||||
checkbox_options: { disabled: !issuable.can_allow_collaboration?(current_user) },
|
||||
help_text: allow_collaboration_unavailable_reason(issuable)
|
||||
|
|
|
@ -17,10 +17,8 @@
|
|||
- if issuable.respond_to?(:confidential) && can?(current_user, :set_confidentiality, issuable)
|
||||
.form-group.row
|
||||
.offset-sm-2.col-sm-10
|
||||
.form-check
|
||||
= form.check_box :confidential, class: 'form-check-input'
|
||||
= form.label :confidential, class: 'form-check-label' do
|
||||
#{_('This issue is confidential and should only be visible to team members with at least Reporter access.')}
|
||||
= form.gitlab_ui_checkbox_component :confidential,
|
||||
_('This issue is confidential and should only be visible to team members with at least Reporter access.')
|
||||
|
||||
- if can?(current_user, :"set_#{issuable.to_ability_name}_metadata", issuable)
|
||||
%hr
|
||||
|
|
|
@ -5,4 +5,4 @@ rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/357299
|
|||
milestone: '14.10'
|
||||
type: development
|
||||
group: group::release
|
||||
default_enabled: false
|
||||
default_enabled: true
|
||||
|
|
|
@ -17,6 +17,11 @@ module Gitlab
|
|||
Gitlab::UrlBuilder.build(commit)
|
||||
end
|
||||
|
||||
user_url =
|
||||
if deployment.deployed_by
|
||||
Gitlab::UrlBuilder.build(deployment.deployed_by)
|
||||
end
|
||||
|
||||
{
|
||||
object_kind: 'deployment',
|
||||
status: deployment.status,
|
||||
|
@ -27,8 +32,8 @@ module Gitlab
|
|||
environment: deployment.environment.name,
|
||||
project: deployment.project.hook_attrs,
|
||||
short_sha: deployment.short_sha,
|
||||
user: deployment.deployed_by.hook_attrs,
|
||||
user_url: Gitlab::UrlBuilder.build(deployment.deployed_by),
|
||||
user: deployment.deployed_by&.hook_attrs,
|
||||
user_url: user_url,
|
||||
commit_url: commit_url,
|
||||
commit_title: deployment.commit_title,
|
||||
ref: deployment.ref
|
||||
|
|
|
@ -2700,6 +2700,9 @@ msgstr ""
|
|||
msgid "AdminSettings|Preview payload"
|
||||
msgstr ""
|
||||
|
||||
msgid "AdminSettings|Project export enabled"
|
||||
msgstr ""
|
||||
|
||||
msgid "AdminSettings|Protect CI/CD variables by default"
|
||||
msgstr ""
|
||||
|
||||
|
@ -3672,7 +3675,7 @@ msgstr ""
|
|||
msgid "Allow access to the following IP addresses"
|
||||
msgstr ""
|
||||
|
||||
msgid "Allow commits from members who can merge to the target branch."
|
||||
msgid "Allow commits from members who can merge to the target branch. %{link_start}About this feature.%{link_end}"
|
||||
msgstr ""
|
||||
|
||||
msgid "Allow group owners to manage LDAP-related settings"
|
||||
|
@ -29143,9 +29146,6 @@ msgstr ""
|
|||
msgid "Project export download requests"
|
||||
msgstr ""
|
||||
|
||||
msgid "Project export enabled"
|
||||
msgstr ""
|
||||
|
||||
msgid "Project export has been deleted."
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -17,7 +17,11 @@ module QA
|
|||
end
|
||||
|
||||
def has_todo_list?
|
||||
has_element? :todo_item_container
|
||||
has_element?(:todo_item_container)
|
||||
end
|
||||
|
||||
def has_no_todo_list?
|
||||
has_no_element?(:todo_item_container)
|
||||
end
|
||||
|
||||
def has_latest_todo_item_with_content?(action, title)
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module QA
|
||||
RSpec.shared_context 'merge train spec with user prep' do
|
||||
let(:executor) { "qa-runner-#{Faker::Alphanumeric.alphanumeric(number: 8)}" }
|
||||
let(:file_name) { Faker::Lorem.word }
|
||||
let(:mr_title) { Faker::Lorem.sentence }
|
||||
let(:admin_api_client) { Runtime::API::Client.as_admin }
|
||||
|
||||
let(:user) do
|
||||
Resource::User.fabricate_via_api! do |user|
|
||||
user.api_client = admin_api_client
|
||||
end
|
||||
end
|
||||
|
||||
let(:project) do
|
||||
Resource::Project.fabricate_via_api! do |project|
|
||||
project.name = 'pipeline-for-merge-trains'
|
||||
end
|
||||
end
|
||||
|
||||
let!(:runner) do
|
||||
Resource::Runner.fabricate! do |runner|
|
||||
runner.project = project
|
||||
runner.name = executor
|
||||
runner.tags = [executor]
|
||||
end
|
||||
end
|
||||
|
||||
let!(:project_files) do
|
||||
Resource::Repository::Commit.fabricate_via_api! do |commit|
|
||||
commit.project = project
|
||||
commit.commit_message = 'Add .gitlab-ci.yml'
|
||||
commit.add_files(
|
||||
[
|
||||
{
|
||||
file_path: '.gitlab-ci.yml',
|
||||
content: <<~YAML
|
||||
test_merge_train:
|
||||
tags:
|
||||
- #{executor}
|
||||
script:
|
||||
- sleep 10
|
||||
- echo 'OK!'
|
||||
only:
|
||||
- merge_requests
|
||||
YAML
|
||||
},
|
||||
{
|
||||
file_path: file_name,
|
||||
content: Faker::Lorem.sentence
|
||||
}
|
||||
]
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
before do
|
||||
project.add_member(user, Resource::Members::AccessLevel::MAINTAINER)
|
||||
|
||||
Flow::Login.sign_in
|
||||
project.visit!
|
||||
Flow::MergeRequest.enable_merge_trains
|
||||
|
||||
Flow::Login.sign_in(as: user)
|
||||
|
||||
Resource::MergeRequest.fabricate_via_api! do |merge_request|
|
||||
merge_request.title = mr_title
|
||||
merge_request.project = project
|
||||
merge_request.description = Faker::Lorem.sentence
|
||||
merge_request.target_new_branch = false
|
||||
merge_request.update_existing_file = true
|
||||
merge_request.file_name = file_name
|
||||
merge_request.file_content = Faker::Lorem.sentence
|
||||
end.visit!
|
||||
|
||||
Page::MergeRequest::Show.perform do |show|
|
||||
show.has_pipeline_status?('passed')
|
||||
show.try_to_merge!
|
||||
end
|
||||
end
|
||||
|
||||
after do
|
||||
runner&.remove_via_api!
|
||||
user&.remove_via_api!
|
||||
end
|
||||
end
|
||||
end
|
|
@ -34,16 +34,16 @@ RSpec.describe 'Admin updates settings' do
|
|||
|
||||
it 'uncheck all restricted visibility levels' do
|
||||
page.within('.as-visibility-access') do
|
||||
find('#application_setting_visibility_level_0').set(false)
|
||||
find('#application_setting_visibility_level_10').set(false)
|
||||
find('#application_setting_visibility_level_20').set(false)
|
||||
find('#application_setting_restricted_visibility_levels_0').set(false)
|
||||
find('#application_setting_restricted_visibility_levels_10').set(false)
|
||||
find('#application_setting_restricted_visibility_levels_20').set(false)
|
||||
click_button 'Save changes'
|
||||
end
|
||||
|
||||
expect(page).to have_content "Application settings saved successfully"
|
||||
expect(find('#application_setting_visibility_level_0')).not_to be_checked
|
||||
expect(find('#application_setting_visibility_level_10')).not_to be_checked
|
||||
expect(find('#application_setting_visibility_level_20')).not_to be_checked
|
||||
expect(find('#application_setting_restricted_visibility_levels_0')).not_to be_checked
|
||||
expect(find('#application_setting_restricted_visibility_levels_10')).not_to be_checked
|
||||
expect(find('#application_setting_restricted_visibility_levels_20')).not_to be_checked
|
||||
end
|
||||
|
||||
it 'modify import sources' do
|
||||
|
|
|
@ -57,13 +57,31 @@ RSpec.describe Gitlab::DataBuilder::Deployment do
|
|||
project.repository.remove
|
||||
end
|
||||
|
||||
it 'does not include commit_url' do
|
||||
it 'returns nil for commit_url' do
|
||||
expect(data[:commit_url]).to be_nil
|
||||
end
|
||||
|
||||
it 'does not include commit_title' do
|
||||
it 'returns nil for commit_title' do
|
||||
expect(data[:commit_title]).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
context 'when deployed_by is nil' do
|
||||
let_it_be(:deployment) { create(:deployment, user: nil, deployable: nil) }
|
||||
|
||||
subject(:data) { described_class.build(deployment, Time.current) }
|
||||
|
||||
before(:all) do
|
||||
deployment.user = nil
|
||||
end
|
||||
|
||||
it 'returns nil for user' do
|
||||
expect(data[:user]).to be_nil
|
||||
end
|
||||
|
||||
it 'returns nil for user_url' do
|
||||
expect(data[:user_url]).to be_nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue