diff options
author | Jens Harbott <j.harbott@x-ion.de> | 2017-10-04 13:12:04 +0000 |
---|---|---|
committer | Jens Harbott <j.harbott@x-ion.de> | 2017-10-04 13:14:47 +0000 |
commit | 898a8bf82a4fe23a60319f1c083b835c02740fc1 (patch) | |
tree | 8b0762fa0a9f3a369b8fc4547eebc950eb17587d /etc | |
parent | 850c940e1c431a5a088ea2031602fdc587ca47a3 (diff) | |
download | zuul-898a8bf82a4fe23a60319f1c083b835c02740fc1.tar.gz |
Avoid JS error when a change has no id
This may cause the UI to display only a subset of the total changes,
leading to some confusion. Use the local variable that we define to be
set even when change.id is null consistently.
Change-Id: I7c5ff2d9c6ba83e8a8265df3fd83afabe1984fe2
Diffstat (limited to 'etc')
-rw-r--r-- | etc/status/public_html/jquery.zuul.js | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/etc/status/public_html/jquery.zuul.js b/etc/status/public_html/jquery.zuul.js index 70e999ee7..373500454 100644 --- a/etc/status/public_html/jquery.zuul.js +++ b/etc/status/public_html/jquery.zuul.js @@ -281,38 +281,38 @@ change_header: function(change) { var change_id = change.id || 'NA'; - if (change_id.length === 40) { - change_id = change_id.substr(0, 7); - } var $change_link = $('<small />'); if (change.url !== null) { - var github_id = change.id.match(/^([0-9]+),([0-9a-f]{40})$/); + var github_id = change_id.match(/^([0-9]+),([0-9a-f]{40})$/); if (github_id) { $change_link.append( $('<a />').attr('href', change.url).append( $('<abbr />') - .attr('title', change.id) + .attr('title', change_id) .text('#' + github_id[1]) ) ); - } else if (/^[0-9a-f]{40}$/.test(change.id)) { - var change_id_short = change.id.slice(0, 7); + } else if (/^[0-9a-f]{40}$/.test(change_id)) { + var change_id_short = change_id.slice(0, 7); $change_link.append( $('<a />').attr('href', change.url).append( $('<abbr />') - .attr('title', change.id) + .attr('title', change_id) .text(change_id_short) ) ); } else { $change_link.append( - $('<a />').attr('href', change.url).text(change.id) + $('<a />').attr('href', change.url).text(change_id) ); } } else { + if (change_id.length === 40) { + change_id = change_id.substr(0, 7); + } $change_link.text(change_id); } |