|
|
@ -259,14 +259,7 @@ class RepositoriesController < ApplicationController |
|
|
|
type: 'text/x-patch', |
|
|
|
type: 'text/x-patch', |
|
|
|
disposition: 'attachment' |
|
|
|
disposition: 'attachment' |
|
|
|
else |
|
|
|
else |
|
|
|
@diff_type = params[:type] || User.current.pref[:diff_type] || 'inline' |
|
|
|
@diff_type = diff_type_persisted |
|
|
|
@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 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@cache_key = "repositories/diff/#{@repository.id}/" + |
|
|
|
@cache_key = "repositories/diff/#{@repository.id}/" + |
|
|
|
Digest::MD5.hexdigest("#{@path}-#{@rev}-#{@rev_to}-#{@diff_type}") |
|
|
|
Digest::MD5.hexdigest("#{@path}-#{@rev}-#{@rev_to}-#{@diff_type}") |
|
|
@ -497,6 +490,21 @@ class RepositoriesController < ApplicationController |
|
|
|
# rails looking for e.g text when .txt is asked for |
|
|
|
# rails looking for e.g text when .txt is asked for |
|
|
|
render 'entry', formats: [:html] |
|
|
|
render 'entry', formats: [:html] |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def diff_type_persisted |
|
|
|
|
|
|
|
preferences = current_user.pref |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
diff_type = params[:type] || preferences.diff_type |
|
|
|
|
|
|
|
diff_type = 'inline' unless %w(inline sbs).include?(diff_type) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Save diff type as user preference |
|
|
|
|
|
|
|
if current_user.logged? && diff_type != preferences.diff_type |
|
|
|
|
|
|
|
preferences.diff_type = diff_type |
|
|
|
|
|
|
|
preferences.save |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
diff_type |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
class Date |
|
|
|
class Date |
|
|
|