mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 07:53:49 +08:00
FIX: Do not track right clicks. (#6530)
This commit is contained in:

committed by
Régis Hanol

parent
6a3767cde7
commit
2a77550f8c
@ -13,6 +13,11 @@ export function isValidLink($link) {
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
trackClick(e) {
|
trackClick(e) {
|
||||||
|
// right clicks are not tracked
|
||||||
|
if (e.which === 3) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// cancel click if triggered as part of selection.
|
// cancel click if triggered as part of selection.
|
||||||
if (selectedText() !== "") {
|
if (selectedText() !== "") {
|
||||||
return false;
|
return false;
|
||||||
|
@ -69,6 +69,12 @@ QUnit.test("does not track clicks on back buttons", assert => {
|
|||||||
assert.ok(track(generateClickEventOn(".back")));
|
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 => {
|
QUnit.test("does not track clicks to internal links in quotes", assert => {
|
||||||
sandbox.stub(DiscourseURL, "routeTo");
|
sandbox.stub(DiscourseURL, "routeTo");
|
||||||
sandbox.stub(DiscourseURL, "origin").returns("http://discuss.domain.com");
|
sandbox.stub(DiscourseURL, "origin").returns("http://discuss.domain.com");
|
||||||
|
Reference in New Issue
Block a user