diff --git a/app/assets/javascripts/discourse/lib/click-track.js.es6 b/app/assets/javascripts/discourse/lib/click-track.js.es6 index 5360bc4c3..d7f11cb31 100644 --- a/app/assets/javascripts/discourse/lib/click-track.js.es6 +++ b/app/assets/javascripts/discourse/lib/click-track.js.es6 @@ -73,6 +73,14 @@ export default { $link.data('auto-route', true); } + // restore href + setTimeout(() => { + $link.removeClass('no-href'); + $link.attr('href', $link.data('href')); + $link.data('href', null); + return; + }, 50); + // warn the user if they can't download the file if (Discourse.SiteSettings.prevent_anons_from_downloading_files && $link.hasClass("attachment") && !Discourse.User.current()) { bootbox.alert(I18n.t("post.errors.attachment_download_requires_login")); @@ -94,13 +102,6 @@ export default { return false; } - // restore href - setTimeout(function() { - $link.removeClass('no-href'); - $link.attr('href', $link.data('href')); - $link.data('href', null); - }, 50); - // Otherwise, use a custom URL with a redirect if (Discourse.User.currentProp('external_links_in_new_tab')) { var win = window.open(trackingUrl, '_blank');