Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-03-30 02:58:22 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-03-30 02:58:45 +0300
commit1794d7d6a11019da7fe8bb56536f3fce69d1825d (patch)
tree4975bcf5629d6322feab02d1987676ef5fd5411d /app
parent5825f3338e723e631964bf67d259e3365014a442 (diff)
Add latest changes from gitlab-org/security/gitlab@15-9-stable-ee
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/behaviors/markdown/render_observability.js45
-rw-r--r--app/assets/javascripts/pages/projects/project.js3
-rw-r--r--app/assets/javascripts/repository/index.js7
-rw-r--r--app/assets/javascripts/repository/utils/ref_switcher_utils.js27
-rw-r--r--app/controllers/concerns/confirm_email_warning.rb14
-rw-r--r--app/controllers/projects/blob_controller.rb10
-rw-r--r--app/controllers/projects/refs_controller.rb2
-rw-r--r--app/controllers/projects/tree_controller.rb9
-rw-r--r--app/controllers/projects_controller.rb10
-rw-r--r--app/views/projects/tree/_tree_header.html.haml2
10 files changed, 36 insertions, 93 deletions
diff --git a/app/assets/javascripts/behaviors/markdown/render_observability.js b/app/assets/javascripts/behaviors/markdown/render_observability.js
index d5d46c10efd..704d85cf22e 100644
--- a/app/assets/javascripts/behaviors/markdown/render_observability.js
+++ b/app/assets/javascripts/behaviors/markdown/render_observability.js
@@ -7,36 +7,23 @@ export function getFrameSrc(url) {
}
const mountVueComponent = (element) => {
- const { frameUrl, observabilityUrl } = element.dataset;
+ const url = [element.dataset.frameUrl];
- try {
- if (
- !observabilityUrl ||
- !frameUrl ||
- new URL(frameUrl)?.host !== new URL(observabilityUrl).host
- )
- return;
-
- // eslint-disable-next-line no-new
- new Vue({
- el: element,
- render(h) {
- return h('iframe', {
- style: {
- height: '366px',
- width: '768px',
- },
- attrs: {
- src: getFrameSrc(frameUrl),
- frameBorder: '0',
- },
- });
- },
- });
- } catch (e) {
- // eslint-disable-next-line no-console
- console.error(e);
- }
+ return new Vue({
+ el: element,
+ render(h) {
+ return h('iframe', {
+ style: {
+ height: '366px',
+ width: '768px',
+ },
+ attrs: {
+ src: getFrameSrc(url),
+ frameBorder: '0',
+ },
+ });
+ },
+ });
};
export default function renderObservability(elements) {
diff --git a/app/assets/javascripts/pages/projects/project.js b/app/assets/javascripts/pages/projects/project.js
index a4b3b83a855..5773737c41b 100644
--- a/app/assets/javascripts/pages/projects/project.js
+++ b/app/assets/javascripts/pages/projects/project.js
@@ -110,10 +110,9 @@ export default class Project {
const urlParams = { [fieldName]: ref };
if (params.group === BRANCH_GROUP_NAME) {
urlParams.ref_type = BRANCH_REF_TYPE;
- } else if (params.group === TAG_GROUP_NAME) {
+ } else {
urlParams.ref_type = TAG_REF_TYPE;
}
-
link.href = mergeUrlParams(urlParams, linkTarget);
}
diff --git a/app/assets/javascripts/repository/index.js b/app/assets/javascripts/repository/index.js
index 95e0c94527b..494e270a66c 100644
--- a/app/assets/javascripts/repository/index.js
+++ b/app/assets/javascripts/repository/index.js
@@ -2,7 +2,7 @@ import { GlButton } from '@gitlab/ui';
import Vue from 'vue';
import Vuex from 'vuex';
import { parseBoolean } from '~/lib/utils/common_utils';
-import { joinPaths, escapeFileUrl, visitUrl } from '~/lib/utils/url_utility';
+import { escapeFileUrl, visitUrl } from '~/lib/utils/url_utility';
import { __ } from '~/locale';
import initWebIdeLink from '~/pages/projects/shared/web_ide_link';
import PerformancePlugin from '~/performance/vue_performance_plugin';
@@ -121,7 +121,7 @@ export default function setupVueRepositoryList() {
if (!refSwitcherEl) return false;
- const { projectId, projectRootPath, refType } = refSwitcherEl.dataset;
+ const { projectId, projectRootPath } = refSwitcherEl.dataset;
return new Vue({
el: refSwitcherEl,
@@ -129,8 +129,7 @@ export default function setupVueRepositoryList() {
return createElement(RefSelector, {
props: {
projectId,
- value: refType ? joinPaths('refs', refType, ref) : ref,
- useSymbolicRefNames: true,
+ value: ref,
},
on: {
input(selectedRef) {
diff --git a/app/assets/javascripts/repository/utils/ref_switcher_utils.js b/app/assets/javascripts/repository/utils/ref_switcher_utils.js
index bcad4a2c822..c62f7f709c4 100644
--- a/app/assets/javascripts/repository/utils/ref_switcher_utils.js
+++ b/app/assets/javascripts/repository/utils/ref_switcher_utils.js
@@ -16,29 +16,22 @@ const getNamespaceTargetRegex = (ref) => new RegExp(`(/-/(blob|tree))/${ref}/(.*
* @param {string} selectedRef - The selected ref from the ref dropdown.
*/
export function generateRefDestinationPath(projectRootPath, ref, selectedRef) {
- const url = new URL(window.location.href);
- const currentPath = url.pathname;
- let refType = null;
+ const currentPath = window.location.pathname;
+ const encodedHash = '%23';
let namespace = '/-/tree';
let target;
- let actualRef = selectedRef;
-
- const matches = selectedRef.match(/^refs\/(heads|tags)\/(.+)/);
- if (matches) {
- [, refType, actualRef] = matches;
- }
- if (refType) {
- url.searchParams.set('ref_type', refType);
- } else {
- url.searchParams.delete('ref_type');
- }
-
const NAMESPACE_TARGET_REGEX = getNamespaceTargetRegex(ref);
const match = NAMESPACE_TARGET_REGEX.exec(currentPath);
if (match) {
[, namespace, , target] = match;
}
- url.pathname = joinPaths(projectRootPath, namespace, actualRef, target);
- return url.toString();
+ const destinationPath = joinPaths(
+ projectRootPath,
+ namespace,
+ encodeURI(selectedRef).replace(/#/g, encodedHash),
+ target,
+ );
+
+ return `${destinationPath}${window.location.hash}`;
}
diff --git a/app/controllers/concerns/confirm_email_warning.rb b/app/controllers/concerns/confirm_email_warning.rb
index 2711c823275..ec5140bf223 100644
--- a/app/controllers/concerns/confirm_email_warning.rb
+++ b/app/controllers/concerns/confirm_email_warning.rb
@@ -1,7 +1,6 @@
# frozen_string_literal: true
module ConfirmEmailWarning
- include Gitlab::Utils::StrongMemoize
extend ActiveSupport::Concern
included do
@@ -18,9 +17,11 @@ module ConfirmEmailWarning
return unless current_user
return if current_user.confirmed?
+ email = current_user.unconfirmed_email || current_user.email
+
flash.now[:warning] = format(
confirm_warning_message,
- email: email_to_display,
+ email: email,
resend_link: view_context.link_to(_('Resend it'), user_confirmation_path(user: { email: email }), method: :post),
update_link: view_context.link_to(_('Update it'), profile_path)
).html_safe
@@ -28,16 +29,7 @@ module ConfirmEmailWarning
private
- def email
- current_user.unconfirmed_email || current_user.email
- end
- strong_memoize_attr :email
-
def confirm_warning_message
_("Please check your email (%{email}) to verify that you own this address and unlock the power of CI/CD. Didn't receive it? %{resend_link}. Wrong email address? %{update_link}.")
end
-
- def email_to_display
- html_escape(email)
- end
end
diff --git a/app/controllers/projects/blob_controller.rb b/app/controllers/projects/blob_controller.rb
index b71af82535a..59cea00e26b 100644
--- a/app/controllers/projects/blob_controller.rb
+++ b/app/controllers/projects/blob_controller.rb
@@ -31,7 +31,6 @@ class Projects::BlobController < Projects::ApplicationController
before_action :authorize_edit_tree!, only: [:new, :create, :update, :destroy]
before_action :commit, except: [:new, :create]
- before_action :check_for_ambiguous_ref, only: [:show]
before_action :blob, except: [:new, :create]
before_action :require_branch_head, only: [:edit, :update]
before_action :editor_variables, except: [:show, :preview, :diff]
@@ -146,15 +145,6 @@ class Projects::BlobController < Projects::ApplicationController
end
end
- def check_for_ambiguous_ref
- @ref_type = ref_type
-
- if @ref_type == ExtractsRef::BRANCH_REF_TYPE && ambiguous_ref?(@project, @ref)
- branch = @project.repository.find_branch(@ref)
- redirect_to project_blob_path(@project, File.join(branch.target, @path))
- end
- end
-
def commit
@commit ||= @repository.commit(@ref)
diff --git a/app/controllers/projects/refs_controller.rb b/app/controllers/projects/refs_controller.rb
index f55fc2242a4..4c2bd2a9d42 100644
--- a/app/controllers/projects/refs_controller.rb
+++ b/app/controllers/projects/refs_controller.rb
@@ -22,7 +22,7 @@ class Projects::RefsController < Projects::ApplicationController
when "tree"
project_tree_path(@project, @id)
when "blob"
- project_blob_path(@project, @id, ref_type: ref_type)
+ project_blob_path(@project, @id)
when "graph"
project_network_path(@project, @id, ref_type: ref_type)
when "graphs"
diff --git a/app/controllers/projects/tree_controller.rb b/app/controllers/projects/tree_controller.rb
index 1f7912e15df..737a6290431 100644
--- a/app/controllers/projects/tree_controller.rb
+++ b/app/controllers/projects/tree_controller.rb
@@ -28,15 +28,6 @@ class Projects::TreeController < Projects::ApplicationController
def show
return render_404 unless @commit
- @ref_type = ref_type
- if @ref_type == BRANCH_REF_TYPE && ambiguous_ref?(@project, @ref)
- branch = @project.repository.find_branch(@ref)
- if branch
- redirect_to project_tree_path(@project, branch.target)
- return
- end
- end
-
if tree.entries.empty?
if @repository.blob_at(@commit.id, @path)
redirect_to project_blob_path(@project, File.join(@ref, @path))
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index d71b782c62b..71ad747b6b1 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -171,19 +171,11 @@ class ProjectsController < Projects::ApplicationController
flash.now[:alert] = _("Project '%{project_name}' queued for deletion.") % { project_name: @project.name }
end
- if ambiguous_ref?(@project, @ref)
- branch = @project.repository.find_branch(@ref)
-
- # The files view would render a ref other than the default branch
- # This redirect can be removed once the view is fixed
- redirect_to(project_tree_path(@project, branch.target), alert: _("The default branch of this project clashes with another ref"))
- return
- end
-
respond_to do |format|
format.html do
@notification_setting = current_user.notification_settings_for(@project) if current_user
@project = @project.present(current_user: current_user)
+
render_landing_page
end
diff --git a/app/views/projects/tree/_tree_header.html.haml b/app/views/projects/tree/_tree_header.html.haml
index d494d9cc36d..6cd3c584f2a 100644
--- a/app/views/projects/tree/_tree_header.html.haml
+++ b/app/views/projects/tree/_tree_header.html.haml
@@ -2,7 +2,7 @@
.tree-ref-container.gl-display-flex.gl-flex-wrap.gl-gap-2.mb-2.mb-md-0
.tree-ref-holder.gl-max-w-26
- #js-tree-ref-switcher{ data: { project_id: @project.id, ref_type: @ref_type.to_s, project_root_path: project_path(@project) } }
+ #js-tree-ref-switcher{ data: { project_id: @project.id, project_root_path: project_path(@project) } }
#js-repo-breadcrumb{ data: breadcrumb_data_attributes }