Skip to content

Commit ae76260

Browse files
committed
Trigger any goto actions
1 parent 70168c5 commit ae76260

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

src/inject/inject.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,20 +98,21 @@ function triggerGitHubLink (backgroundOrNot) {
9898

9999
// Go to selected email GitHub thread
100100
function generateUrlAndGoTo (selected, regexp) {
101-
// If the title looks like a GitHub notification email.
102-
if( (title = selected.innerText.match(/\[(.*)\]\s.*\s\(\#(\d*)\)/)) ) {
101+
gotoaction = selected.querySelectorAll('.aKS [role="button"]')[0]
103102

103+
if(gotoaction) {
104+
// if there's a gotoaction
105+
gotoaction.dispatchEvent(fakeEvent('mousedown'))
106+
107+
} else if( (title = selected.innerText.match(/\[(.*)\]\s.*\s\(\#(\d*)\)/)) ) {
108+
// If the title looks like a GitHub notification email.
104109
// org name coms from a label
105110
regexp = new RegExp(regexp)
106-
label = selected.querySelectorAll('.av')[0]
107-
if (label) org = label.innerText.toLowerCase().match(regexp)
111+
label = selected.querySelectorAll('.av')[0]
108112

109-
// quick action ?!
110-
gotoaction = selected.querySelectorAll('.aKS [role="button"]')[0]
113+
if(label) org = label.innerText.toLowerCase().match(regexp)
111114

112-
if(gotoaction) {
113-
gotoaction.dispatchEvent(fakeEvent('mousedown'))
114-
} else if(org) {
115+
if(org) {
115116
org = org[1]
116117
repo = title[1]
117118
issue_no = title[2]

0 commit comments

Comments
 (0)