Skip to content

Commit 92d9545

Browse files
committed
Fix ActivityPub and REST API queries setting cookies and preventing caching
Regression from mastodon#8657
1 parent 7a1f8a5 commit 92d9545

3 files changed

Lines changed: 6 additions & 0 deletions

File tree

app/controllers/accounts_controller.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ class AccountsController < ApplicationController
99
before_action :set_cache_headers
1010
before_action :set_body_classes
1111

12+
skip_around_action :set_locale, if: -> { request.format == :json }
13+
1214
def show
1315
respond_to do |format|
1416
format.html do

app/controllers/api/base_controller.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ class Api::BaseController < ApplicationController
1414

1515
protect_from_forgery with: :null_session
1616

17+
skip_around_action :set_locale
18+
1719
rescue_from ActiveRecord::RecordInvalid, Mastodon::ValidationError do |e|
1820
render json: { error: e.to_s }, status: 422
1921
end

app/controllers/statuses_controller.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ class StatusesController < ApplicationController
1818
before_action :set_body_classes
1919
before_action :set_autoplay, only: :embed
2020

21+
skip_around_action :set_locale, if: -> { request.format == :json }
22+
2123
content_security_policy only: :embed do |p|
2224
p.frame_ancestors(false)
2325
end

0 commit comments

Comments
 (0)