Skip to content

A platform for community discussion. Free, open, simple.

FIX: bug with sharing when used outside a topic

Penar Musaraj52b864facf16
diff --git a/app/assets/javascripts/discourse/app/components/share-panel.js b/app/assets/javascripts/discourse/app/components/share-panel.js
index abfad8adb30..ad9ffa7b204 100644
--- a/app/assets/javascripts/discourse/app/components/share-panel.js
+++ b/app/assets/javascripts/discourse/app/components/share-panel.js
@@ -17,8 +17,8 @@ export default Component.extend({
sources(topic) {
const privateContext =
this.siteSettings.login_required ||
- topic.isPrivateMessage ||
- topic.invisible ||
+ (topic && topic.isPrivateMessage) ||
+ (topic && topic.invisible) ||
this.privateCategory;
return Sharing.activeSources(this.siteSettings.share_links, privateContext);
},
diff --git a/app/assets/javascripts/discourse/app/components/share-popup.js b/app/assets/javascripts/discourse/app/components/share-popup.js
index 5c213f01f59..7668f1f18b6 100644
--- a/app/assets/javascripts/discourse/app/components/share-popup.js
+++ b/app/assets/javascripts/discourse/app/components/share-popup.js
@@ -20,8 +20,8 @@ export default Component.extend({
sources(topic) {
const privateContext =
this.siteSettings.login_required ||
- topic.isPrivateMessage ||
- topic.invisible ||
+ (topic && topic.isPrivateMessage) ||
+ (topic && topic.invisible) ||
this.privateCategory;
return Sharing.activeSources(this.siteSettings.share_links, privateContext);