Patch #39110
closedReplacing request_store with ActiveSupport::CurrentAttributes
0%
Description
Redmine utilizes the request_store gem to maintain a record of currently logged-in users.
However, Rails itself offers an additional feature called ActiveSupport::CurrentAttributes leveraging this module, we can eliminate the reliance on request_store.
ActiveSupport::CurrentAttributes provides equivalent functionality to request_store, but its value is reset when an ActiveJob is executed. To address this, a callback has been introduced to preserve the value when ActiveJob is employed.
I'm sharing this post because I'm currently running Redmine on a new Rails version, and after applying the following pull request, "test/integration/sudo_mode_test.rb" began to fail in multiple instances.
Link to the pull request: https://github.com/rails/rails/pull/47092
Files
Related issues
Updated by Marius BĂLTEANU about 1 year ago
- Related to Feature #36320: Migrate to Rails 7.2 added
Updated by Marius BĂLTEANU about 1 year ago
- Category set to Code cleanup/refactoring
- Assignee set to Marius BĂLTEANU
- Target version set to 6.0.0
Updated by Marius BĂLTEANU about 1 year ago
- Status changed from New to Resolved
Patch committed, thanks!
Updated by Marius BĂLTEANU about 1 year ago
- Status changed from Resolved to Closed
Updated by Mizuki ISHIKAWA about 1 year ago
Could you please correct the typo in r22473.
diff --git a/lib/redmine/sudo_mode.rb b/lib/redmine/sudo_mode.rb
index d73880937..8df6d48d7 100644
--- a/lib/redmine/sudo_mode.rb
+++ b/lib/redmine/sudo_mode.rb
@@ -225,7 +225,7 @@ module Redmine
# Turn sudo mode back on
def self.enable!
- CurrentSUdoMode.disabled = nil
+ CurrentSudoMode.disabled = nil
end
def self.enabled?