From 52b864facf164549155b8f1b7cebbf7c3ba0aa45 Mon Sep 17 00:00:00 2001 From: Penar Musaraj Date: Mon, 3 Aug 2020 16:27:11 -0400 Subject: [PATCH] FIX: bug with sharing when used outside a topic Followup to ac76bfb, fixes share buttons in topic lists (only used in themes or plugins) --- .../javascripts/discourse/app/components/share-panel.js | 4 ++-- .../javascripts/discourse/app/components/share-popup.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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);