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>2019-09-16 12:06:25 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-09-16 12:06:25 +0300
commitd8211a0ed119eada7d292e974a8fc7b0cd982d3c (patch)
treea14bfca83dd6b71144959d7e7a6d058f5d8922a5 /app
parentedd042071d1b5e6f494881dc2d9c39b46e42f74b (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-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
9 files changed, 23 insertions, 4 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