]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/api/user_preferences_controller.rb
Don't show older/newer buttons if all items fit on one page
[rails.git] / app / controllers / api / user_preferences_controller.rb
index 02a23095addd70ef9a72dde3d84cad35a257b308..d1bd6d6242bc5713ce28054630e26341f711bc28 100644 (file)
@@ -1,12 +1,11 @@
 # Update and read user preferences, which are arbitrary key/val pairs
 module Api
   class UserPreferencesController < ApiController
+    before_action :check_api_writable, :only => [:update_all, :update, :destroy]
     before_action :authorize
 
     authorize_resource
 
-    around_action :api_call_handle_error
-
     before_action :set_request_formats
 
     ##
@@ -66,7 +65,7 @@ module Api
         pref.k = params[:preference_key]
       end
 
-      pref.v = request.raw_post.chomp
+      pref.v = request.raw_post.chomp.force_encoding("UTF-8")
       pref.save!
 
       render :plain => ""