]> cat aescling's git repositories - mastodon.git/commitdiff
Fix double render error when authorizing interaction (#18203)
authorEugen Rochko <eugen@zeonfederated.com>
Sat, 30 Apr 2022 22:56:34 +0000 (00:56 +0200)
committersingle-right-quote <11325618-aescling@users.noreply.gitlab.com>
Thu, 5 May 2022 17:49:13 +0000 (13:49 -0400)
app/controllers/authorize_interactions_controller.rb
app/controllers/following_accounts_controller.rb

index f0bcac75ba7b8879c3347794a647623876552e18..97fe4a9abd0370c9fa142e966ec1e0d6b3dac180 100644 (file)
@@ -14,7 +14,7 @@ class AuthorizeInteractionsController < ApplicationController
     if @resource.is_a?(Account)
       render :show
     elsif @resource.is_a?(Status)
-      redirect_to web_url("statuses/#{@resource.id}")
+      redirect_to web_url("@#{@resource.account.pretty_acct}/#{@resource.id}")
     else
       render :error
     end
@@ -26,15 +26,17 @@ class AuthorizeInteractionsController < ApplicationController
     else
       render :error
     end
-  rescue ActiveRecord::RecordNotFound, Mastodon::NotPermittedError
+  rescue ActiveRecord::RecordNotFound
     render :error
   end
 
   private
 
   def set_resource
-    @resource = located_resource || render(:error)
+    @resource = located_resource
     authorize(@resource, :show?) if @resource.is_a?(Status)
+  rescue Mastodon::NotPermittedError
+    not_found
   end
 
   def located_resource
index bc291c9625c802814603a9b6ec84acb903fd57b9..11c6b6d50eb8a49643b117f1ccf850460986ef95 100644 (file)
@@ -22,7 +22,10 @@ class FollowingAccountsController < ApplicationController
       end
 
       format.json do
-        raise Mastodon::NotPermittedError if page_requested? && @account.hide_collections?
+        if page_requested? && @account.hide_collections?
+          forbidden
+          next
+        end
 
         expires_in(page_requested? ? 0 : 3.minutes, public: public_fetch_mode?)