プロジェクト

全般

プロフィール

Vote #80671

完了

Fix selected user on log time edit page when user has permissions to log time for another user

Admin Redmine さんが約4年前に追加. 約4年前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Time tracking_13
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
13
version_id:
160
issue_org_id:
32959
author_id:
350310
assigned_to_id:
332
comments:
7
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
127
ステータス-->[Closed]

説明

when you're editing a existing timelog entry and have the rights to adjust the user ( or log on behalf of another user ), the current value will not be selected in the drop down due to this line:

https://www.redmine.org/projects/redmine/repository/revisions/19326/entry/branches/4.1-stable/app/helpers/application_helper.rb#L578

the fix is quite simple, just drop the @.to_s@

      selected_attribute = ' selected="selected"' if option_value_selected?(element, selected) || element.id == selected

and its working.

diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index b40f42ecc..e13825082 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -575,7 +575,7 @@ module ApplicationHelper
     end
     groups = +''
     collection.sort.each do |element|
-      selected_attribute = ' selected="selected"' if option_value_selected?(element, selected) || element.id == selected
+      selected_attribute = ' selected="selected"' if option_value_selected?(element, selected) || element.id.to_s == selected
       (element.is_a?(Group) ? groups : s) << %()
     end
     unless groups.empty?


journals

missed the selected version, this applies to @4.1-stable@
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Thanks easter egg for detecting the issue.

I have attached a patch that fixes the code added in #3848 and adds a test for this case. Regarding your fix from @app/helpers/application_helper.rb@, maybe it's better to cast both values @to_s@.
--------------------------------------------------------------------------------
All tests pass: https://gitlab.com/redmine-org/redmine/pipelines/116202079
--------------------------------------------------------------------------------
Committed the patch. Thank you.
--------------------------------------------------------------------------------


related_issues

relates,Closed,3848,Permission to log time for another user

Admin Redmine さんが約4年前に更新

  • カテゴリTime tracking_13 にセット
  • 対象バージョン4.1.1_160 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0