]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/accounts/pd_declarations_controller.rb
Merge remote-tracking branch 'upstream/pull/5721'
[rails.git] / app / controllers / accounts / pd_declarations_controller.rb
index 3d90d250e65d0aca8cba6ce290b737cbd5b9d234..4a636a8880c76275f598ecc6e740a05e35008850 100644 (file)
@@ -8,5 +8,21 @@ module Accounts
     authorize_resource :class => :account_pd_declaration
 
     def show; end
+
+    def create
+      if current_user.consider_pd
+        flash[:warning] = t(".already_declared")
+      else
+        current_user.consider_pd = params[:consider_pd]
+
+        if current_user.consider_pd
+          flash[:notice] = t(".successfully_declared") if current_user.save
+        else
+          flash[:warning] = t(".did_not_confirm")
+        end
+      end
+
+      redirect_to account_path
+    end
   end
 end