diff options
Diffstat (limited to 'app')
40 files changed, 66 insertions, 81 deletions
diff --git a/app/assets/javascripts/reports/codequality_report/components/codequality_issue_body.vue b/app/assets/javascripts/ci/reports/codequality_report/components/codequality_issue_body.vue index fb2ef850e4f..5a7ee9c9b28 100644 --- a/app/assets/javascripts/reports/codequality_report/components/codequality_issue_body.vue +++ b/app/assets/javascripts/ci/reports/codequality_report/components/codequality_issue_body.vue @@ -5,8 +5,8 @@ */ import { GlIcon, GlTooltipDirective } from '@gitlab/ui'; import { s__ } from '~/locale'; -import ReportLink from '~/reports/components/report_link.vue'; -import { STATUS_SUCCESS, STATUS_NEUTRAL } from '~/reports/constants'; +import ReportLink from '~/ci/reports/components/report_link.vue'; +import { STATUS_SUCCESS, STATUS_NEUTRAL } from '~/ci/reports/constants'; import { SEVERITY_CLASSES, SEVERITY_ICONS } from '../constants'; export default { diff --git a/app/assets/javascripts/reports/codequality_report/constants.js b/app/assets/javascripts/ci/reports/codequality_report/constants.js index 5e81245037f..5e81245037f 100644 --- a/app/assets/javascripts/reports/codequality_report/constants.js +++ b/app/assets/javascripts/ci/reports/codequality_report/constants.js diff --git a/app/assets/javascripts/reports/codequality_report/store/actions.js b/app/assets/javascripts/ci/reports/codequality_report/store/actions.js index 04aca11b945..04aca11b945 100644 --- a/app/assets/javascripts/reports/codequality_report/store/actions.js +++ b/app/assets/javascripts/ci/reports/codequality_report/store/actions.js diff --git a/app/assets/javascripts/reports/codequality_report/store/getters.js b/app/assets/javascripts/ci/reports/codequality_report/store/getters.js index 70d11e96a54..70d11e96a54 100644 --- a/app/assets/javascripts/reports/codequality_report/store/getters.js +++ b/app/assets/javascripts/ci/reports/codequality_report/store/getters.js diff --git a/app/assets/javascripts/reports/codequality_report/store/index.js b/app/assets/javascripts/ci/reports/codequality_report/store/index.js index 5bfcd69edec..5bfcd69edec 100644 --- a/app/assets/javascripts/reports/codequality_report/store/index.js +++ b/app/assets/javascripts/ci/reports/codequality_report/store/index.js diff --git a/app/assets/javascripts/reports/codequality_report/store/mutation_types.js b/app/assets/javascripts/ci/reports/codequality_report/store/mutation_types.js index c362c973ae1..c362c973ae1 100644 --- a/app/assets/javascripts/reports/codequality_report/store/mutation_types.js +++ b/app/assets/javascripts/ci/reports/codequality_report/store/mutation_types.js diff --git a/app/assets/javascripts/reports/codequality_report/store/mutations.js b/app/assets/javascripts/ci/reports/codequality_report/store/mutations.js index 249c2f35c0b..249c2f35c0b 100644 --- a/app/assets/javascripts/reports/codequality_report/store/mutations.js +++ b/app/assets/javascripts/ci/reports/codequality_report/store/mutations.js diff --git a/app/assets/javascripts/reports/codequality_report/store/state.js b/app/assets/javascripts/ci/reports/codequality_report/store/state.js index f68dbc2a5fa..f68dbc2a5fa 100644 --- a/app/assets/javascripts/reports/codequality_report/store/state.js +++ b/app/assets/javascripts/ci/reports/codequality_report/store/state.js diff --git a/app/assets/javascripts/reports/codequality_report/store/utils/codequality_parser.js b/app/assets/javascripts/ci/reports/codequality_report/store/utils/codequality_parser.js index 417297df43c..417297df43c 100644 --- a/app/assets/javascripts/reports/codequality_report/store/utils/codequality_parser.js +++ b/app/assets/javascripts/ci/reports/codequality_report/store/utils/codequality_parser.js diff --git a/app/assets/javascripts/reports/components/grouped_issues_list.vue b/app/assets/javascripts/ci/reports/components/grouped_issues_list.vue index ca369022938..b21a486e259 100644 --- a/app/assets/javascripts/reports/components/grouped_issues_list.vue +++ b/app/assets/javascripts/ci/reports/components/grouped_issues_list.vue @@ -1,6 +1,6 @@ <script> import { s__ } from '~/locale'; -import ReportItem from '~/reports/components/report_item.vue'; +import ReportItem from '~/ci/reports/components/report_item.vue'; import SmartVirtualList from '~/vue_shared/components/smart_virtual_list.vue'; export default { diff --git a/app/assets/javascripts/reports/components/issue_body.js b/app/assets/javascripts/ci/reports/components/issue_body.js index 4f418216024..daff1be30ff 100644 --- a/app/assets/javascripts/reports/components/issue_body.js +++ b/app/assets/javascripts/ci/reports/components/issue_body.js @@ -1,4 +1,4 @@ -import IssueStatusIcon from '~/reports/components/issue_status_icon.vue'; +import IssueStatusIcon from '~/ci/reports/components/issue_status_icon.vue'; export const components = { CodequalityIssueBody: () => import('../codequality_report/components/codequality_issue_body.vue'), diff --git a/app/assets/javascripts/reports/components/issue_status_icon.vue b/app/assets/javascripts/ci/reports/components/issue_status_icon.vue index bd41b8d23f1..bd41b8d23f1 100644 --- a/app/assets/javascripts/reports/components/issue_status_icon.vue +++ b/app/assets/javascripts/ci/reports/components/issue_status_icon.vue diff --git a/app/assets/javascripts/reports/components/issues_list.vue b/app/assets/javascripts/ci/reports/components/issues_list.vue index 9df0a1953b6..ababd4b5e49 100644 --- a/app/assets/javascripts/reports/components/issues_list.vue +++ b/app/assets/javascripts/ci/reports/components/issues_list.vue @@ -1,6 +1,6 @@ <script> -import ReportItem from '~/reports/components/report_item.vue'; -import { STATUS_FAILED, STATUS_NEUTRAL, STATUS_SUCCESS } from '~/reports/constants'; +import ReportItem from '~/ci/reports/components/report_item.vue'; +import { STATUS_FAILED, STATUS_NEUTRAL, STATUS_SUCCESS } from '~/ci/reports/constants'; import SmartVirtualList from '~/vue_shared/components/smart_virtual_list.vue'; const wrapIssueWithState = (status, isNew = false) => (issue) => ({ diff --git a/app/assets/javascripts/reports/components/report_item.vue b/app/assets/javascripts/ci/reports/components/report_item.vue index 918263bfb5c..97d4ac7bf6f 100644 --- a/app/assets/javascripts/reports/components/report_item.vue +++ b/app/assets/javascripts/ci/reports/components/report_item.vue @@ -4,7 +4,7 @@ import { componentNames, iconComponents, iconComponentNames, -} from 'ee_else_ce/reports/components/issue_body'; +} from 'ee_else_ce/ci/reports/components/issue_body'; export default { name: 'ReportItem', diff --git a/app/assets/javascripts/reports/components/report_link.vue b/app/assets/javascripts/ci/reports/components/report_link.vue index 1f68f79e487..1f68f79e487 100644 --- a/app/assets/javascripts/reports/components/report_link.vue +++ b/app/assets/javascripts/ci/reports/components/report_link.vue diff --git a/app/assets/javascripts/reports/components/report_section.vue b/app/assets/javascripts/ci/reports/components/report_section.vue index 468c8916b8d..468c8916b8d 100644 --- a/app/assets/javascripts/reports/components/report_section.vue +++ b/app/assets/javascripts/ci/reports/components/report_section.vue diff --git a/app/assets/javascripts/reports/components/summary_row.vue b/app/assets/javascripts/ci/reports/components/summary_row.vue index ee55368c829..ee55368c829 100644 --- a/app/assets/javascripts/reports/components/summary_row.vue +++ b/app/assets/javascripts/ci/reports/components/summary_row.vue diff --git a/app/assets/javascripts/reports/constants.js b/app/assets/javascripts/ci/reports/constants.js index bad6fa1e7b9..bad6fa1e7b9 100644 --- a/app/assets/javascripts/reports/constants.js +++ b/app/assets/javascripts/ci/reports/constants.js diff --git a/app/assets/javascripts/diffs/components/diff_code_quality.vue b/app/assets/javascripts/diffs/components/diff_code_quality.vue index 8498724740f..78f34bf355e 100644 --- a/app/assets/javascripts/diffs/components/diff_code_quality.vue +++ b/app/assets/javascripts/diffs/components/diff_code_quality.vue @@ -1,6 +1,6 @@ <script> import { GlButton, GlIcon } from '@gitlab/ui'; -import { SEVERITY_CLASSES, SEVERITY_ICONS } from '~/reports/codequality_report/constants'; +import { SEVERITY_CLASSES, SEVERITY_ICONS } from '~/ci/reports/codequality_report/constants'; export default { components: { GlButton, GlIcon }, diff --git a/app/assets/javascripts/groups/components/transfer_group_form.vue b/app/assets/javascripts/groups/components/transfer_group_form.vue index 15a193f7cb8..3da417ebf0a 100644 --- a/app/assets/javascripts/groups/components/transfer_group_form.vue +++ b/app/assets/javascripts/groups/components/transfer_group_form.vue @@ -73,6 +73,7 @@ export default { :disabled="disableSubmitButton" :phrase="confirmationPhrase" :button-text="confirmButtonText" + button-qa-selector="transfer_group_button" @confirm="$emit('confirm')" /> </div> diff --git a/app/assets/javascripts/vue_merge_request_widget/extensions/code_quality/index.js b/app/assets/javascripts/vue_merge_request_widget/extensions/code_quality/index.js index 75da975bba0..6924279ffaf 100644 --- a/app/assets/javascripts/vue_merge_request_widget/extensions/code_quality/index.js +++ b/app/assets/javascripts/vue_merge_request_widget/extensions/code_quality/index.js @@ -1,8 +1,8 @@ import { n__, s__, sprintf } from '~/locale'; import axios from '~/lib/utils/axios_utils'; import { EXTENSION_ICONS } from '~/vue_merge_request_widget/constants'; -import { SEVERITY_ICONS_MR_WIDGET } from '~/reports/codequality_report/constants'; -import { parseCodeclimateMetrics } from '~/reports/codequality_report/store/utils/codequality_parser'; +import { SEVERITY_ICONS_MR_WIDGET } from '~/ci/reports/codequality_report/constants'; +import { parseCodeclimateMetrics } from '~/ci/reports/codequality_report/store/utils/codequality_parser'; import { capitalizeFirstCharacter } from '~/lib/utils/text_utility'; export default { diff --git a/app/assets/javascripts/vue_shared/security_reports/security_reports_app.vue b/app/assets/javascripts/vue_shared/security_reports/security_reports_app.vue index 0e1975e1c09..b739baad5d7 100644 --- a/app/assets/javascripts/vue_shared/security_reports/security_reports_app.vue +++ b/app/assets/javascripts/vue_shared/security_reports/security_reports_app.vue @@ -2,8 +2,8 @@ import { mapActions, mapGetters } from 'vuex'; import { createAlert } from '~/flash'; import { s__ } from '~/locale'; -import ReportSection from '~/reports/components/report_section.vue'; -import { ERROR, SLOT_SUCCESS, SLOT_LOADING, SLOT_ERROR } from '~/reports/constants'; +import ReportSection from '~/ci/reports/components/report_section.vue'; +import { ERROR, SLOT_SUCCESS, SLOT_LOADING, SLOT_ERROR } from '~/ci/reports/constants'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import HelpIcon from './components/help_icon.vue'; import SecurityReportDownloadDropdown from './components/security_report_download_dropdown.vue'; diff --git a/app/assets/javascripts/vue_shared/security_reports/store/getters.js b/app/assets/javascripts/vue_shared/security_reports/store/getters.js index 08f6bcca15b..c274f531139 100644 --- a/app/assets/javascripts/vue_shared/security_reports/store/getters.js +++ b/app/assets/javascripts/vue_shared/security_reports/store/getters.js @@ -1,5 +1,5 @@ import { s__, sprintf } from '~/locale'; -import { LOADING, ERROR, SUCCESS } from '~/reports/constants'; +import { LOADING, ERROR, SUCCESS } from '~/ci/reports/constants'; import { TRANSLATION_IS_LOADING } from './messages'; import { countVulnerabilities, groupedTextBuilder } from './utils'; diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 4de6b5de42a..a0e5fe0203d 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -426,8 +426,8 @@ class ApplicationController < ActionController::Base # accepting the terms. redirect_path = if request.get? request.fullpath - else - URI(request.referer).path if request.referer + elsif request.referer + URI(request.referer).path end flash[:notice] = message diff --git a/app/controllers/passwords_controller.rb b/app/controllers/passwords_controller.rb index 1216353be36..38cdb16c350 100644 --- a/app/controllers/passwords_controller.rb +++ b/app/controllers/passwords_controller.rb @@ -58,8 +58,8 @@ class PasswordsController < Devise::PasswordsController def check_password_authentication_available if resource return if resource.allow_password_authentication? - else - return if Gitlab::CurrentSettings.password_authentication_enabled? + elsif Gitlab::CurrentSettings.password_authentication_enabled? + return end redirect_to after_sending_reset_password_instructions_path_for(resource_name), diff --git a/app/finders/personal_access_tokens_finder.rb b/app/finders/personal_access_tokens_finder.rb index 8403c531945..5af08cf0660 100644 --- a/app/finders/personal_access_tokens_finder.rb +++ b/app/finders/personal_access_tokens_finder.rb @@ -33,7 +33,7 @@ class PersonalAccessTokensFinder attr_reader :current_user def by_current_user(tokens) - return tokens if current_user.nil? || current_user.admin? + return tokens if current_user.nil? || current_user.can_admin_all_resources? return PersonalAccessToken.none unless Ability.allowed?(current_user, :read_user_personal_access_tokens, params[:user]) tokens diff --git a/app/finders/projects_finder.rb b/app/finders/projects_finder.rb index 126687ae41f..3c42a1f769f 100644 --- a/app/finders/projects_finder.rb +++ b/app/finders/projects_finder.rb @@ -97,12 +97,10 @@ class ProjectsFinder < UnionFinder current_user.owned_projects elsif min_access_level? current_user.authorized_projects(params[:min_access_level]) + elsif private_only? || impossible_visibility_level? + current_user.authorized_projects else - if private_only? || impossible_visibility_level? - current_user.authorized_projects - else - Project.public_or_visible_to_user(current_user) - end + Project.public_or_visible_to_user(current_user) end end diff --git a/app/graphql/resolvers/work_items/work_item_discussions_resolver.rb b/app/graphql/resolvers/work_items/work_item_discussions_resolver.rb index 15f17ceb8c6..b40d85e8003 100644 --- a/app/graphql/resolvers/work_items/work_item_discussions_resolver.rb +++ b/app/graphql/resolvers/work_items/work_item_discussions_resolver.rb @@ -9,6 +9,9 @@ module Resolvers authorize :read_work_item authorizes_object! + # this resolver may be calling gitaly as part of parsing notes that contain commit references + calls_gitaly! + alias_method :notes_widget, :object argument :filter, Types::WorkItems::NotesFilterTypeEnum, diff --git a/app/graphql/types/notes/note_type.rb b/app/graphql/types/notes/note_type.rb index 8caaf9982cd..05629ea9223 100644 --- a/app/graphql/types/notes/note_type.rb +++ b/app/graphql/types/notes/note_type.rb @@ -83,7 +83,7 @@ module Types def id return super unless object.is_a?(SyntheticNote) - ::Gitlab::GlobalId.build(object, model_name: object.class.to_s, id: "not-persisted") + ::Gitlab::GlobalId.build(object, model_name: object.class.to_s, id: object.discussion_id) end end end diff --git a/app/helpers/diff_helper.rb b/app/helpers/diff_helper.rb index 6868fed711e..e0a1697cfa9 100644 --- a/app/helpers/diff_helper.rb +++ b/app/helpers/diff_helper.rb @@ -76,13 +76,11 @@ module DiffHelper def diff_line_content(line) if line.blank? " ".html_safe - else + elsif line.start_with?('+', '-', ' ') # `sub` and substring-ing would destroy HTML-safeness of `line` - if line.start_with?('+', '-', ' ') - line[1, line.length] - else - line - end + line[1, line.length] + else + line end end diff --git a/app/helpers/issuables_helper.rb b/app/helpers/issuables_helper.rb index eaed41eeb08..c43cca3a81d 100644 --- a/app/helpers/issuables_helper.rb +++ b/app/helpers/issuables_helper.rb @@ -348,12 +348,10 @@ module IssuablesHelper else [_("Closed"), "merge-request-close"] end + elsif issuable.open? + [_("Open"), "issues"] else - if issuable.open? - [_("Open"), "issues"] - else - [_("Closed"), "issue-closed"] - end + [_("Closed"), "issue-closed"] end end diff --git a/app/helpers/members_helper.rb b/app/helpers/members_helper.rb index f1f5f941edd..29f94adcc78 100644 --- a/app/helpers/members_helper.rb +++ b/app/helpers/members_helper.rb @@ -14,19 +14,17 @@ module MembersHelper else "deny #{member.user.name}'s request to join" end + elsif member.user + "remove #{member.user.name} from" else - if member.user - "remove #{member.user.name} from" - else - e = RuntimeError.new("Data integrity error: no associated user for member ID #{member.id}") - Gitlab::ErrorTracking.track_exception(e, - member_id: member.id, - invite_email: member.invite_email, - invite_accepted_at: member.invite_accepted_at, - source_id: member.source_id, - source_type: member.source_type) - "remove this orphaned member from" - end + e = RuntimeError.new("Data integrity error: no associated user for member ID #{member.id}") + Gitlab::ErrorTracking.track_exception(e, + member_id: member.id, + invite_email: member.invite_email, + invite_accepted_at: member.invite_accepted_at, + source_id: member.source_id, + source_type: member.source_type) + "remove this orphaned member from" end "#{text} #{action} the #{member.source.human_name} #{source_text(member)}?" diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb index 9c3cb547cef..3696721a062 100644 --- a/app/helpers/search_helper.rb +++ b/app/helpers/search_helper.rb @@ -565,12 +565,10 @@ module SearchHelper else :success end + elsif issuable.closed? + :info else - if issuable.closed? - :info - else - :success - end + :success end end diff --git a/app/models/namespace.rb b/app/models/namespace.rb index 35502b429d0..d6df73f1c0e 100644 --- a/app/models/namespace.rb +++ b/app/models/namespace.rb @@ -552,12 +552,10 @@ class Namespace < ApplicationRecord def shared_runners_setting if shared_runners_enabled SR_ENABLED + elsif allow_descendants_override_disabled_shared_runners + SR_DISABLED_WITH_OVERRIDE else - if allow_descendants_override_disabled_shared_runners - SR_DISABLED_WITH_OVERRIDE - else - SR_DISABLED_AND_UNOVERRIDABLE - end + SR_DISABLED_AND_UNOVERRIDABLE end end diff --git a/app/presenters/project_presenter.rb b/app/presenters/project_presenter.rb index 17f39d5bff3..ab050bbaf42 100644 --- a/app/presenters/project_presenter.rb +++ b/app/presenters/project_presenter.rb @@ -290,16 +290,14 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated 'btn-default', nil, 'license') - else - if can_current_user_push_to_default_branch? - AnchorData.new(false, + elsif can_current_user_push_to_default_branch? + AnchorData.new(false, content_tag(:span, statistic_icon + _('Add LICENSE'), class: 'add-license-link d-flex'), empty_repo? ? add_license_ide_path : add_license_path) - else - AnchorData.new(false, - icon + content_tag(:span, _('No license. All rights reserved'), class: 'project-stat-value'), - nil) - end + else + AnchorData.new(false, + icon + content_tag(:span, _('No license. All rights reserved'), class: 'project-stat-value'), + nil) end end diff --git a/app/services/issuable/discussions_list_service.rb b/app/services/issuable/discussions_list_service.rb index 7aa0363af01..d11ba6c6adf 100644 --- a/app/services/issuable/discussions_list_service.rb +++ b/app/services/issuable/discussions_list_service.rb @@ -39,12 +39,9 @@ module Issuable notes = prepare_notes_for_rendering(notes) - # TODO: optimize this permission check. - # Given this loads notes on a single issuable and current permission system, we should not have to check - # permission on every single note. We should be able to check permission on the given issuable or its container, - # which should result in just one permission check. Perhaps that should also either be passed to NotesFinder or - # should be done in NotesFinder, which would decide right away if it would need to return no notes - # or if it should just filter out internal notes. + # we need to check the permission on every note, because some system notes for instance can have references to + # resources that some user do not have read access, so those notes are filtered out from the list of notes. + # see Note#all_referenced_mentionables_allowed? notes = notes.select { |n| n.readable_by?(current_user) } Discussion.build_collection(notes, issuable) diff --git a/app/services/system_notes/commit_service.rb b/app/services/system_notes/commit_service.rb index c89998f77c7..592351079aa 100644 --- a/app/services/system_notes/commit_service.rb +++ b/app/services/system_notes/commit_service.rb @@ -81,12 +81,10 @@ module SystemNotes commit_ids = if count == 1 existing_commits.first.short_id + elsif oldrev && !Gitlab::Git.blank_ref?(oldrev) + "#{Commit.truncate_sha(oldrev)}...#{existing_commits.last.short_id}" else - if oldrev && !Gitlab::Git.blank_ref?(oldrev) - "#{Commit.truncate_sha(oldrev)}...#{existing_commits.last.short_id}" - else - "#{existing_commits.first.short_id}..#{existing_commits.last.short_id}" - end + "#{existing_commits.first.short_id}..#{existing_commits.last.short_id}" end commits_text = "#{count} commit".pluralize(count) diff --git a/app/services/task_list_toggle_service.rb b/app/services/task_list_toggle_service.rb index 082fa1447fc..8e20ffc2a52 100644 --- a/app/services/task_list_toggle_service.rb +++ b/app/services/task_list_toggle_service.rb @@ -44,8 +44,8 @@ class TaskListToggleService # any `[ ]` or `[x]` in the middle of the text if currently_checked markdown_task.sub!(Taskable::COMPLETE_PATTERN, '[ ]') unless toggle_as_checked - else - markdown_task.sub!(Taskable::INCOMPLETE_PATTERN, '[x]') if toggle_as_checked + elsif toggle_as_checked + markdown_task.sub!(Taskable::INCOMPLETE_PATTERN, '[x]') end source_lines[source_line_index] = markdown_task diff --git a/app/uploaders/gitlab_uploader.rb b/app/uploaders/gitlab_uploader.rb index abe06bd97e1..29091eb93ef 100644 --- a/app/uploaders/gitlab_uploader.rb +++ b/app/uploaders/gitlab_uploader.rb @@ -101,8 +101,8 @@ class GitlabUploader < CarrierWave::Uploader::Base stream = if file_storage? File.open(path, "rb") if path - else - ::Gitlab::HttpIO.new(url, cached_size) if url + elsif url + ::Gitlab::HttpIO.new(url, cached_size) end return unless stream diff --git a/app/views/groups/settings/_transfer.html.haml b/app/views/groups/settings/_transfer.html.haml index 5f485a56f98..3c76e8a864a 100644 --- a/app/views/groups/settings/_transfer.html.haml +++ b/app/views/groups/settings/_transfer.html.haml @@ -1,7 +1,7 @@ - form_id = "transfer-group-form" - initial_data = { button_text: s_('GroupSettings|Transfer group'), group_name: @group.name, group_id: @group.id, target_form_id: form_id, is_paid_group: group.paid?.to_s } -.sub-section +.sub-section{ data: { qa_selector: 'transfer_group_content' } } %h4.warning-title= s_('GroupSettings|Transfer group') %p= _('Transfer group to another parent group.') = form_for group, url: transfer_group_path(group), method: :put, html: { id: form_id, class: 'js-group-transfer-form' } do |f| |