summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-09-16 09:06:25 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-09-16 09:06:25 +0000
commitd8211a0ed119eada7d292e974a8fc7b0cd982d3c (patch)
treea14bfca83dd6b71144959d7e7a6d058f5d8922a5
parentedd042071d1b5e6f494881dc2d9c39b46e42f74b (diff)
downloadgitlab-ce-d8211a0ed119eada7d292e974a8fc7b0cd982d3c.tar.gz
Add latest changes from gitlab-org/gitlab@master
-rw-r--r--app/assets/javascripts/diffs/index.js8
-rw-r--r--app/assets/javascripts/pages/projects/issues/designs/index.js1
-rw-r--r--app/controllers/concerns/issuable_actions.rb1
-rw-r--r--app/controllers/profiles/preferences_controller.rb3
-rw-r--r--app/controllers/projects/issues_controller.rb5
-rw-r--r--app/controllers/projects/merge_requests_controller.rb1
-rw-r--r--app/models/user.rb1
-rw-r--r--app/views/profiles/preferences/show.html.haml4
-rw-r--r--app/views/projects/merge_requests/show.html.haml3
-rw-r--r--config/routes/project.rb2
-rw-r--r--db/migrate/20190907184714_add_show_whitespace_in_diffs_to_user_preferences.rb20
-rw-r--r--db/schema.rb1
-rw-r--r--doc/ci/environments.md1
-rw-r--r--locale/gitlab.pot6
-rw-r--r--spec/controllers/projects/issues_controller_spec.rb25
15 files changed, 74 insertions, 8 deletions
diff --git a/app/assets/javascripts/diffs/index.js b/app/assets/javascripts/diffs/index.js
index 1e57e9b8a30..c9580e3d3b4 100644
--- a/app/assets/javascripts/diffs/index.js
+++ b/app/assets/javascripts/diffs/index.js
@@ -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,
},
});
},
diff --git a/app/assets/javascripts/pages/projects/issues/designs/index.js b/app/assets/javascripts/pages/projects/issues/designs/index.js
new file mode 100644
index 00000000000..6a7c6028c95
--- /dev/null
+++ b/app/assets/javascripts/pages/projects/issues/designs/index.js
@@ -0,0 +1 @@
+import '../show/index';
diff --git a/app/controllers/concerns/issuable_actions.rb b/app/controllers/concerns/issuable_actions.rb
index 543a27c56d4..6162d006cc7 100644
--- a/app/controllers/concerns/issuable_actions.rb
+++ b/app/controllers/concerns/issuable_actions.rb
@@ -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
diff --git a/app/controllers/profiles/preferences_controller.rb b/app/controllers/profiles/preferences_controller.rb
index 046ae5d9a51..42d4d785174 100644
--- a/app/controllers/profiles/preferences_controller.rb
+++ b/app/controllers/profiles/preferences_controller.rb
@@ -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
diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb
index 9cdd6288000..a3dcb36aa3b 100644
--- a/app/controllers/projects/issues_controller.rb
+++ b/app/controllers/projects/issues_controller.rb
@@ -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
diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb
index 2a58cfb8f6b..0d992bb35f8 100644
--- a/app/controllers/projects/merge_requests_controller.rb
+++ b/app/controllers/projects/merge_requests_controller.rb
@@ -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
diff --git a/app/models/user.rb b/app/models/user.rb
index c10a4143d1c..66defb4c707 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -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
diff --git a/app/views/profiles/preferences/show.html.haml b/app/views/profiles/preferences/show.html.haml
index 0887e8e64da..84657592cd8 100644
--- a/app/views/profiles/preferences/show.html.haml
+++ b/app/views/profiles/preferences/show.html.haml
@@ -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
diff --git a/app/views/projects/merge_requests/show.html.haml b/app/views/projects/merge_requests/show.html.haml
index ea166d622eb..da90c41e2f5 100644
--- a/app/views/projects/merge_requests/show.html.haml
+++ b/app/views/projects/merge_requests/show.html.haml
@@ -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
diff --git a/config/routes/project.rb b/config/routes/project.rb
index 953ddfc4165..c1273db8ee5 100644
--- a/config/routes/project.rb
+++ b/config/routes/project.rb
@@ -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
diff --git a/db/migrate/20190907184714_add_show_whitespace_in_diffs_to_user_preferences.rb b/db/migrate/20190907184714_add_show_whitespace_in_diffs_to_user_preferences.rb
new file mode 100644
index 00000000000..50d5d2b0574
--- /dev/null
+++ b/db/migrate/20190907184714_add_show_whitespace_in_diffs_to_user_preferences.rb
@@ -0,0 +1,20 @@
+# 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
diff --git a/db/schema.rb b/db/schema.rb
index 95069f711fb..64d29d7cc05 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -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
diff --git a/doc/ci/environments.md b/doc/ci/environments.md
index c2d444cb1d6..b41fd7971d6 100644
--- a/doc/ci/environments.md
+++ b/doc/ci/environments.md
@@ -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:
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index 7a0f10c83d2..37b589d902d 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -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 ""
diff --git a/spec/controllers/projects/issues_controller_spec.rb b/spec/controllers/projects/issues_controller_spec.rb
index 367bd641f5d..397ac59546f 100644
--- a/spec/controllers/projects/issues_controller_spec.rb
+++ b/spec/controllers/projects/issues_controller_spec.rb
@@ -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