Project

General

Profile

Actions

Patch #39110

closed

Replacing request_store with ActiveSupport::CurrentAttributes

Added by Takashi Kato about 1 year ago. Updated 12 months ago.

Status:
Closed
Priority:
Normal
Category:
Code cleanup/refactoring
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:

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

Related to Redmine - Feature #36320: Migrate to Rails 7.2ClosedMarius BĂLTEANU

Actions
Actions #1

Updated by Marius BĂLTEANU about 1 year ago

Actions #2

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
Actions #3

Updated by Marius BĂLTEANU about 1 year ago

  • Status changed from New to Resolved

Patch committed, thanks!

Actions #4

Updated by Marius BĂLTEANU 12 months ago

  • Status changed from Resolved to Closed
Actions #5

Updated by Mizuki ISHIKAWA 12 months 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?

Actions #6

Updated by Marius BĂLTEANU 12 months ago

Mizuki ISHIKAWA wrote in #note-5:

Could you please correct the typo in r22473.
[...]

Thanks for pointing this out.

Actions #7

Updated by Mizuki ISHIKAWA 12 months ago

Thank you for your prompt response.

Actions

Also available in: Atom PDF