summaryrefslogtreecommitdiff
path: root/app/assets
diff options
context:
space:
mode:
authorAlfredo Sumaran <alfredo@gitlab.com>2017-02-15 17:52:01 +0000
committerAlfredo Sumaran <alfredo@gitlab.com>2017-02-15 17:52:01 +0000
commit6df388ea80243c259a4005444166a0f9f551deb7 (patch)
tree7dd89f3312d0e55be147eda1026ba203357bd3aa /app/assets
parent798e03f0c800250c433276e84ca528ea88ad9a16 (diff)
parent25fec0f882300ab4f917a71a5650ab0d29c7b939 (diff)
downloadgitlab-ce-6df388ea80243c259a4005444166a0f9f551deb7.tar.gz
Merge branch '27922-cmd-click-todo-doesn-t-work' into 'master'
Fix regression where cmd-click stopped working for todos and merge request tabs Closes #27922 See merge request !9115
Diffstat (limited to 'app/assets')
-rw-r--r--app/assets/javascripts/merge_request_tabs.js.es65
-rw-r--r--app/assets/javascripts/todos.js.es617
2 files changed, 10 insertions, 12 deletions
diff --git a/app/assets/javascripts/merge_request_tabs.js.es6 b/app/assets/javascripts/merge_request_tabs.js.es6
index da9bd9e9d82..190336dbd20 100644
--- a/app/assets/javascripts/merge_request_tabs.js.es6
+++ b/app/assets/javascripts/merge_request_tabs.js.es6
@@ -103,9 +103,10 @@ require('./flash');
}
clickTab(e) {
- if (e.target && gl.utils.isMetaClick(e)) {
- const targetLink = e.target.getAttribute('href');
+ if (e.currentTarget && gl.utils.isMetaClick(e)) {
+ const targetLink = e.currentTarget.getAttribute('href');
e.stopImmediatePropagation();
+ e.preventDefault();
window.open(targetLink, '_blank');
}
}
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);