Skip to content

Commit

Permalink
jira-pr-links-improver: support Jira 9
Browse files Browse the repository at this point in the history
Jira 9 has the same layout as Jira 8, so similarly to recently added
support of Jira 9 to jira_copy_summary.user.js [1], we can just use the
same code as for Jira 8.

The same `switch` statement for different versions of Jira also has a
`default:` case.  This default case assigns the value for variable
`header`, but doesn't use it and `return`s instead.  This seems as an
oversight.  I probably meant to use a `break` here to let the script
finish working even on quote-unquote "unsupported" version of Jira.
Usage of `warn` instead of `error` for the log message also supports
this hypothesis.  Let the userscript work on all versions of Jira, even
those that aren't considered "supported".

[1] 962cc3a (jira_copy_summary: support Jira 9, 2023-10-03)
  • Loading branch information
rybak committed Dec 18, 2023
1 parent 1248e82 commit bb2b380
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions jira-pr-links-improver.user.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ==UserScript==
// @name Jira: Pull Request Link Improver
// @namespace https://github.com/rybak/atlassian-tweaks
// @version 9
// @version 10
// @license MIT
// @description Adds more convenient pull request links to Jira tickets.
// @author Andrei Rybak
Expand Down Expand Up @@ -61,12 +61,13 @@
header = '<div class="mod-header"><h2 class="toggle-title">Pull requests</h2></div>';
break;
case "8":
case "9":
header = '<div class="mod-header"><h4 class="toggle-title">Pull requests</h4></div>';
break;
default:
warn("Jira v" + jiraMajorVersion + " is not supported");
header = '<div class="mod-header"><h4 class="toggle-title">Pull requests</h4></div>';
return;
break;
}
$('#viewissue-devstatus-panel')
.prepend($(header +
Expand Down

0 comments on commit bb2b380

Please sign in to comment.