summaryrefslogtreecommitdiffstats
path: root/app/helpers
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2022-11-16 09:24:17 +0000
committerGo MAEDA <maeda@farend.jp>2022-11-16 09:24:17 +0000
commitb3e42149896a6199ee6225f1f6bad8c4778adf1f (patch)
treefdbf124a205bc3fe76d8e20a88b52ca43ce4095c /app/helpers
parentf972b5bfa655972b2d469dc79c3b9ba3a971d457 (diff)
downloadredmine-b3e42149896a6199ee6225f1f6bad8c4778adf1f.tar.gz
redmine-b3e42149896a6199ee6225f1f6bad8c4778adf1f.zip
Add the ability to change the author of an issue (#1739).
Patch by Vladimir Kovacik, Jiri Stepanek, Aighan Pacobilch, Olivier Houdas, Takenori TAKAKI, and Mizuki ISHIKAWA. git-svn-id: https://svn.redmine.org/redmine/trunk@21958 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/issues_helper.rb21
1 files changed, 20 insertions, 1 deletions
diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb
index dfe577650..abefd7b28 100644
--- a/app/helpers/issues_helper.rb
+++ b/app/helpers/issues_helper.rb
@@ -534,7 +534,7 @@ module IssuesHelper
old_value = format_date(detail.old_value.to_date) if detail.old_value
when 'project_id', 'status_id', 'tracker_id', 'assigned_to_id',
- 'priority_id', 'category_id', 'fixed_version_id'
+ 'priority_id', 'category_id', 'fixed_version_id', 'author_id'
value = find_name_by_reflection(field, detail.value)
old_value = find_name_by_reflection(field, detail.old_value)
@@ -778,4 +778,23 @@ module IssuesHelper
projects
end
end
+
+ def author_options_for_select(issue, project)
+ users = issue.assignable_users.select {|m| m.is_a?(User) && m.allowed_to?(:add_issues, project) }
+
+ if issue.new_record?
+ if users.include?(User.current)
+ principals_options_for_select(users, issue.author)
+ else
+ principals_options_for_select([User.current] + users)
+ end
+ elsif issue.persisted?
+ if users.include?(issue.author)
+ principals_options_for_select(users, issue.author)
+ else
+ author_principal = Principal.find(issue.author_id)
+ principals_options_for_select([author_principal] + users, author_principal)
+ end
+ end
+ end
end