summaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2024-09-15 06:31:30 +0000
committerGo MAEDA <maeda@farend.jp>2024-09-15 06:31:30 +0000
commit94d9a2337b85b9e41c8b01bf678f617430455b07 (patch)
treed908b09a893b1caf9055c8835f2d3d2a15ca379b /app/models
parent0078387dbc5e292661789234b2ee5489732a5af6 (diff)
downloadredmine-94d9a2337b85b9e41c8b01bf678f617430455b07.tar.gz
redmine-94d9a2337b85b9e41c8b01bf678f617430455b07.zip
Add "Author / Previous assignee" group to assignee dropdown in issue form (#16045).
Patch by Luka Lüdicke (user:dkd-luedicke), Mizuki ISHIKAWA (user:ishikawa999), and Go MAEDA (user:maeda). git-svn-id: https://svn.redmine.org/redmine/trunk@23059 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models')
-rw-r--r--app/models/issue.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb
index 3debf90ec..48a935558 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -925,6 +925,18 @@ class Issue < ApplicationRecord
result
end
+ # Returns the assignee immediately prior to the current one from the issue history
+ def prior_assigned_to
+ prior_assigned_to_id =
+ journals.joins(:details)
+ .where(details: {prop_key: 'assigned_to_id'})
+ .where.not(details: {old_value: nil})
+ .order(id: :desc)
+ .pick(:old_value)
+
+ prior_assigned_to_id && Principal.find_by(id: prior_assigned_to_id)
+ end
+
# Returns the initial status of the issue
# Returns nil for a new issue
def status_was