remove "track external right clicks" feature
This commit is contained in:
parent
3dbaaf0d74
commit
fc3b904e1f
|
@ -83,15 +83,6 @@ export default {
|
|||
}
|
||||
}
|
||||
|
||||
// If they right clicked, change the destination href
|
||||
if (e.which === 3) {
|
||||
$link.attr(
|
||||
"href",
|
||||
Discourse.SiteSettings.track_external_right_clicks ? destUrl : href
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
// if they want to open in a new tab, do an AJAX request
|
||||
if (tracking && wantsNewWindow(e)) {
|
||||
ajax("/clicks/track", {
|
||||
|
|
|
@ -1227,7 +1227,6 @@ en:
|
|||
post_menu: "Determine which items appear on the post menu, and in what order. Example like|edit|flag|delete|share|bookmark|reply"
|
||||
post_menu_hidden_items: "The menu items to hide by default in the post menu unless an expansion ellipsis is clicked on."
|
||||
share_links: "Determine which items appear on the share dialog, and in what order."
|
||||
track_external_right_clicks: "Track external links that are right clicked (eg: open in new tab) disabled by default because it rewrites URLs"
|
||||
site_contact_username: "A valid staff username to send all automated messages from. If left blank the default System account will be used."
|
||||
send_welcome_message: "Send all new users a welcome message with a quick start guide."
|
||||
send_tl1_welcome_message: "Send new trust level 1 users a welcome message."
|
||||
|
|
|
@ -98,9 +98,6 @@ basic:
|
|||
default: 365
|
||||
min: 7
|
||||
max: 10000
|
||||
track_external_right_clicks:
|
||||
client: true
|
||||
default: false
|
||||
ga_universal_tracking_code:
|
||||
client: true
|
||||
default: ''
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
class RemoveTrackExternalRightClicks < ActiveRecord::Migration[5.2]
|
||||
def up
|
||||
execute "DELETE FROM site_settings WHERE name = 'track_external_right_clicks'"
|
||||
end
|
||||
|
||||
def down
|
||||
raise ActiveRecord::IrreversibleMigration
|
||||
end
|
||||
end
|
|
@ -7,7 +7,6 @@ Discourse.SiteSettingsOriginal = {
|
|||
"favicon_url":"//meta.discourse.org/uploads/default/2499/79d53726406d87af.ico",
|
||||
"allow_user_locale":false,
|
||||
"suggested_topics":7,
|
||||
"track_external_right_clicks":false,
|
||||
"ga_universal_tracking_code":"",
|
||||
"ga_universal_domain_name":"auto",
|
||||
"top_menu":"latest|new|unread|categories|top",
|
||||
|
|
|
@ -103,41 +103,6 @@ asyncTestDiscourse("restores the href after a while", function(assert) {
|
|||
}, 75);
|
||||
});
|
||||
|
||||
var trackRightClick = function(target) {
|
||||
var clickEvent = generateClickEventOn(target);
|
||||
clickEvent.which = 3;
|
||||
return track(clickEvent);
|
||||
};
|
||||
|
||||
QUnit.test("right clicks change the href", assert => {
|
||||
assert.ok(trackRightClick("a"));
|
||||
assert.equal(
|
||||
fixture("a")
|
||||
.first()
|
||||
.prop("href"),
|
||||
"http://www.google.com/"
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("right clicks are tracked", assert => {
|
||||
Discourse.SiteSettings.track_external_right_clicks = true;
|
||||
trackRightClick("a");
|
||||
assert.equal(
|
||||
fixture("a")
|
||||
.first()
|
||||
.attr("href"),
|
||||
"/clicks/track?url=http%3A%2F%2Fwww.google.com&post_id=42&topic_id=1337"
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("preventDefault is not called for right clicks", assert => {
|
||||
var clickEvent = generateClickEventOn("a");
|
||||
clickEvent.which = 3;
|
||||
sandbox.stub(clickEvent, "preventDefault");
|
||||
assert.ok(track(clickEvent));
|
||||
assert.ok(!clickEvent.preventDefault.calledOnce);
|
||||
});
|
||||
|
||||
var testOpenInANewTab = function(description, clickEventModifier) {
|
||||
test(description, function(assert) {
|
||||
var clickEvent = generateClickEventOn("a");
|
||||
|
|
|
@ -97,52 +97,6 @@ asyncTestDiscourse("restores the href after a while", function(assert) {
|
|||
}, 75);
|
||||
});
|
||||
|
||||
var trackRightClick = function(target) {
|
||||
var clickEvent = generateClickEventOn(target);
|
||||
clickEvent.which = 3;
|
||||
return track(clickEvent);
|
||||
};
|
||||
|
||||
QUnit.test("right clicks change the href", assert => {
|
||||
assert.ok(trackRightClick("a"));
|
||||
assert.equal(
|
||||
fixture("a")
|
||||
.first()
|
||||
.prop("href"),
|
||||
"http://www.google.com/"
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("right clicks are tracked", assert => {
|
||||
Discourse.SiteSettings.track_external_right_clicks = true;
|
||||
trackRightClick("a");
|
||||
assert.equal(
|
||||
fixture(".first a")
|
||||
.first()
|
||||
.attr("href"),
|
||||
"/clicks/track?url=http%3A%2F%2Fwww.google.com&post_id=42&topic_id=1337"
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("right clicks are tracked for second excerpt", assert => {
|
||||
Discourse.SiteSettings.track_external_right_clicks = true;
|
||||
trackRightClick(".second a");
|
||||
assert.equal(
|
||||
fixture(".second a")
|
||||
.first()
|
||||
.attr("href"),
|
||||
"/clicks/track?url=http%3A%2F%2Fwww.google.com&post_id=24&topic_id=7331"
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("preventDefault is not called for right clicks", assert => {
|
||||
var clickEvent = generateClickEventOn("a");
|
||||
clickEvent.which = 3;
|
||||
sandbox.stub(clickEvent, "preventDefault");
|
||||
assert.ok(track(clickEvent));
|
||||
assert.ok(!clickEvent.preventDefault.calledOnce);
|
||||
});
|
||||
|
||||
var testOpenInANewTab = function(description, clickEventModifier) {
|
||||
test(description, function(assert) {
|
||||
var clickEvent = generateClickEventOn("a");
|
||||
|
|
|
@ -132,41 +132,6 @@ QUnit.test("updates badge counts correctly", function(assert) {
|
|||
badgeClickCount(assert, "with-badge", 2);
|
||||
});
|
||||
|
||||
var trackRightClick = function() {
|
||||
var clickEvent = generateClickEventOn("a");
|
||||
clickEvent.which = 3;
|
||||
return track(clickEvent);
|
||||
};
|
||||
|
||||
QUnit.test("right clicks change the href", function(assert) {
|
||||
assert.ok(trackRightClick());
|
||||
assert.equal(
|
||||
fixture("a")
|
||||
.first()
|
||||
.prop("href"),
|
||||
"http://www.google.com/"
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("right clicks are tracked", function(assert) {
|
||||
Discourse.SiteSettings.track_external_right_clicks = true;
|
||||
trackRightClick();
|
||||
assert.equal(
|
||||
fixture("a")
|
||||
.first()
|
||||
.attr("href"),
|
||||
"/clicks/track?url=http%3A%2F%2Fwww.google.com&post_id=42&topic_id=1337"
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("preventDefault is not called for right clicks", function(assert) {
|
||||
var clickEvent = generateClickEventOn("a");
|
||||
clickEvent.which = 3;
|
||||
sandbox.stub(clickEvent, "preventDefault");
|
||||
assert.ok(track(clickEvent));
|
||||
assert.ok(!clickEvent.preventDefault.calledOnce);
|
||||
});
|
||||
|
||||
var testOpenInANewTab = function(description, clickEventModifier) {
|
||||
test(description, function(assert) {
|
||||
var clickEvent = generateClickEventOn("a");
|
||||
|
|
Loading…
Reference in New Issue