diff options
Diffstat (limited to 'app')
25 files changed, 57 insertions, 38 deletions
diff --git a/app/assets/javascripts/pages/projects/settings/ci_cd/show/index.js b/app/assets/javascripts/pages/projects/settings/ci_cd/show/index.js index aeeef40fc6e..e08d0407245 100644 --- a/app/assets/javascripts/pages/projects/settings/ci_cd/show/index.js +++ b/app/assets/javascripts/pages/projects/settings/ci_cd/show/index.js @@ -3,7 +3,6 @@ import SecretValues from '~/behaviors/secret_values'; import AjaxVariableList from '~/ci_variable_list/ajax_variable_list'; import registrySettingsApp from '~/registry/settings/registry_settings_bundle'; import initVariableList from '~/ci_variable_list'; -import initDeployKeys from '~/deploy_keys'; document.addEventListener('DOMContentLoaded', () => { // Initialize expandable settings panels @@ -41,5 +40,4 @@ document.addEventListener('DOMContentLoaded', () => { }); registrySettingsApp(); - initDeployKeys(); }); diff --git a/app/assets/javascripts/pages/projects/settings/repository/form.js b/app/assets/javascripts/pages/projects/settings/repository/form.js index fa6d17f0729..3e02893f24c 100644 --- a/app/assets/javascripts/pages/projects/settings/repository/form.js +++ b/app/assets/javascripts/pages/projects/settings/repository/form.js @@ -3,6 +3,7 @@ import ProtectedTagCreate from '~/protected_tags/protected_tag_create'; import ProtectedTagEditList from '~/protected_tags/protected_tag_edit_list'; import initSettingsPanels from '~/settings_panels'; +import initDeployKeys from '~/deploy_keys'; import ProtectedBranchCreate from '~/protected_branches/protected_branch_create'; import ProtectedBranchEditList from '~/protected_branches/protected_branch_edit_list'; import DueDateSelectors from '~/due_date_select'; @@ -11,6 +12,7 @@ import fileUpload from '~/lib/utils/file_upload'; export default () => { new ProtectedTagCreate(); new ProtectedTagEditList(); + initDeployKeys(); initSettingsPanels(); new ProtectedBranchCreate(); new ProtectedBranchEditList(); diff --git a/app/assets/javascripts/repository/components/breadcrumbs.vue b/app/assets/javascripts/repository/components/breadcrumbs.vue index d78b2d9d962..886e9d76cca 100644 --- a/app/assets/javascripts/repository/components/breadcrumbs.vue +++ b/app/assets/javascripts/repository/components/breadcrumbs.vue @@ -108,14 +108,14 @@ export default { return acc.concat({ name, path, - to: `/-/tree/${joinPaths(escapeFileUrl(this.ref), path)}`, + to: `/-/tree/${joinPaths(this.escapedRef, path)}`, }); }, [ { name: this.projectShortPath, path: '/', - to: `/-/tree/${escapeFileUrl(this.ref)}/`, + to: `/-/tree/${this.escapedRef}/`, }, ], ); diff --git a/app/assets/javascripts/repository/components/table/index.vue b/app/assets/javascripts/repository/components/table/index.vue index 2ba170998e8..c8549180a25 100644 --- a/app/assets/javascripts/repository/components/table/index.vue +++ b/app/assets/javascripts/repository/components/table/index.vue @@ -81,7 +81,7 @@ export default { <tbody> <parent-row v-show="showParentRow" - :commit-ref="ref" + :commit-ref="escapedRef" :path="path" :loading-path="loadingPath" /> diff --git a/app/assets/javascripts/repository/components/table/parent_row.vue b/app/assets/javascripts/repository/components/table/parent_row.vue index 0a8ee5f2fc5..b4095e00884 100644 --- a/app/assets/javascripts/repository/components/table/parent_row.vue +++ b/app/assets/javascripts/repository/components/table/parent_row.vue @@ -1,6 +1,5 @@ <script> import { GlLoadingIcon } from '@gitlab/ui'; -import { escapeFileUrl } from '~/lib/utils/url_utility'; export default { components: { @@ -29,7 +28,7 @@ export default { return splitArray.map(p => encodeURIComponent(p)).join('/'); }, parentRoute() { - return { path: `/-/tree/${escapeFileUrl(this.commitRef)}/${this.parentPath}` }; + return { path: `/-/tree/${this.commitRef}/${this.parentPath}` }; }, }, methods: { diff --git a/app/assets/javascripts/repository/components/table/row.vue b/app/assets/javascripts/repository/components/table/row.vue index 6bd1c702a82..f741a6df5d9 100644 --- a/app/assets/javascripts/repository/components/table/row.vue +++ b/app/assets/javascripts/repository/components/table/row.vue @@ -99,7 +99,7 @@ export default { computed: { routerLinkTo() { return this.isFolder - ? { path: `/-/tree/${escapeFileUrl(this.ref)}/${escapeFileUrl(this.path)}` } + ? { path: `/-/tree/${this.escapedRef}/${escapeFileUrl(this.path)}` } : null; }, isFolder() { diff --git a/app/assets/javascripts/repository/index.js b/app/assets/javascripts/repository/index.js index 05783fc3b5d..6528e283372 100644 --- a/app/assets/javascripts/repository/index.js +++ b/app/assets/javascripts/repository/index.js @@ -15,14 +15,15 @@ import { __ } from '../locale'; export default function setupVueRepositoryList() { const el = document.getElementById('js-tree-list'); const { dataset } = el; - const { projectPath, projectShortPath, ref, fullName } = dataset; - const router = createRouter(projectPath, ref); + const { projectPath, projectShortPath, ref, escapedRef, fullName } = dataset; + const router = createRouter(projectPath, escapedRef); apolloProvider.clients.defaultClient.cache.writeData({ data: { projectPath, projectShortPath, ref, + escapedRef, vueFileListLfsBadge: gon.features?.vueFileListLfsBadge || false, commits: [], }, diff --git a/app/assets/javascripts/repository/log_tree.js b/app/assets/javascripts/repository/log_tree.js index 8cad4a14f31..cef17bf7acb 100644 --- a/app/assets/javascripts/repository/log_tree.js +++ b/app/assets/javascripts/repository/log_tree.js @@ -23,13 +23,13 @@ export function fetchLogsTree(client, path, offset, resolver = null) { if (fetchpromise) return fetchpromise; const { projectPath } = client.readQuery({ query: getProjectPath }); - const { ref } = client.readQuery({ query: getRef }); + const { escapedRef } = client.readQuery({ query: getRef }); fetchpromise = axios .get( - `${gon.relative_url_root}/${projectPath}/-/refs/${encodeURIComponent( - ref, - )}/logs_tree/${encodeURIComponent(path.replace(/^\//, ''))}`, + `${gon.relative_url_root}/${projectPath}/-/refs/${escapedRef}/logs_tree/${encodeURIComponent( + path.replace(/^\//, ''), + )}`, { params: { format: 'json', offset }, }, diff --git a/app/assets/javascripts/repository/mixins/get_ref.js b/app/assets/javascripts/repository/mixins/get_ref.js index a43e0e91bcf..99d19b77c35 100644 --- a/app/assets/javascripts/repository/mixins/get_ref.js +++ b/app/assets/javascripts/repository/mixins/get_ref.js @@ -4,11 +4,19 @@ export default { apollo: { ref: { query: getRef, + manual: true, + result({ data, loading }) { + if (!loading) { + this.ref = data.ref; + this.escapedRef = data.escapedRef; + } + }, }, }, data() { return { ref: '', + escapedRef: '', }; }, }; diff --git a/app/assets/javascripts/repository/queries/getRef.query.graphql b/app/assets/javascripts/repository/queries/getRef.query.graphql index 58c09844c3f..91afb751626 100644 --- a/app/assets/javascripts/repository/queries/getRef.query.graphql +++ b/app/assets/javascripts/repository/queries/getRef.query.graphql @@ -1,3 +1,4 @@ query getRef { ref @client + escapedRef @client } diff --git a/app/assets/javascripts/repository/router.js b/app/assets/javascripts/repository/router.js index b2636f910fe..49e024ca4ff 100644 --- a/app/assets/javascripts/repository/router.js +++ b/app/assets/javascripts/repository/router.js @@ -12,7 +12,7 @@ export default function createRouter(base, baseRef) { base: joinPaths(gon.relative_url_root || '', base), routes: [ { - path: `(/-)?/tree/(${encodeURIComponent(baseRef).replace(/%2F/g, '/')}|${baseRef})/:path*`, + path: `(/-)?/tree/${baseRef}/:path*`, name: 'treePath', component: TreePage, props: route => ({ diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 26ef6117e1c..b5695322eb6 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -497,7 +497,7 @@ class ApplicationController < ActionController::Base end def public_visibility_restricted? - Gitlab::CurrentSettings.restricted_visibility_levels.include? Gitlab::VisibilityLevel::PUBLIC + Gitlab::VisibilityLevel.public_visibility_restricted? end def set_usage_stats_consent_flag diff --git a/app/controllers/projects/deploy_keys_controller.rb b/app/controllers/projects/deploy_keys_controller.rb index f43e9f2bd19..761225e897f 100644 --- a/app/controllers/projects/deploy_keys_controller.rb +++ b/app/controllers/projects/deploy_keys_controller.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true class Projects::DeployKeysController < Projects::ApplicationController + include RepositorySettingsRedirect respond_to :html # Authorize @@ -11,7 +12,7 @@ class Projects::DeployKeysController < Projects::ApplicationController def index respond_to do |format| - format.html { redirect_to_ci_cd_settings } + format.html { redirect_to_repository } format.json do render json: Projects::Settings::DeployKeysPresenter.new(@project, current_user: current_user).as_json end @@ -19,7 +20,7 @@ class Projects::DeployKeysController < Projects::ApplicationController end def new - redirect_to_ci_cd_settings + redirect_to_repository end def create @@ -29,7 +30,7 @@ class Projects::DeployKeysController < Projects::ApplicationController flash[:alert] = @key.errors.full_messages.join(', ').html_safe end - redirect_to_ci_cd_settings + redirect_to_repository end def edit @@ -38,7 +39,7 @@ class Projects::DeployKeysController < Projects::ApplicationController def update if deploy_key.update(update_params) flash[:notice] = _('Deploy key was successfully updated.') - redirect_to_ci_cd_settings + redirect_to_repository else render 'edit' end @@ -50,7 +51,7 @@ class Projects::DeployKeysController < Projects::ApplicationController return render_404 unless key respond_to do |format| - format.html { redirect_to_ci_cd_settings } + format.html { redirect_to_repository } format.json { head :ok } end end @@ -61,7 +62,7 @@ class Projects::DeployKeysController < Projects::ApplicationController return render_404 unless deploy_key_project respond_to do |format| - format.html { redirect_to_ci_cd_settings } + format.html { redirect_to_repository } format.json { head :ok } end end @@ -97,7 +98,9 @@ class Projects::DeployKeysController < Projects::ApplicationController end end - def redirect_to_ci_cd_settings - redirect_to project_settings_ci_cd_path(@project, anchor: 'js-deploy-keys-settings') + private + + def redirect_to_repository + redirect_to_repository_settings(@project, anchor: 'js-deploy-keys-settings') end end diff --git a/app/controllers/projects/refs_controller.rb b/app/controllers/projects/refs_controller.rb index b4ca9074ca9..7c606bd8c45 100644 --- a/app/controllers/projects/refs_controller.rb +++ b/app/controllers/projects/refs_controller.rb @@ -11,6 +11,10 @@ class Projects::RefsController < Projects::ApplicationController before_action :assign_ref_vars before_action :authorize_download_code! + before_action only: [:logs_tree] do + push_frontend_feature_flag(:vue_file_list_lfs_badge) + end + def switch respond_to do |format| format.html do diff --git a/app/controllers/projects/settings/ci_cd_controller.rb b/app/controllers/projects/settings/ci_cd_controller.rb index c4d291e8634..d0d100fd88c 100644 --- a/app/controllers/projects/settings/ci_cd_controller.rb +++ b/app/controllers/projects/settings/ci_cd_controller.rb @@ -88,7 +88,6 @@ module Projects define_triggers_variables define_badges_variables define_auto_devops_variables - define_deploy_keys end def define_runners_variables @@ -135,10 +134,6 @@ module Projects def define_auto_devops_variables @auto_devops = @project.auto_devops || ProjectAutoDevops.new end - - def define_deploy_keys - @deploy_keys = DeployKeysPresenter.new(@project, current_user: current_user) - end end end end diff --git a/app/controllers/projects/settings/repository_controller.rb b/app/controllers/projects/settings/repository_controller.rb index 68bab952217..0aa55dcc5b9 100644 --- a/app/controllers/projects/settings/repository_controller.rb +++ b/app/controllers/projects/settings/repository_controller.rb @@ -63,6 +63,8 @@ module Projects end def define_variables + @deploy_keys = DeployKeysPresenter.new(@project, current_user: current_user) + define_deploy_token_variables define_protected_refs remote_mirror diff --git a/app/helpers/explore_helper.rb b/app/helpers/explore_helper.rb index b66c7a69b71..026dbd60ac6 100644 --- a/app/helpers/explore_helper.rb +++ b/app/helpers/explore_helper.rb @@ -52,7 +52,7 @@ module ExploreHelper end def public_visibility_restricted? - Gitlab::CurrentSettings.restricted_visibility_levels&.include? Gitlab::VisibilityLevel::PUBLIC + Gitlab::VisibilityLevel.public_visibility_restricted? end private diff --git a/app/helpers/tree_helper.rb b/app/helpers/tree_helper.rb index 0b50b8b1130..4dc00581703 100644 --- a/app/helpers/tree_helper.rb +++ b/app/helpers/tree_helper.rb @@ -194,6 +194,7 @@ module TreeHelper project_path: project.full_path, project_short_path: project.path, ref: ref, + escaped_ref: ActionDispatch::Journey::Router::Utils.escape_path(ref), full_name: project.name_with_namespace } end diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 8bc75b6c164..e515447e394 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -982,6 +982,8 @@ module Ci jwt = Gitlab::Ci::Jwt.for_build(self) variables.append(key: 'CI_JOB_JWT', value: jwt, public: false, masked: true) + rescue OpenSSL::PKey::RSAError => e + Gitlab::ErrorTracking.track_exception(e) end end end diff --git a/app/services/discussions/capture_diff_note_position_service.rb b/app/services/discussions/capture_diff_note_position_service.rb index 273a60f7e55..8f12470d9e8 100644 --- a/app/services/discussions/capture_diff_note_position_service.rb +++ b/app/services/discussions/capture_diff_note_position_service.rb @@ -17,6 +17,7 @@ module Discussions return unless result position = result[:position] + return unless position # Currently position data is copied across all notes of a discussion # It makes sense to store a position only for the first note instead diff --git a/app/services/projects/create_service.rb b/app/services/projects/create_service.rb index cef86e9763c..429ae905e3d 100644 --- a/app/services/projects/create_service.rb +++ b/app/services/projects/create_service.rb @@ -173,6 +173,10 @@ module Projects def create_prometheus_service service = @project.find_or_initialize_service(::PrometheusService.to_param) + # If the service has already been inserted in the database, that + # means it came from a template, and there's nothing more to do. + return if service.persisted? + if service.prometheus_available? service.save! else diff --git a/app/views/layouts/_page.html.haml b/app/views/layouts/_page.html.haml index 80a14412968..49345b7b215 100644 --- a/app/views/layouts/_page.html.haml +++ b/app/views/layouts/_page.html.haml @@ -5,7 +5,7 @@ .mobile-overlay .alert-wrapper = render 'shared/outdated_browser' - - if Feature.enabled?(:subscribable_banner_license) + - if Feature.enabled?(:subscribable_banner_license, default_enabled: true) = render_if_exists "layouts/header/ee_subscribable_banner" = render "layouts/broadcast" = render "layouts/header/read_only_banner" diff --git a/app/views/projects/commits/_commits.html.haml b/app/views/projects/commits/_commits.html.haml index 2e5953bf0a6..e413bd78789 100644 --- a/app/views/projects/commits/_commits.html.haml +++ b/app/views/projects/commits/_commits.html.haml @@ -4,22 +4,21 @@ - commits = @commits - hidden = @hidden_commit_count -- commits_count = @commits.size -- commits.chunk { |c| c.committed_date.in_time_zone.to_date }.each do |day, commits| +- commits.chunk { |c| c.committed_date.in_time_zone.to_date }.each do |day, daily_commits| %li.commit-header.js-commit-header{ data: { day: day } } %span.day= l(day, format: '%d %b, %Y') - %span.commits-count= n_("%d commit", "%d commits", commits_count) % commits_count + %span.commits-count= n_("%d commit", "%d commits", daily_commits.size) % daily_commits.size %li.commits-row{ data: { day: day } } %ul.content-list.commit-list.flex-list - = render partial: 'projects/commits/commit', collection: commits, locals: { project: project, ref: ref, merge_request: merge_request } + = render partial: 'projects/commits/commit', collection: daily_commits, locals: { project: project, ref: ref, merge_request: merge_request } - if hidden > 0 %li.alert.alert-warning = n_('%s additional commit has been omitted to prevent performance issues.', '%s additional commits have been omitted to prevent performance issues.', hidden) % number_with_delimiter(hidden) -- if commits_count == 0 +- if commits.size == 0 .mt-4.text-center .bold = _('Your search didn\'t match any commits.') diff --git a/app/views/projects/settings/ci_cd/show.html.haml b/app/views/projects/settings/ci_cd/show.html.haml index 4c9de58cc01..1358077f2b2 100644 --- a/app/views/projects/settings/ci_cd/show.html.haml +++ b/app/views/projects/settings/ci_cd/show.html.haml @@ -51,8 +51,6 @@ .settings-content = render 'ci/variables/index', save_endpoint: project_variables_path(@project) -= render @deploy_keys - %section.settings.no-animate#js-pipeline-triggers{ class: ('expanded' if expanded) } .settings-header %h4 diff --git a/app/views/projects/settings/repository/show.html.haml b/app/views/projects/settings/repository/show.html.haml index 77606bfea42..193053c8c97 100644 --- a/app/views/projects/settings/repository/show.html.haml +++ b/app/views/projects/settings/repository/show.html.haml @@ -13,6 +13,7 @@ -# reused in EE. = render "projects/settings/repository/protected_branches" = render "shared/deploy_tokens/index", group_or_project: @project, description: deploy_token_description += render @deploy_keys = render "projects/cleanup/show" = render_if_exists 'shared/promotions/promote_repository_features' |