Commit 529b3f14 authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@master

parent deb3457cee64
......@@ -58,6 +58,7 @@ export default {
<template>
<div class="ide-stage card prepend-top-default">
<div
ref="cardHeader"
:class="{
'border-bottom-0': stage.isCollapsed,
}"
......@@ -79,7 +80,7 @@ export default {
</div>
<icon :name="collapseIcon" class="ide-stage-collapse-icon" />
</div>
<div v-show="!stage.isCollapsed" class="card-body">
<div v-show="!stage.isCollapsed" ref="jobList" class="card-body">
<gl-loading-icon v-if="showLoadingIcon" />
<template v-else>
<item v-for="job in stage.jobs" :key="job.id" :job="job" @clickViewLog="clickViewLog" />
......
......@@ -95,10 +95,10 @@ export class SearchAutocomplete {
this.createAutocomplete();
}
this.searchInput.addClass('disabled');
this.saveTextLength();
this.bindEvents();
this.dropdownToggle.dropdown();
this.searchInput.addClass('js-autocomplete-disabled');
}
// Finds an element inside wrapper element
......@@ -338,7 +338,7 @@ export class SearchAutocomplete {
if (!this.dropdown.hasClass('show')) {
this.loadingSuggestions = false;
this.dropdownToggle.dropdown('toggle');
return this.searchInput.removeClass('disabled');
return this.searchInput.removeClass('js-autocomplete-disabled');
}
}
......@@ -432,8 +432,8 @@ export class SearchAutocomplete {
}
disableAutocomplete() {
if (!this.searchInput.hasClass('disabled') && this.dropdown.hasClass('show')) {
this.searchInput.addClass('disabled');
if (!this.searchInput.hasClass('js-autocomplete-disabled') && this.dropdown.hasClass('show')) {
this.searchInput.addClass('js-autocomplete-disabled');
this.dropdown.removeClass('show').trigger('hidden.bs.dropdown');
this.restoreMenu();
}
......
# frozen_string_literal: true
module RedirectsForMissingPathOnTree
def redirect_to_tree_root_for_missing_path(project, ref, path)
redirect_to project_tree_path(project, ref), notice: missing_path_on_ref(path, ref)
end
private
def missing_path_on_ref(path, ref)
_('"%{path}" did not exist on "%{ref}"') % { path: truncate_path(path), ref: ref }
end
def truncate_path(path)
path.reverse.truncate(60, separator: "/").reverse
end
end
......@@ -3,6 +3,7 @@
# Controller for viewing a file's blame
class Projects::BlameController < Projects::ApplicationController
include ExtractsPath
include RedirectsForMissingPathOnTree
before_action :require_non_empty_project
before_action :assign_ref_vars
......@@ -11,7 +12,9 @@ class Projects::BlameController < Projects::ApplicationController
def show
@blob = @repository.blob_at(@commit.id, @path)
return render_404 unless @blob
unless @blob
return redirect_to_tree_root_for_missing_path(@project, @ref, @path)
end
environment_params = @repository.branch_exists?(@ref) ? { ref: @ref } : { commit: @commit }
@environment = EnvironmentsFinder.new(@project, current_user, environment_params).execute.last
......
......@@ -7,6 +7,7 @@ class Projects::BlobController < Projects::ApplicationController
include RendersBlob
include NotesHelper
include ActionView::Helpers::SanitizeHelper
include RedirectsForMissingPathOnTree
prepend_before_action :authenticate_user!, only: [:edit]
around_action :allow_gitaly_ref_name_caching, only: [:show]
......@@ -119,7 +120,7 @@ def blob
end
end
return render_404
return redirect_to_tree_root_for_missing_path(@project, @ref, @path)
end
end
......
......@@ -12,7 +12,7 @@ class Projects::JobsController < Projects::ApplicationController
before_action :authorize_use_build_terminal!, only: [:terminal, :terminal_websocket_authorize]
before_action :verify_api_request!, only: :terminal_websocket_authorize
before_action only: [:show] do
push_frontend_feature_flag(:job_log_json)
push_frontend_feature_flag(:job_log_json, project)
end
layout 'project'
......
......@@ -5,6 +5,7 @@ class Projects::TreeController < Projects::ApplicationController
include ExtractsPath
include CreatesCommit
include ActionView::Helpers::SanitizeHelper
include RedirectsForMissingPathOnTree
around_action :allow_gitaly_ref_name_caching, only: [:show]
......@@ -19,12 +20,9 @@ def show
if tree.entries.empty?
if @repository.blob_at(@commit.id, @path)
return redirect_to(
project_blob_path(@project,
File.join(@ref, @path))
)
return redirect_to project_blob_path(@project, File.join(@ref, @path))
elsif @path.present?
return render_404
return redirect_to_tree_root_for_missing_path(@project, @ref, @path)
end
end
......
---
title: When a user views a file's blame or blob and switches to a branch where the
current file does not exist, they will now be redirected to the root of the repository.
merge_request: 18169
author: Jesse Hall @jessehall3
type: changed
---
title: Bump Gitaly to 1.70.0 and remove cache invalidation feature flag
merge_request: 18766
author:
type: other
---
title: Fix incorrect selection of custom templates
merge_request: 17205
author:
type: fixed
......@@ -3,71 +3,17 @@
class SetSelfMonitoringProjectAlertingToken < ActiveRecord::Migration[5.2]
DOWNTIME = false
module Migratable
module Alerting
class ProjectAlertingSetting < ApplicationRecord
self.table_name = 'project_alerting_settings'
belongs_to :project
validates :token, presence: true
attr_encrypted :token,
mode: :per_attribute_iv,
key: Settings.attr_encrypted_db_key_base_truncated,
algorithm: 'aes-256-gcm'
before_validation :ensure_token
private
def ensure_token
self.token ||= generate_token
end
def generate_token
SecureRandom.hex
end
end
end
class Project < ApplicationRecord
has_one :alerting_setting, inverse_of: :project, class_name: 'Alerting::ProjectAlertingSetting'
end
class ApplicationSetting < ApplicationRecord
self.table_name = 'application_settings'
belongs_to :instance_administration_project, class_name: 'Project'
def self.current_without_cache
last
end
end
end
def setup_alertmanager_token(project)
return unless License.feature_available?(:prometheus_alerts)
project.create_alerting_setting!
end
def up
Gitlab.ee do
project = Migratable::ApplicationSetting.current_without_cache&.instance_administration_project
# no-op
# Converted to no-op in https://gitlab.com/gitlab-org/gitlab/merge_requests/17049.
if project
setup_alertmanager_token(project)
end
end
# This migration has been made a no-op because the pre-requisite migration
# which creates the self-monitoring project has already been removed in
# https://gitlab.com/gitlab-org/gitlab/merge_requests/16864. As
# such, this migration would do nothing.
end
def down
Gitlab.ee do
Migratable::ApplicationSetting.current_without_cache
&.instance_administration_project
&.alerting_setting
&.destroy!
end
# no-op
end
end
......@@ -83,6 +83,7 @@ This was originally implemented in: <https://gitlab.com/gitlab-org/gitlab-foss/m
- In JS tests, shifting elements can cause Capybara to misclick when the element moves at the exact time Capybara sends the click
- [Dropdowns rendering upward or downward due to window size and scroll position](https://gitlab.com/gitlab-org/gitlab/merge_requests/17660)
- [Lazy loaded images can cause Capybara to misclick](https://gitlab.com/gitlab-org/gitlab/merge_requests/18713)
- [Triggering JS events before the event handlers are set up](https://gitlab.com/gitlab-org/gitlab/merge_requests/18742)
#### Capybara viewport size related issues
......
# Generic alerts integration **(ULTIMATE)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/13203) in [GitLab Ultimate](https://about.gitlab.com/pricing/) 12.3.
> [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/13203) in [GitLab Ultimate](https://about.gitlab.com/pricing/) 12.4.
GitLab can accept alerts from any source via a generic webhook receiver.
When you set up the generic alerts integration, a unique endpoint will
......@@ -16,7 +16,7 @@ authored by the GitLab Alert Bot.
To set up the generic alerts integration:
1. Navigate to **Settings > Integrations** in a project.
1. Click on **Alert endpoint**.
1. Click on **Alerts endpoint**.
1. Toggle the **Active** alert setting. The `URL` and `Authorization Key` for the webhook configuration can be found there.
## Customizing the payload
......
......@@ -7,7 +7,6 @@ class Gitaly
# Server feature flags should use '_' to separate words.
SERVER_FEATURE_FLAGS =
%w[
cache_invalidator
inforef_uploadpack_cache
get_all_lfs_pointers_go
].freeze
......
......@@ -62,6 +62,9 @@ msgstr ""
msgid " or references (e.g. path/to/project!merge_request_id)"
msgstr ""
msgid "\"%{path}\" did not exist on \"%{ref}\""
msgstr ""
msgid "%d comment"
msgid_plural "%d comments"
msgstr[0] ""
......
......@@ -36,7 +36,6 @@ def fabricate_via_api!
runner.tags = tags
runner.image = image
runner.config = config if config
runner.run_untagged = true
runner.register!
end
end
......
# frozen_string_literal: true
require 'spec_helper'
describe RedirectsForMissingPathOnTree, type: :controller do
controller(ActionController::Base) do
include Gitlab::Routing.url_helpers
include RedirectsForMissingPathOnTree
def fake
redirect_to_tree_root_for_missing_path(Project.find(params[:project_id]), params[:ref], params[:file_path])
end
end
let(:project) { create(:project) }
before do
routes.draw { get 'fake' => 'anonymous#fake' }
end
describe '#redirect_to_root_path' do
it 'redirects to the tree path with a notice' do
long_file_path = ('a/b/' * 30) + 'foo.txt'
truncated_file_path = '...b/' + ('a/b/' * 12) + 'foo.txt'
expected_message = "\"#{truncated_file_path}\" did not exist on \"theref\""
get :fake, params: { project_id: project.id, ref: 'theref', file_path: long_file_path }
expect(response).to redirect_to project_tree_path(project, 'theref')
expect(response.flash[:notice]).to eq(expected_message)
end
end
end
......@@ -25,14 +25,25 @@
})
end
context "valid file" do
context "valid branch, valid file" do
let(:id) { 'master/files/ruby/popen.rb' }
it { is_expected.to respond_with(:success) }
end
context "invalid file" do
let(:id) { 'master/files/ruby/missing_file.rb'}
it { expect(response).to have_gitlab_http_status(404) }
context "valid branch, invalid file" do
let(:id) { 'master/files/ruby/invalid-path.rb' }
it 'redirects' do
expect(subject)
.to redirect_to("/#{project.full_path}/tree/master")
end
end
context "invalid branch, valid file" do
let(:id) { 'invalid-branch/files/ruby/missing_file.rb'}
it { is_expected.to respond_with(:not_found) }
end
end
end
......@@ -24,26 +24,34 @@
context "valid branch, valid file" do
let(:id) { 'master/README.md' }
it { is_expected.to respond_with(:success) }
end
context "valid branch, invalid file" do
let(:id) { 'master/invalid-path.rb' }
it { is_expected.to respond_with(:not_found) }
it 'redirects' do
expect(subject)
.to redirect_to("/#{project.full_path}/tree/master")
end
end
context "invalid branch, valid file" do
let(:id) { 'invalid-branch/README.md' }
it { is_expected.to respond_with(:not_found) }
end
context "binary file" do
let(:id) { 'binary-encoding/encoding/binary-1.bin' }
it { is_expected.to respond_with(:success) }
end
context "Markdown file" do
let(:id) { 'master/README.md' }
it { is_expected.to respond_with(:success) }
end
end
......@@ -104,6 +112,7 @@
context 'redirect to tree' do
let(:id) { 'markdown/doc' }
it 'redirects' do
expect(subject)
.to redirect_to("/#{project.full_path}/tree/markdown/doc")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment