summaryrefslogtreecommitdiffstats
path: root/app/controllers/attachments_controller.rb
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2012-02-04 06:23:38 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2012-02-04 06:23:38 +0000
commit2789cf250617c5e55df9510c6eae21e073936d2c (patch)
tree25ef18117fa7dc97f1f9e3eaca33cd755562dcdd /app/controllers/attachments_controller.rb
parentaf50c1e13e6786695b823a32c3b2e778277e7f64 (diff)
downloadredmine-2789cf250617c5e55df9510c6eae21e073936d2c.tar.gz
redmine-2789cf250617c5e55df9510c6eae21e073936d2c.zip
attachment: fix that diff type is not saved in user preference (#10152)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8761 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/attachments_controller.rb')
-rw-r--r--app/controllers/attachments_controller.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb
index 55cef02a8..53ff69ba8 100644
--- a/app/controllers/attachments_controller.rb
+++ b/app/controllers/attachments_controller.rb
@@ -29,6 +29,11 @@ class AttachmentsController < ApplicationController
@diff = File.new(@attachment.diskfile, "rb").read
@diff_type = params[:type] || User.current.pref[:diff_type] || 'inline'
@diff_type = 'inline' unless %w(inline sbs).include?(@diff_type)
+ # Save diff type as user preference
+ if User.current.logged? && @diff_type != User.current.pref[:diff_type]
+ User.current.pref[:diff_type] = @diff_type
+ User.current.preference.save
+ end
render :action => 'diff'
elsif @attachment.is_text? && @attachment.filesize <= Setting.file_max_size_displayed.to_i.kilobyte
@content = File.new(@attachment.diskfile, "rb").read