about summary refs log tree commit diff
path: root/app/controllers
diff options
context:
space:
mode:
authornullkal <nullkal@users.noreply.github.com>2017-08-23 22:16:20 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-08-23 15:16:20 +0200
commit80393a23d0a0c296d4356a2a21cf8504435265bf (patch)
tree6d0bdc6c4e0b3d600c6a786c5e66e1e5ba254114 /app/controllers
parent8d23667536cec65292302774b3816467ad427a32 (diff)
Use checkboxes for application scope setting (#4671)
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/settings/applications_controller.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/controllers/settings/applications_controller.rb b/app/controllers/settings/applications_controller.rb
index 894222c2a..8fc9a0fa9 100644
--- a/app/controllers/settings/applications_controller.rb
+++ b/app/controllers/settings/applications_controller.rb
@@ -5,6 +5,7 @@ class Settings::ApplicationsController < ApplicationController
 
   before_action :authenticate_user!
   before_action :set_application, only: [:show, :update, :destroy, :regenerate]
+  before_action :prepare_scopes, only: [:create, :update]
 
   def index
     @applications = current_user.applications.page(params[:page])
@@ -63,4 +64,9 @@ class Settings::ApplicationsController < ApplicationController
       :website
     )
   end
+
+  def prepare_scopes
+    scopes = params.fetch(:doorkeeper_application, {}).fetch(:scopes, nil)
+    params[:doorkeeper_application][:scopes] = scopes.join(' ') if scopes.is_a? Array
+  end
 end