X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/b2c42d5521313dcac9622b07b17575383c030595..d23f2625437a93e028fbe74d1c606f8d30698a1e:/app/controllers/application_controller.rb diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 0cd850cc6..aec612080 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -422,6 +422,24 @@ class ApplicationController < ActionController::Base request.body.rewind end + def preferred_editor + editor = if params[:editor] + params[:editor] + elsif @user and @user.preferred_editor + @user.preferred_editor + else + DEFAULT_EDITOR + end + + if request.env['HTTP_USER_AGENT'] =~ /MSIE/ and editor == 'id' + editor = 'potlatch2' + end + + editor + end + + helper_method :preferred_editor + private # extract authorisation credentials from headers, returns user = nil if none