REFACTOR: Remove `Discourse.SiteSettings` from click tracking
This commit is contained in:
parent
bc7dac852f
commit
aa2eea7729
|
@ -108,9 +108,7 @@ export default Component.extend(
|
|||
$(this.element).on(
|
||||
"click.discourse-redirect",
|
||||
".cooked a, a.track-link",
|
||||
function(e) {
|
||||
return ClickTrack.trackClick(e);
|
||||
}
|
||||
e => ClickTrack.trackClick(e, this.siteSettings)
|
||||
);
|
||||
|
||||
this.appEvents.on("discourse:focus-changed", this, "gotFocus");
|
||||
|
|
|
@ -5,8 +5,8 @@ export default Component.extend({
|
|||
didInsertElement() {
|
||||
this._super(...arguments);
|
||||
|
||||
$(this.element).on("click.discourse-redirect", "a", function(e) {
|
||||
return ClickTrack.trackClick(e);
|
||||
$(this.element).on("click.discourse-redirect", "a", e => {
|
||||
return ClickTrack.trackClick(e, this.siteSettings);
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
@ -40,8 +40,8 @@ export default Component.extend(LoadMore, {
|
|||
"details.disabled",
|
||||
() => false
|
||||
);
|
||||
$(this.element).on("click.discourse-redirect", ".excerpt a", function(e) {
|
||||
return ClickTrack.trackClick(e);
|
||||
$(this.element).on("click.discourse-redirect", ".excerpt a", e => {
|
||||
return ClickTrack.trackClick(e, this.siteSettings);
|
||||
});
|
||||
}),
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ export function isValidLink($link) {
|
|||
}
|
||||
|
||||
export default {
|
||||
trackClick(e) {
|
||||
trackClick(e, siteSettings) {
|
||||
// right clicks are not tracked
|
||||
if (e.which === 3) {
|
||||
return true;
|
||||
|
@ -65,7 +65,8 @@ export default {
|
|||
if ($link.hasClass("attachment")) {
|
||||
// Warn the user if they cannot download the file.
|
||||
if (
|
||||
Discourse.SiteSettings.prevent_anons_from_downloading_files &&
|
||||
siteSettings &&
|
||||
siteSettings.prevent_anons_from_downloading_files &&
|
||||
!User.current()
|
||||
) {
|
||||
bootbox.alert(I18n.t("post.errors.attachment_download_requires_login"));
|
||||
|
|
Loading…
Reference in New Issue