Commit cf1349ad authored by kkm's avatar kkm Committed by Rémy Coutable

Remember user's inline/tabular diff view preference in a cookie

parent 9afcacb3
...@@ -22,6 +22,7 @@ v 8.5.0 (unreleased) ...@@ -22,6 +22,7 @@ v 8.5.0 (unreleased)
- Fix visibility level text in admin area (Zeger-Jan van de Weg) - 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) - Warn admin during OAuth of granting admin rights (Zeger-Jan van de Weg)
- Update the ExternalIssue regex pattern (Blake Hitchcock) - 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 - Optimized performance of finding issues to be closed by a merge request
- Revert "Add IP check against DNSBLs at account sign-up" - Revert "Add IP check against DNSBLs at account sign-up"
- Fix API to keep request parameters in Link header (Michael Potthoff) - Fix API to keep request parameters in Link header (Michael Potthoff)
......
...@@ -26,6 +26,13 @@ class Projects::ApplicationController < ApplicationController ...@@ -26,6 +26,13 @@ class Projects::ApplicationController < ApplicationController
end end
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 private
def builds_enabled def builds_enabled
......
...@@ -13,6 +13,8 @@ class Projects::CommitController < Projects::ApplicationController ...@@ -13,6 +13,8 @@ class Projects::CommitController < Projects::ApplicationController
def show def show
return git_not_found! unless @commit return git_not_found! unless @commit
apply_diff_view_cookie!
@line_notes = commit.notes.inline @line_notes = commit.notes.inline
@note = @project.build_commit_note(commit) @note = @project.build_commit_note(commit)
@notes = commit.notes.not_inline.fresh @notes = commit.notes.not_inline.fresh
......
...@@ -57,6 +57,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -57,6 +57,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController
end end
def diffs def diffs
apply_diff_view_cookie!
@commit = @merge_request.last_commit @commit = @merge_request.last_commit
@base_commit = @merge_request.diff_base_commit @base_commit = @merge_request.diff_base_commit
......
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