diff --git a/js/background.js b/js/background.js index 799d8f8f3..8950b48e1 100644 --- a/js/background.js +++ b/js/background.js @@ -206,31 +206,9 @@ const initAPIs = async () => { const ourKey = textsecure.storage.user.getNumber(); - const rssFeedConversations = await window.Signal.Data.getAllRssFeedConversations( - { - ConversationCollection: Whisper.ConversationCollection, - } - ); window.feeds = []; - rssFeedConversations.forEach(conversation => { - window.feeds.push(new window.LokiRssAPI(conversation.getRssSettings())); - }); window.lokiMessageAPI = new window.LokiMessageAPI(ourKey); window.lokiPublicChatAPI = new window.LokiPublicChatAPI(ourKey); - const publicConversations = await window.Signal.Data.getAllPublicConversations( - { - ConversationCollection: Whisper.ConversationCollection, - } - ); - publicConversations.forEach(conversation => { - const settings = conversation.getPublicSource(); - const channel = window.lokiPublicChatAPI.findOrCreateChannel( - settings.server, - settings.channelId, - conversation.id - ); - channel.refreshModStatus(); - }); window.lokiP2pAPI = new window.LokiP2pAPI(ourKey); window.lokiP2pAPI.on('pingContact', pubKey => { const isPing = true; diff --git a/js/conversation_controller.js b/js/conversation_controller.js index 50b3aae33..3383e6e24 100644 --- a/js/conversation_controller.js +++ b/js/conversation_controller.js @@ -247,6 +247,17 @@ conversation.resetPendingSend(), conversation.setFriendRequestExpiryTimeout(), ]); + if (conversation.isPublic()) { + const settings = conversation.getPublicSource(); + const channel = window.lokiPublicChatAPI.findOrCreateChannel( + settings.server, + settings.channelId, + conversation.id + ); + promises.push(channel.refreshModStatus()); + } else if (conversation.isRss()) { + window.feeds.push(new window.LokiRssAPI(conversation.getRssSettings())); + } }); await Promise.all(promises); diff --git a/js/models/conversations.js b/js/models/conversations.js index 9774ef97c..5987daed2 100644 --- a/js/models/conversations.js +++ b/js/models/conversations.js @@ -2079,7 +2079,7 @@ ); return channelAPI; }, - getModStatus() { + isModerator() { if (!this.isPublic()) { return false; } diff --git a/js/models/messages.js b/js/models/messages.js index d9027cf9c..e584b95a6 100644 --- a/js/models/messages.js +++ b/js/models/messages.js @@ -674,7 +674,7 @@ isRss: !!this.get('isRss'), isDeletable: !this.get('isPublic') || - this.getConversation().getModStatus() || + this.getConversation().isModerator() || this.getSource() === this.OUR_NUMBER, onCopyText: () => this.copyText(),