Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2020-07-11 06:09:15 +00:00
parent b6e23edd65
commit 7cd0959043
15 changed files with 120 additions and 48 deletions

View file

@ -57,7 +57,6 @@ linters:
- "app/views/admin/spam_logs/_spam_log.html.haml"
- "app/views/admin/spam_logs/index.html.haml"
- "app/views/admin/system_info/show.html.haml"
- "app/views/admin/users/_access_levels.html.haml"
- "app/views/admin/users/_form.html.haml"
- "app/views/admin/users/_head.html.haml"
- "app/views/admin/users/_profile.html.haml"

View file

@ -1,3 +1,4 @@
import { has } from 'lodash';
import { isInIssuePage, isInMRPage, isInEpicPage } from './common_utils';
export const addClassIfElementExists = (element, className) => {
@ -25,3 +26,24 @@ export const toggleContainerClasses = (containerEl, classList) => {
});
}
};
/**
* Return a object mapping element dataset names to booleans.
*
* This is useful for data- attributes whose presense represent
* a truthiness, no matter the value of the attribute. The absense of the
* attribute represents falsiness.
*
* This can be useful when Rails-provided boolean-like values are passed
* directly to the HAML template, rather than cast to a string.
*
* @param {HTMLElement} element - The DOM element to inspect
* @param {string[]} names - The dataset (i.e., camelCase) names to inspect
* @returns {Object.<string, boolean>}
*/
export const parseBooleanDataAttributes = ({ dataset }, names) =>
names.reduce((acc, name) => {
acc[name] = has(dataset, name);
return acc;
}, {});

View file

