]> cat aescling's git repositories - mastodon.git/commitdiff
Prepend check_enabled_deletion to Settings::DeletesController (#229)
authorDavid Yip <yipdw@member.fsf.org>
Wed, 6 Dec 2017 22:19:43 +0000 (16:19 -0600)
committerDavid Yip <yipdw@member.fsf.org>
Wed, 6 Dec 2017 22:19:43 +0000 (16:19 -0600)
The specs for Settings::DeletesController include an example that
sets Settings.open_deletion to false and expects the "if deletion is not
available, redirect to root" logic to run.  However, this spec does not
set up a user, which means that the spec (intentionally or otherwise)
expects this redirection to work with unauthenticated access.

We should preserve that behavior.  To do so, we prepend the deletion
check to the action chain set up by Settings::BaseController, so that
said check occurs before the authenticate_user! check.

app/controllers/settings/deletes_controller.rb

index e4cb35a8e9d040afaaff6608c31242fa5b1c4b3e..4c112147114b9ac93b67db990c7cd54d1707cb14 100644 (file)
@@ -2,7 +2,7 @@
 
 class Settings::DeletesController < Settings::BaseController
 
-  before_action :check_enabled_deletion
+  prepend_before_action :check_enabled_deletion
 
   def show
     @confirmation = Form::DeleteConfirmation.new