summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/todos.js.es6
diff options
context:
space:
mode:
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);