From 9ee3f3f83bcd98b7b15103f1bd74578c29338af1 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Sat, 12 Jul 2025 15:30:25 +0100 Subject: [PATCH] Don't do partial renders for turbo page visits Setting turbo-action=advance as our pagination helper does causes a frame navigation to be promoted to a page visit which means turbo will try and merge the head elements and remove meta and link elements which are missing from the turbo response. In order to avoid breaking things we need to ensure we send the full head element in such cases or things like the CSRF token will be lost. Fixes #6172 --- app/controllers/diary_entries_controller.rb | 2 -- app/controllers/issues_controller.rb | 2 -- app/controllers/traces_controller.rb | 2 -- app/controllers/user_blocks_controller.rb | 2 -- app/controllers/users/diary_comments_controller.rb | 2 -- app/controllers/users/issued_blocks_controller.rb | 2 -- app/controllers/users/lists_controller.rb | 2 -- app/controllers/users/received_blocks_controller.rb | 2 -- 8 files changed, 16 deletions(-) diff --git a/app/controllers/diary_entries_controller.rb b/app/controllers/diary_entries_controller.rb index a24f4a30f..d966fd46c 100644 --- a/app/controllers/diary_entries_controller.rb +++ b/app/controllers/diary_entries_controller.rb @@ -52,8 +52,6 @@ class DiaryEntriesController < ApplicationController @params = params.permit(:display_name, :friends, :nearby, :language) @entries, @newer_entries_id, @older_entries_id = get_page_items(entries, :includes => [:user, :language]) - - render :partial => "page" if turbo_frame_request_id == "pagination" end def show diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 07d8eef34..f2054b9a6 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -53,8 +53,6 @@ class IssuesController < ApplicationController :users => User.in_order_of(:id, user_ids.first(@unique_reporters_limit)) } end - - render :partial => "page" if turbo_frame_request_id == "pagination" end def show diff --git a/app/controllers/traces_controller.rb b/app/controllers/traces_controller.rb index fcd4f7938..aefcb3704 100644 --- a/app/controllers/traces_controller.rb +++ b/app/controllers/traces_controller.rb @@ -65,8 +65,6 @@ class TracesController < ApplicationController # final helper vars for view @target_user = target_user - - render :partial => "page" if turbo_frame_request_id == "pagination" end def show diff --git a/app/controllers/user_blocks_controller.rb b/app/controllers/user_blocks_controller.rb index 91273eb07..264d379be 100644 --- a/app/controllers/user_blocks_controller.rb +++ b/app/controllers/user_blocks_controller.rb @@ -24,8 +24,6 @@ class UserBlocksController < ApplicationController @show_user_name = true @show_creator_name = true - - render :partial => "page" if turbo_frame_request_id == "pagination" end def show diff --git a/app/controllers/users/diary_comments_controller.rb b/app/controllers/users/diary_comments_controller.rb index 4737ec007..c97ff8ec6 100644 --- a/app/controllers/users/diary_comments_controller.rb +++ b/app/controllers/users/diary_comments_controller.rb @@ -9,8 +9,6 @@ module Users @params = params.permit(:display_name, :before, :after) @comments, @newer_comments_id, @older_comments_id = get_page_items(comments, :includes => [:user, :diary_entry]) - - render :partial => "page" if turbo_frame_request_id == "pagination" end end end diff --git a/app/controllers/users/issued_blocks_controller.rb b/app/controllers/users/issued_blocks_controller.rb index 0832fd08f..537ac7d62 100644 --- a/app/controllers/users/issued_blocks_controller.rb +++ b/app/controllers/users/issued_blocks_controller.rb @@ -24,8 +24,6 @@ module Users @show_user_name = true @show_creator_name = false - - render :partial => "user_blocks/page" if turbo_frame_request_id == "pagination" end end end diff --git a/app/controllers/users/lists_controller.rb b/app/controllers/users/lists_controller.rb index c3c3c61bb..1e926f8a2 100644 --- a/app/controllers/users/lists_controller.rb +++ b/app/controllers/users/lists_controller.rb @@ -26,8 +26,6 @@ module Users @users_count = I18n.t("count.at_least_pattern", :count => 500) if @users_count > 500 @users, @newer_users_id, @older_users_id = get_page_items(users, :limit => 50) - - render :partial => "page" if turbo_frame_request_id == "pagination" end ## diff --git a/app/controllers/users/received_blocks_controller.rb b/app/controllers/users/received_blocks_controller.rb index 4b7f58e20..fbb411aff 100644 --- a/app/controllers/users/received_blocks_controller.rb +++ b/app/controllers/users/received_blocks_controller.rb @@ -25,8 +25,6 @@ module Users @show_user_name = false @show_creator_name = true - - render :partial => "user_blocks/page" if turbo_frame_request_id == "pagination" end ## -- 2.39.5