summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/todos.js.es6
diff options
context:
space:
mode:
authorClement Ho <ClemMakesApps@gmail.com>2017-02-09 16:19:12 -0600
committerClement Ho <ClemMakesApps@gmail.com>2017-02-15 10:22:14 -0600
commit25fec0f882300ab4f917a71a5650ab0d29c7b939 (patch)
treee082995e3f67eeed1afd0b4f8d7dd3d117f086e6 /app/assets/javascripts/todos.js.es6
parent059f47b6ba09ae1a6b1dbfc2debf82064d8793fc (diff)
downloadgitlab-ce-25fec0f882300ab4f917a71a5650ab0d29c7b939.tar.gz
Fix regression where cmd-click stopped working for todos and merge request tabs27922-cmd-click-todo-doesn-t-work
Diffstat (limited to 'app/assets/javascripts/todos.js.es6')
-rw-r--r--app/assets/javascripts/todos.js.es617
1 files changed, 7 insertions, 10 deletions
diff --git a/app/assets/javascripts/todos.js.es6 b/app/assets/javascripts/todos.js.es6
index b07e62a8c30..ded683f2ca1 100644
--- a/app/assets/javascripts/todos.js.es6
+++ b/app/assets/javascripts/todos.js.es6
@@ -147,24 +147,21 @@
goToTodoUrl(e) {
const todoLink = this.dataset.url;
- let targetLink = e.target.getAttribute('href');
-
- if (e.target.tagName === 'IMG') { // See if clicked target was Avatar
- targetLink = e.target.parentElement.getAttribute('href'); // Parent of Avatar is link
- }
if (!todoLink) {
return;
}
if (gl.utils.isMetaClick(e)) {
+ const windowTarget = '_blank';
+ const selected = e.target;
e.preventDefault();
- // Meta-Click on username leads to different URL than todoLink.
- // Turbolinks can resolve that URL, but window.open requires URL manually.
- if (targetLink !== todoLink) {
- return window.open(targetLink, '_blank');
+
+ if (selected.tagName === 'IMG') {
+ const avatarUrl = selected.parentElement.getAttribute('href');
+ return window.open(avatarUrl, windowTarget);
} else {
- return window.open(todoLink, '_blank');
+ return window.open(todoLink, windowTarget);
}
} else {
return gl.utils.visitUrl(todoLink);