diff --git a/lib/lazylead/task/fix_version.rb b/lib/lazylead/task/fix_version.rb index b2805ca..a3c21e4 100644 --- a/lib/lazylead/task/fix_version.rb +++ b/lib/lazylead/task/fix_version.rb @@ -86,8 +86,10 @@ def add_label @issue.add_label("LL.IllegalChangeOfFixVersion") unless @silent end - def current - @issue.fields["fixVersions"].first["name"] + def to + versions = @issue.fields["fixVersions"] + return "" if versions.nil? || versions.empty? + versions.map { |x| x["name"] }.join(",") end end end diff --git a/lib/messages/illegal_fixversion_change.erb b/lib/messages/illegal_fixversion_change.erb index bd59ade..d023255 100644 --- a/lib/messages/illegal_fixversion_change.erb +++ b/lib/messages/illegal_fixversion_change.erb @@ -92,7 +92,8 @@ <tr> <th id="key">Key</th> <th id="priority">Priority</th> - <th id="version">Fix Version</th> + <th id="from">From</th> + <th id="to">To</th> <th id="when">When</th> <th id="who">Who</th> <th id="reporter">Reporter</th> @@ -102,7 +103,12 @@ <tr> <td><a href='<%= v.issue.url %>'><%= v.issue.key %></a></td> <td><%= v.issue.priority %></td> - <td><%= v.current %></td> + <td><%= v.last["items"] + .select { |h| h["field"] == "Fix Version" } + .map { |h| h["fromString"] } + .reject(&:blank?) + .join(",") %></td> + <td><%= v.to %></td> <td><%= DateTime.parse(v.last["created"]) .strftime('%d-%b-%Y %I:%M:%S %p') %></td> <td><span style='color: red'><%= v.last["author"]["displayName"] %></span> diff --git a/test/lazylead/task/fix_version_test.rb b/test/lazylead/task/fix_version_test.rb index f80bcc8..c38a0bb 100644 --- a/test/lazylead/task/fix_version_test.rb +++ b/test/lazylead/task/fix_version_test.rb @@ -42,6 +42,7 @@ class FixVersionTest < Lazylead::Test "from" => "ll@company.com", "jql" => "key in ('DATAJDBC-480') and fixVersion is not empty", "allowed" => "tom,mike,bob", + "fields" => "description,reporter,priority,summary,created,fixVersions", "subject" => "FixVersion: How dare you?", "template" => "lib/messages/illegal_fixversion_change.erb" )