@@ -106,7 +106,14 class RepositoriesController < ApplicationController | |||||
106 |
|
106 | |||
107 | def diff |
|
107 | def diff | |
108 | @rev_to = params[:rev_to] ? params[:rev_to].to_i : (@rev - 1) |
|
108 | @rev_to = params[:rev_to] ? params[:rev_to].to_i : (@rev - 1) | |
109 |
@diff_type = |
|
109 | @diff_type = params[:type] || User.current.pref[:diff_type] || 'inline' | |
|
110 | @diff_type = 'inline' unless %w(inline sbs).include?(@diff_type) | |||
|
111 | ||||
|
112 | # Save diff type as user preference | |||
|
113 | if User.current.logged? && @diff_type != User.current.pref[:diff_type] | |||
|
114 | User.current.pref[:diff_type] = @diff_type | |||
|
115 | User.current.preference.save | |||
|
116 | end | |||
110 |
|
117 | |||
111 | @cache_key = "repositories/diff/#{@repository.id}/" + Digest::MD5.hexdigest("#{@path}-#{@rev}-#{@rev_to}-#{@diff_type}") |
|
118 | @cache_key = "repositories/diff/#{@repository.id}/" + Digest::MD5.hexdigest("#{@path}-#{@rev}-#{@rev_to}-#{@diff_type}") | |
112 | unless read_fragment(@cache_key) |
|
119 | unless read_fragment(@cache_key) |
@@ -8,7 +8,7 | |||||
8 | <% end %> |
|
8 | <% end %> | |
9 | <% end %> |
|
9 | <% end %> | |
10 | <p><label><%= l(:label_view_diff) %></label> |
|
10 | <p><label><%= l(:label_view_diff) %></label> | |
11 |
<%= select_tag 'type', options_for_select([[l(:label_diff_inline), "inline"], [l(:label_diff_side_by_side), "sbs"]], |
|
11 | <%= select_tag 'type', options_for_select([[l(:label_diff_inline), "inline"], [l(:label_diff_side_by_side), "sbs"]], @diff_type), :onchange => "if (this.value != '') {this.form.submit()}" %></p> | |
12 | <% end %> |
|
12 | <% end %> | |
13 |
|
13 | |||
14 | <div class="autoscroll"> |
|
14 | <div class="autoscroll"> |
@@ -116,10 +116,10 class UserTest < Test::Unit::TestCase | |||||
116 |
|
116 | |||
117 | def test_mail_notification_selected |
|
117 | def test_mail_notification_selected | |
118 | @jsmith.mail_notification = false |
|
118 | @jsmith.mail_notification = false | |
119 |
@jsmith.notified_project_ids = [ |
|
119 | @jsmith.notified_project_ids = [1] | |
120 | @jsmith.save |
|
120 | @jsmith.save | |
121 | @jsmith.reload |
|
121 | @jsmith.reload | |
122 |
assert |
|
122 | assert Project.find(1).recipients.include?(@jsmith.mail) | |
123 | end |
|
123 | end | |
124 |
|
124 | |||
125 | def test_mail_notification_none |
|
125 | def test_mail_notification_none |
General Comments 0
You need to be logged in to leave comments.
Login now