@ -52,13 +52,12 @@ module BlobHelper
edit_button_tag(blob,
common_classes,
_('Edit'),
Feature.enabled?(:web_ide_default) ? ide_edit_path(project, ref, path) : edit_blob_path(project, ref, path, options),
edit_blob_path(project, ref, path, options),
project,
ref)
end
def ide_edit_button(project = @project, ref = @ref, path = @path, blob:)
return if Feature.enabled?(:web_ide_default)
return unless blob
edit_button_tag(blob,

View file

@ -26,13 +26,9 @@ class DiffFileBaseEntity < Grape::Entity
target_project, target_branch = edit_project_branch_options(merge_request)
if Feature.enabled?(:web_ide_default)
ide_edit_path(target_project, target_branch, diff_file.new_path)
else
options = merge_request.persisted? && merge_request.source_branch_exists? && !merge_request.merged? ? { from_merge_request_iid: merge_request.iid } : {}
options = merge_request.persisted? && merge_request.source_branch_exists? && !merge_request.merged? ? { from_merge_request_iid: merge_request.iid } : {}
project_edit_blob_path(target_project, tree_join(target_branch, diff_file.new_path), options)
end
project_edit_blob_path(target_project, tree_join(target_branch, diff_file.new_path), options)
end
expose :old_path_html do |diff_file|

View file

@ -1,5 +1,6 @@
%fieldset
%legend Access
%legend
= s_('AdminUsers|Access')
.form-group.row
.col-sm-2.col-form-label
= f.label :projects_limit
@ -7,43 +8,43 @@
= f.number_field :projects_limit, min: 0, max: Gitlab::Database::MAX_INT_VALUE, class: 'form-control'
.form-group.row
.col-sm-2.col-form-label
.col-sm-2.col-form-label.gl-pt-0
= f.label :can_create_group
.col-sm-10
= f.check_box :can_create_group
.form-group.row
.col-sm-2.col-form-label
.col-sm-2.col-form-label.gl-pt-0
= f.label :access_level
.col-sm-10
- editing_current_user = (current_user == @user)
= f.radio_button :access_level, :regular, disabled: editing_current_user
= f.label :access_level_regular, class: 'font-weight-bold' do
Regular
= s_('AdminUsers|Regular')
%p.light
Regular users have access to their groups and projects
= s_('AdminUsers|Regular users have access to their groups and projects')
= render_if_exists 'admin/users/auditor_access_level_radio', f: f, disabled: editing_current_user
= f.radio_button :access_level, :admin, disabled: editing_current_user
= f.label :access_level_admin, class: 'font-weight-bold' do
Admin
= s_('AdminUsers|Admin')
%p.light
Administrators have access to all groups, projects and users and can manage all features in this installation
= s_('AdminUsers|Administrators have access to all groups, projects and users and can manage all features in this installation')
- if editing_current_user
%p.light
You cannot remove your own admin rights.
= s_('AdminUsers|You cannot remove your own admin rights.')
.form-group.row
.col-sm-2.col-form-label
.col-sm-2.col-form-label.gl-pt-0
= f.label :external
.hidden{ data: user_internal_regex_data }
.col-sm-10
.col-sm-10.gl-display-flex.gl-align-items-baseline
= f.check_box :external do
External
%p.light
External users cannot see internal or private projects unless access is explicitly granted. Also, external users cannot create projects, groups, or personal snippets.
= s_('AdminUsers|External')
%p.light.gl-pl-2
= s_('AdminUsers|External users cannot see internal or private projects unless access is explicitly granted. Also, external users cannot create projects, groups, or personal snippets.')
%row.hidden#warning_external_automatically_set.hidden
.badge.badge-warning.text-white
= _('Automatically marked as default internal user')
= s_('AdminUsers|Automatically marked as default internal user')

View file

@ -0,0 +1,5 @@
---
title: Align "External" access level row in the user admin form
merge_request: 34455
author: Eduardo Sanz @esanzgar
type: fixed

View file

@ -173,6 +173,7 @@ configuration option in `gitlab.yml`. These metrics are served from the
| `geo_repositories_retrying_verification_count` | Gauge | 11.2 | Number of repositories verification failures that Geo is actively trying to correct on secondary | `url` |
| `geo_wikis_retrying_verification_count` | Gauge | 11.2 | Number of wikis verification failures that Geo is actively trying to correct on secondary | `url` |
| `global_search_bulk_cron_queue_size` | Gauge | 12.10 | Number of database records waiting to be synchronized to Elasticsearch | |
| `global_search_awaiting_indexing_queue_size` | Gauge | 13.2 | Number of database updates waiting to be synchronized to Elasticsearch while indexing is paused | |
| `package_files_count` | Gauge | 13.0 | Number of package files on primary | `url` |
| `package_files_checksummed_count` | Gauge | 13.0 | Number of package files checksummed on primary | `url` |
| `package_files_checksum_failed_count` | Gauge | 13.0 | Number of package files failed to calculate the checksum on primary

View file

@ -1774,15 +1774,24 @@ msgstr ""
msgid "AdminUsers|2FA Enabled"
msgstr ""
msgid "AdminUsers|Access"
msgstr ""
msgid "AdminUsers|Active"
msgstr ""
msgid "AdminUsers|Admin"
msgstr ""
msgid "AdminUsers|Administrators have access to all groups, projects and users and can manage all features in this installation"
msgstr ""
msgid "AdminUsers|Admins"
msgstr ""
msgid "AdminUsers|Automatically marked as default internal user"
msgstr ""
msgid "AdminUsers|Block"
msgstr ""
@ -1831,6 +1840,9 @@ msgstr ""
msgid "AdminUsers|External"
msgstr ""
msgid "AdminUsers|External users cannot see internal or private projects unless access is explicitly granted. Also, external users cannot create projects, groups, or personal snippets."
msgstr ""
msgid "AdminUsers|Is using seat"
msgstr ""
@ -1855,6 +1867,12 @@ msgstr ""
msgid "AdminUsers|Reactivating a user will:"
msgstr ""
msgid "AdminUsers|Regular"
msgstr ""
msgid "AdminUsers|Regular users have access to their groups and projects"
msgstr ""
msgid "AdminUsers|Restore user access to the account, including web, Git and API."
msgstr ""
@ -1909,6 +1927,9 @@ msgstr ""
msgid "AdminUsers|You are about to permanently delete the user %{username}. This will delete all of the issues, merge requests, and groups linked to them. To avoid data loss, consider using the %{strong_start}block user%{strong_end} feature instead. Once you %{strong_start}Delete user%{strong_end}, it cannot be undone or recovered."
msgstr ""
msgid "AdminUsers|You cannot remove your own admin rights."
msgstr ""
msgid "Administration"
msgstr ""
@ -3423,9 +3444,6 @@ msgstr ""
msgid "Automatically create merge requests for vulnerabilities that have fixes available."
msgstr ""
msgid "Automatically marked as default internal user"
msgstr ""
msgid "Automatically resolved"
msgstr ""
@ -20423,6 +20441,9 @@ msgstr ""
msgid "SecurityConfiguration|Testing & Compliance"
msgstr ""
msgid "SecurityConfiguration|You can quickly enable all security scanning tools by enabling %{linkStart}Auto DevOps%{linkEnd}."
msgstr ""
msgid "SecurityReports|%{firstProject} and %{secondProject}"
msgstr ""

View file

@ -20,7 +20,7 @@ RSpec.describe 'a maintainer edits files on a source-branch of an MR from a fork
end
before do
stub_feature_flags(web_ide_default: false, single_mr_diff_view: false)
stub_feature_flags(single_mr_diff_view: false)
target_project.add_maintainer(user)
sign_in(user)

View file

@ -11,10 +11,6 @@ RSpec.describe 'Editing file blob', :js do
let(:file_path) { project.repository.ls_files(project.repository.root_ref)[1] }
let(:readme_file_path) { 'README.md' }
before do
stub_feature_flags(web_ide_default: false)
end
context 'as a developer' do
let(:user) { create(:user) }
let(:role) { :developer }

View file

@ -14,8 +14,6 @@ RSpec.describe 'Projects > Files > User creates files', :js do
let(:user) { create(:user) }
before do
stub_feature_flags(web_ide_default: false)
project.add_maintainer(user)
sign_in(user)
end

View file

@ -11,8 +11,6 @@ RSpec.describe 'Projects > Files > User edits files', :js do
let(:user) { create(:user) }
before do
stub_feature_flags(web_ide_default: false)
sign_in(user)
end

View file

@ -1,4 +1,9 @@
import { addClassIfElementExists, canScrollUp, canScrollDown } from '~/lib/utils/dom_utils';
import {
addClassIfElementExists,
canScrollUp,
canScrollDown,
parseBooleanDataAttributes,
} from '~/lib/utils/dom_utils';
const TEST_MARGIN = 5;
@ -112,4 +117,47 @@ describe('DOM Utils', () => {
expect(canScrollDown(element, TEST_MARGIN)).toBe(false);
});
});
describe('parseBooleanDataAttributes', () => {
let element;
beforeEach(() => {
setFixtures('<div data-foo-bar data-baz data-qux="">');
element = document.querySelector('[data-foo-bar]');
});
it('throws if not given an element', () => {
expect(() => parseBooleanDataAttributes(null, ['baz'])).toThrow();
});
it('throws if not given an array of dataset names', () => {
expect(() => parseBooleanDataAttributes(element)).toThrow();
});
it('returns an empty object if given an empty array of names', () => {
expect(parseBooleanDataAttributes(element, [])).toEqual({});
});
it('correctly parses boolean-like data attributes', () => {
expect(
parseBooleanDataAttributes(element, [
'fooBar',
'foobar',
'baz',
'qux',
'doesNotExist',
'toString',
]),
).toEqual({
fooBar: true,
foobar: false,
baz: true,
qux: true,
doesNotExist: false,
// Ensure prototype properties aren't false positives
toString: false,
});
});
});
});

