FIX: erratic behaviour when clicking an attachment link
This commit is contained in:
parent
8c930c97e0
commit
ad3d2269b2
|
@ -73,6 +73,14 @@ export default {
|
||||||
$link.data('auto-route', true);
|
$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
|
// warn the user if they can't download the file
|
||||||
if (Discourse.SiteSettings.prevent_anons_from_downloading_files && $link.hasClass("attachment") && !Discourse.User.current()) {
|
if (Discourse.SiteSettings.prevent_anons_from_downloading_files && $link.hasClass("attachment") && !Discourse.User.current()) {
|
||||||
bootbox.alert(I18n.t("post.errors.attachment_download_requires_login"));
|
bootbox.alert(I18n.t("post.errors.attachment_download_requires_login"));
|
||||||
|
@ -94,13 +102,6 @@ export default {
|
||||||
return false;
|
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
|
// Otherwise, use a custom URL with a redirect
|
||||||
if (Discourse.User.currentProp('external_links_in_new_tab')) {
|
if (Discourse.User.currentProp('external_links_in_new_tab')) {
|
||||||
var win = window.open(trackingUrl, '_blank');
|
var win = window.open(trackingUrl, '_blank');
|
||||||
|
|
Loading…
Reference in New Issue