FIX: Do not track right clicks. (#6530)

This commit is contained in:
Bianca Nenciu 2018-10-25 12:46:05 +03:00 committed by Régis Hanol
parent 6a3767cde7
commit 2a77550f8c
2 changed files with 11 additions and 0 deletions

View File

@ -13,6 +13,11 @@ export function isValidLink($link) {
export default {
trackClick(e) {
// right clicks are not tracked
if (e.which === 3) {
return true;
}
// cancel click if triggered as part of selection.
if (selectedText() !== "") {
return false;

View File

@ -69,6 +69,12 @@ QUnit.test("does not track clicks on back buttons", assert => {
assert.ok(track(generateClickEventOn(".back")));
});
QUnit.test("does not track right clicks inside quotes", assert => {
const event = generateClickEventOn(".quote a:first-child");
event.which = 3;
assert.ok(track(event));
});
QUnit.test("does not track clicks to internal links in quotes", assert => {
sandbox.stub(DiscourseURL, "routeTo");
sandbox.stub(DiscourseURL, "origin").returns("http://discuss.domain.com");