View file

@ -53,20 +53,12 @@ RSpec.describe BlobHelper do
end
it 'returns a link with the proper route' do
stub_feature_flags(web_ide_default: false)
link = helper.edit_blob_button(project, 'master', 'README.md')
expect(Capybara.string(link).find_link('Edit')[:href]).to eq("/#{project.full_path}/-/edit/master/README.md")
end
it 'returns a link with a Web IDE route' do
link = helper.edit_blob_button(project, 'master', 'README.md')
expect(Capybara.string(link).find_link('Edit')[:href]).to eq("/-/ide/project/#{project.full_path}/edit/master/-/README.md")
end
it 'returns a link with the passed link_opts on the expected route' do
stub_feature_flags(web_ide_default: false)
link = helper.edit_blob_button(project, 'master', 'README.md', link_opts: { mr_id: 10 })
expect(Capybara.string(link).find_link('Edit')[:href]).to eq("/#{project.full_path}/-/edit/master/README.md?mr_id=10")

View file

@ -40,10 +40,6 @@ RSpec.describe DiffFileBaseEntity do
let(:options) { { request: EntityRequest.new(current_user: create(:user)), merge_request: merge_request } }
let(:params) { {} }
before do
stub_feature_flags(web_ide_default: false)
end
shared_examples 'a diff file edit path to the source branch' do
it do
expect(entity[:edit_path]).to eq(Gitlab::Routing.url_helpers.project_edit_blob_path(project, File.join(merge_request.source_branch, diff_file.new_path), params))