From f01a648441adb1f7c09a6f60ce5a9c2111d92a16 Mon Sep 17 00:00:00 2001 From: Dylan Date: Mon, 15 Dec 2025 15:59:25 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20resolve=20stale=20account?= =?UTF-8?q?=20names=20in=20jump=20menu=20and=20page=20titles?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add account data to fresh_when etag arrays so Rails serves fresh responses after account changes. - Add @accounts to menus controller etag - Add Current.account to boards controller etag - Add ETag cache invalidation tests for both controllers --- app/controllers/boards_controller.rb | 2 +- app/controllers/my/menus_controller.rb | 3 +- app/views/my/menus/show.html.erb | 2 +- test/controllers/boards_controller_test.rb | 10 +++ test/controllers/my/menus_controller_test.rb | 81 ++++++++++++++++++++ 5 files changed, 95 insertions(+), 3 deletions(-) create mode 100644 test/controllers/my/menus_controller_test.rb diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index 6c8a17575..721e69b0d 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -83,7 +83,7 @@ class BoardsController < ApplicationController def show_columns cards = @board.cards.awaiting_triage.latest.with_golden_first.preloaded set_page_and_extract_portion_from cards - fresh_when etag: [ @board, @page.records, @user_filtering ] + fresh_when etag: [ @board, @page.records, @user_filtering, Current.account ] end def board_params diff --git a/app/controllers/my/menus_controller.rb b/app/controllers/my/menus_controller.rb index 7a5754593..32b3da004 100644 --- a/app/controllers/my/menus_controller.rb +++ b/app/controllers/my/menus_controller.rb @@ -4,7 +4,8 @@ class My::MenusController < ApplicationController @boards = Current.user.boards.ordered_by_recently_accessed @tags = Current.account.tags.all.alphabetically @users = Current.account.users.active.alphabetically + @accounts = Current.identity.accounts - fresh_when etag: [ @filters, @boards, @tags, @users ] + fresh_when etag: [ @filters, @boards, @tags, @users, @accounts ] end end diff --git a/app/views/my/menus/show.html.erb b/app/views/my/menus/show.html.erb index e6ee838e2..cb3e6310e 100644 --- a/app/views/my/menus/show.html.erb +++ b/app/views/my/menus/show.html.erb @@ -5,7 +5,7 @@ <%= render "my/menus/people", users: @users %> <%= render "my/menus/settings" %> <%= render "my/menus/shortcuts" %> - <%= render "my/menus/accounts", accounts: Current.identity.accounts %> + <%= render "my/menus/accounts", accounts: @accounts %> <% end %>