diff options
author | kkm <kkm@smartaction.com> | 2015-10-22 18:52:17 -0700 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-02-05 15:40:44 +0100 |
commit | cf1349adb7cba2e791a1f8d59e3a6a976b54e071 (patch) | |
tree | db5e22ac1f105a5c1bb91cc5e2f5456bbf34ea01 | |
parent | 9afcacb3a4f50d45d19b7222edbe0902daa35bb4 (diff) | |
download | gitlab-ce-cf1349adb7cba2e791a1f8d59e3a6a976b54e071.tar.gz |
Remember user's inline/tabular diff view preference in a cookie
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | app/controllers/projects/application_controller.rb | 7 | ||||
-rw-r--r-- | app/controllers/projects/commit_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/projects/merge_requests_controller.rb | 2 |
4 files changed, 12 insertions, 0 deletions
diff --git a/CHANGELOG b/CHANGELOG index d43b8f69063..e1ef5b8d45d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -22,6 +22,7 @@ v 8.5.0 (unreleased) - Fix visibility level text in admin area (Zeger-Jan van de Weg) - Warn admin during OAuth of granting admin rights (Zeger-Jan van de Weg) - Update the ExternalIssue regex pattern (Blake Hitchcock) + - Remember user's inline/tabular diff view preference in a cookie (Kirill Katsnelson) - Optimized performance of finding issues to be closed by a merge request - Revert "Add IP check against DNSBLs at account sign-up" - Fix API to keep request parameters in Link header (Michael Potthoff) diff --git a/app/controllers/projects/application_controller.rb b/app/controllers/projects/application_controller.rb index dd32d509191..9096910b82c 100644 --- a/app/controllers/projects/application_controller.rb +++ b/app/controllers/projects/application_controller.rb @@ -26,6 +26,13 @@ class Projects::ApplicationController < ApplicationController end end + protected + + def apply_diff_view_cookie! + view = params[:view] || cookies[:diff_view] + cookies.permanent[:diff_view] = params[:view] = view if view + end + private def builds_enabled diff --git a/app/controllers/projects/commit_controller.rb b/app/controllers/projects/commit_controller.rb index f5a169e5aa9..5a084e123a1 100644 --- a/app/controllers/projects/commit_controller.rb +++ b/app/controllers/projects/commit_controller.rb @@ -13,6 +13,8 @@ class Projects::CommitController < Projects::ApplicationController def show return git_not_found! unless @commit + apply_diff_view_cookie! + @line_notes = commit.notes.inline @note = @project.build_commit_note(commit) @notes = commit.notes.not_inline.fresh diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb index ed3050d59aa..9d588c370aa 100644 --- a/app/controllers/projects/merge_requests_controller.rb +++ b/app/controllers/projects/merge_requests_controller.rb @@ -57,6 +57,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController end def diffs + apply_diff_view_cookie! + @commit = @merge_request.last_commit @base_commit = @merge_request.diff_base_commit |