From 34e5648681cbfa14d5996f619cc07e65fa72dfbd Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Wed, 27 Jan 2021 18:08:02 +1100 Subject: [PATCH] fix metadatabadges for closed group do not show crown nor Mod badge --- ts/components/conversation/Message.tsx | 3 ++- ts/components/conversation/message/MetadataBadge.tsx | 2 +- ts/receiver/dataMessage.ts | 9 ++++++--- ts/receiver/receiver.ts | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/ts/components/conversation/Message.tsx b/ts/components/conversation/Message.tsx index 32f2a8e78..7e578c6be 100644 --- a/ts/components/conversation/Message.tsx +++ b/ts/components/conversation/Message.tsx @@ -506,6 +506,7 @@ class MessageInner extends React.PureComponent { isAdmin, conversationType, direction, + isPublic, onShowUserDetails, firstMessageOfSeries, } = this.props; @@ -534,7 +535,7 @@ class MessageInner extends React.PureComponent { }} pubkey={authorPhoneNumber} /> - {isAdmin && ( + {isPublic && isAdmin && (
diff --git a/ts/components/conversation/message/MetadataBadge.tsx b/ts/components/conversation/message/MetadataBadge.tsx index 11d3d45cd..18864c49d 100644 --- a/ts/components/conversation/message/MetadataBadge.tsx +++ b/ts/components/conversation/message/MetadataBadge.tsx @@ -53,7 +53,7 @@ export const MetadataBadges = (props: BadgesProps): JSX.Element => { const { id, direction, isPublic, isAdmin, withImageNoCaption } = props; const badges = [ (isPublic && 'Public') || null, - (isAdmin && 'Mod') || null, + (isPublic && isAdmin && 'Mod') || null, ].filter(nonNullish); if (!badges || badges.length === 0) { diff --git a/ts/receiver/dataMessage.ts b/ts/receiver/dataMessage.ts index 125e82c0f..9d757818e 100644 --- a/ts/receiver/dataMessage.ts +++ b/ts/receiver/dataMessage.ts @@ -626,9 +626,12 @@ export async function handleMessageEvent(event: MessageEvent): Promise { // the conversation with the primary device of that source (can be the same as conversationOrigin) - const conversation = ConversationController.getInstance().getOrThrow( - conversationId - ); + const conversation = ConversationController.getInstance().get(conversationId); + + if (!conversation) { + window.log.warn('Skipping handleJob for unknown convo: ', conversationId); + return; + } conversation.queueJob(async () => { await handleMessageJob( diff --git a/ts/receiver/receiver.ts b/ts/receiver/receiver.ts index 5eff029cb..42ec85f0a 100644 --- a/ts/receiver/receiver.ts +++ b/ts/receiver/receiver.ts @@ -298,7 +298,7 @@ export async function handlePublicMessage({ message: outerMessage }: any) { const ev = { // Public chat messages from ourselves should be outgoing type: isOurDevice ? 'sent' : 'message', - data: outerMessage, + data: messageData, confirm: () => { /* do nothing */ },