Skip to content

Commit

Permalink
#265: fix_version task is failing due to removed version
Browse files Browse the repository at this point in the history
Fixed #265
  • Loading branch information
dgroup committed Nov 29, 2020
1 parent f348561 commit 534b2f8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
6 changes: 4 additions & 2 deletions lib/lazylead/task/fix_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 8 additions & 2 deletions lib/messages/illegal_fixversion_change.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand Down
1 change: 1 addition & 0 deletions test/lazylead/task/fix_version_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down

0 comments on commit 534b2f8

Please sign in to comment.