From ba68203ea1681cb9e27b236048c3476b20d9031f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marius=20B=C4=82LTEANU?= Date: Mon, 31 Aug 2026 09:09:24 +0300 Subject: [PATCH 2/2] Memoize user lookups in parse_redmine_links Avoids repeated database lookups for the same user login when parsing multiple mentions in a request. --- app/helpers/application_helper.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 5d5d680f5..308077087 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1352,7 +1352,8 @@ module ApplicationHelper end elsif sep == "@" name = remove_double_quotes(identifier) - u = User.visible.find_by_login(name.downcase) + @users_by_login ||= {} + u = @users_by_login.fetch(name.downcase) { |k| @users_by_login[k] = User.visible.find_by_login(k) } link = link_to_mention(u, obj, only_path: only_path) if u end end -- 2.50.1 (Apple Git-155)