Commit d8211a0e authored by GitLab Bot's avatar GitLab Bot

Add latest changes from gitlab-org/gitlab@master

parent edd04207
......@@ -74,6 +74,7 @@ export default function initDiffsApp(store) {
isFluidLayout: parseBoolean(dataset.isFluidLayout),
dismissEndpoint: dataset.dismissEndpoint,
showSuggestPopover: parseBoolean(dataset.showSuggestPopover),
showWhitespaceDefault: parseBoolean(dataset.showWhitespaceDefault),
};
},
computed: {
......@@ -82,11 +83,15 @@ export default function initDiffsApp(store) {
}),
},
created() {
let hideWhitespace = getParameterValues('w')[0];
const treeListStored = localStorage.getItem(TREE_LIST_STORAGE_KEY);
const renderTreeList = treeListStored !== null ? parseBoolean(treeListStored) : true;
this.setRenderTreeList(renderTreeList);
this.setShowWhitespace({ showWhitespace: getParameterValues('w')[0] !== '1' });
if (!hideWhitespace) {
hideWhitespace = this.showWhitespaceDefault ? '0' : '1';
}
this.setShowWhitespace({ showWhitespace: hideWhitespace !== '1' });
},
methods: {
...mapActions('diffs', ['setRenderTreeList', 'setShowWhitespace']),
......@@ -103,6 +108,7 @@ export default function initDiffsApp(store) {
isFluidLayout: this.isFluidLayout,
dismissEndpoint: this.dismissEndpoint,
showSuggestPopover: this.showSuggestPopover,
showWhitespaceDefault: this.showWhitespaceDefault,
},
});
},
......
......@@ -30,6 +30,7 @@ module IssuableActions
respond_to do |format|
format.html do
@issuable_sidebar = serializer.represent(issuable, serializer: 'sidebar') # rubocop:disable Gitlab/ModuleWithInstanceVariables
render 'show'
end
format.json do
......
......@@ -46,7 +46,8 @@ class Profiles::PreferencesController < Profiles::ApplicationController
:first_day_of_week,
:preferred_language,
:time_display_relative,
:time_format_in_24h
:time_format_in_24h,
:show_whitespace_in_diffs
]
end
end
......
......@@ -21,7 +21,8 @@ class Projects::IssuesController < Projects::ApplicationController
prepend_before_action(only: [:index]) { authenticate_sessionless_user!(:rss) }
prepend_before_action(only: [:calendar]) { authenticate_sessionless_user!(:ics) }
prepend_before_action :authenticate_user!, only: [:new]
prepend_before_action :store_uri, only: [:new, :show]
# designs is only applicable to EE, but defining a prepend_before_action in EE code would overwrite this
prepend_before_action :store_uri, only: [:new, :show, :designs]
before_action :whitelist_query_limiting, only: [:create, :create_merge_request, :move, :bulk_update]
before_action :check_issues_available!
......@@ -43,6 +44,8 @@ class Projects::IssuesController < Projects::ApplicationController
respond_to :html
alias_method :designs, :show
def index
@issues = @issuables
......
......@@ -48,6 +48,7 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
@commits_count = @merge_request.commits_count
@issuable_sidebar = serializer.represent(@merge_request, serializer: 'sidebar')
@current_user_data = UserSerializer.new(project: @project).represent(current_user, {}, MergeRequestUserEntity).to_json
@show_whitespace_default = current_user.nil? || current_user.show_whitespace_in_diffs
set_pipeline_variables
......
......@@ -235,6 +235,7 @@ class User < ApplicationRecord
delegate :timezone, :timezone=, to: :user_preference
delegate :time_display_relative, :time_display_relative=, to: :user_preference
delegate :time_format_in_24h, :time_format_in_24h=, to: :user_preference
delegate :show_whitespace_in_diffs, :show_whitespace_in_diffs=, to: :user_preference
accepts_nested_attributes_for :user_preference, update_only: true
......
......@@ -61,6 +61,10 @@
= f.select :project_view, project_view_choices, {}, class: 'select2'
.form-text.text-muted
= s_('Preferences|Choose what content you want to see on a project’s overview page.')
.form-group.form-check
= f.check_box :show_whitespace_in_diffs, class: 'form-check-input'
= f.label :show_whitespace_in_diffs, class: 'form-check-label' do
= s_('Preferences|Show whitespace in diffs')
.col-sm-12
%hr
......
......@@ -83,7 +83,8 @@
changes_empty_state_illustration: image_path('illustrations/merge_request_changes_empty.svg'),
is_fluid_layout: fluid_layout.to_s,
dismiss_endpoint: user_callouts_path,
show_suggest_popover: show_suggest_popover?.to_s } }
show_suggest_popover: show_suggest_popover?.to_s,
show_whitespace_default: @show_whitespace_default.to_s } }
.mr-loading-status
= spinner
......
......@@ -519,7 +519,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
get :discussions, format: :json
Gitlab.ee do
get 'designs(/*vueroute)', to: 'issues#show', as: :designs, format: false
get 'designs(/*vueroute)', to: 'issues#designs', as: :designs, format: false
end
end
......
# frozen_string_literal: true
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class AddShowWhitespaceInDiffsToUserPreferences < ActiveRecord::Migration[5.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
add_column_with_default :user_preferences, :show_whitespace_in_diffs, :boolean, default: true, allow_null: false
end
def down
remove_column :user_preferences, :show_whitespace_in_diffs
end
end
......@@ -3478,6 +3478,7 @@ ActiveRecord::Schema.define(version: 2019_09_12_061145) do
t.boolean "time_display_relative"
t.boolean "time_format_in_24h"
t.string "projects_sort", limit: 64
t.boolean "show_whitespace_in_diffs", default: true, null: false
t.index ["user_id"], name: "index_user_preferences_on_user_id", unique: true
end
......
......@@ -49,6 +49,7 @@ Configuring environments involves:
1. Understanding how [pipelines](pipelines.md) work.
1. Defining environments in your project's [`.gitlab-ci.yml`](yaml/README.md) file.
1. Creating a job configured to deploy your application. For example, a deploy job configured with [`environment`](yaml/README.md#environment) to deploy your application to a [Kubernetes cluster](../user/project/clusters/index.md).
The rest of this section illustrates how to configure environments and deployments using
an example scenario. It assumes you have already:
......
......@@ -11329,6 +11329,9 @@ msgstr ""
msgid "Preferences|Project overview content"
msgstr ""
msgid "Preferences|Show whitespace in diffs"
msgstr ""
msgid "Preferences|Syntax highlighting theme"
msgstr ""
......@@ -18574,9 +18577,6 @@ msgstr ""
msgid "entries cannot contain HTML tags"
msgstr ""
msgid "epic"
msgstr ""
msgid "error"
msgstr ""
......
......@@ -36,6 +36,31 @@ describe Projects::IssuesController do
expect(response).to render_template(:index)
end
end
context 'when project has moved' do
let(:new_project) { create(:project) }
let(:issue) { create(:issue, project: new_project) }
before do
project.route.destroy
new_project.redirect_routes.create!(path: project.full_path)
new_project.add_developer(user)
end
it 'redirects to the new issue tracker from the old one' do
get :index, params: { namespace_id: project.namespace, project_id: project }
expect(response).to redirect_to(project_issues_path(new_project))
expect(response).to have_gitlab_http_status(302)
end
it 'redirects from an old issue correctly' do
get :show, params: { namespace_id: project.namespace, project_id: project, id: issue }
expect(response).to redirect_to(project_issue_path(new_project, issue))
expect(response).to have_gitlab_http_status(302)
end
end
end
context 'internal issue tracker' do
......
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