diff --git a/ts/components/MemberListItem.tsx b/ts/components/MemberListItem.tsx index 4db539d7b..bc3501b67 100644 --- a/ts/components/MemberListItem.tsx +++ b/ts/components/MemberListItem.tsx @@ -323,6 +323,7 @@ export const MemberListItem = ({ flexDirection="column" margin="0 var(--margins-md)" alignItems="flex-start" + minWidth="0" > {ourName || memberName} diff --git a/ts/components/conversation/composition/UserMentions.tsx b/ts/components/conversation/composition/UserMentions.tsx index 7fabf1b42..fab6047e9 100644 --- a/ts/components/conversation/composition/UserMentions.tsx +++ b/ts/components/conversation/composition/UserMentions.tsx @@ -44,6 +44,7 @@ export const renderUserMentionRow = (suggestion: SuggestionDataItem) => { pubkey={`${suggestion.id}`} inMentions={true} dataTestId="mentions-popup-row" + maxNameWidth="100%" /> ); }; diff --git a/ts/components/dialog/InviteContactsDialog.tsx b/ts/components/dialog/InviteContactsDialog.tsx index 883a9a938..0e0669ac0 100644 --- a/ts/components/dialog/InviteContactsDialog.tsx +++ b/ts/components/dialog/InviteContactsDialog.tsx @@ -206,6 +206,7 @@ const InviteContactsDialogInner = (props: Props) => { onSelect={addTo} onUnselect={removeFrom} disableBg={true} + maxNameWidth="100%" /> )) ) : ( diff --git a/ts/components/dialog/ModeratorsRemoveDialog.tsx b/ts/components/dialog/ModeratorsRemoveDialog.tsx index a7ebc96bf..4b058d31e 100644 --- a/ts/components/dialog/ModeratorsRemoveDialog.tsx +++ b/ts/components/dialog/ModeratorsRemoveDialog.tsx @@ -104,6 +104,7 @@ export const RemoveModeratorsDialog = (props: Props) => { setModsToRemove(updatedList); }} disableBg={true} + maxNameWidth="100%" /> ))} diff --git a/ts/components/dialog/UpdateGroupMembersDialog.tsx b/ts/components/dialog/UpdateGroupMembersDialog.tsx index 63081243d..29540f501 100644 --- a/ts/components/dialog/UpdateGroupMembersDialog.tsx +++ b/ts/components/dialog/UpdateGroupMembersDialog.tsx @@ -86,6 +86,7 @@ const MemberList = (props: { disableBg={true} displayGroupStatus={isV2Group && weAreAdmin} groupPk={convoId} + maxNameWidth="100%" /> ); })} diff --git a/ts/components/leftpane/overlay/OverlayClosedGroup.tsx b/ts/components/leftpane/overlay/OverlayClosedGroup.tsx index fd7e66cd1..8ef59b4a1 100644 --- a/ts/components/leftpane/overlay/OverlayClosedGroup.tsx +++ b/ts/components/leftpane/overlay/OverlayClosedGroup.tsx @@ -228,6 +228,7 @@ export const OverlayClosedGroupV2 = () => { onSelect={addToSelected} onUnselect={removeFromSelected} disableBg={true} + maxNameWidth="100%" /> )) )} @@ -345,6 +346,7 @@ export const OverlayLegacyClosedGroup = () => { onUnselect={removeFromSelected} withBorder={false} disabled={loading} + maxNameWidth="100%" /> )) )} diff --git a/ts/components/settings/BlockedList.tsx b/ts/components/settings/BlockedList.tsx index 0e6819974..4cfeaef6d 100644 --- a/ts/components/settings/BlockedList.tsx +++ b/ts/components/settings/BlockedList.tsx @@ -64,6 +64,7 @@ const BlockedEntries = (props: { onSelect={addToSelected} onUnselect={removeFromSelected} disableBg={true} + maxNameWidth="100%" /> ); })} diff --git a/ts/data/data.ts b/ts/data/data.ts index 7ee944142..623e68306 100644 --- a/ts/data/data.ts +++ b/ts/data/data.ts @@ -1,7 +1,7 @@ // eslint:disable: no-require-imports no-var-requires one-variable-per-declaration no-void-expression function-name import { GroupPubkeyType } from 'libsession_util_nodejs'; -import _, { isEmpty } from 'lodash'; +import _, { isArray, isEmpty } from 'lodash'; import { ConversationModel } from '../models/conversation'; import { ConversationAttributes } from '../models/conversationAttributes'; import { MessageCollection, MessageModel } from '../models/message'; @@ -285,6 +285,9 @@ async function getAllMessagesWithAttachmentsInConversationSentBefore(args: { }): Promise> { const msgAttrs = await channels.getAllMessagesWithAttachmentsInConversationSentBefore(args); + if (!msgAttrs || isEmpty(msgAttrs) || !isArray(msgAttrs)) { + return []; + } return msgAttrs.map((msg: any) => new MessageModel(msg)); } @@ -578,7 +581,7 @@ async function findAllMessageFromSendersInConversation( ): Promise> { const msgAttrs = await channels.findAllMessageFromSendersInConversation(args); - if (!msgAttrs || isEmpty(msgAttrs)) { + if (!msgAttrs || isEmpty(msgAttrs) || !isArray(msgAttrs)) { return []; } @@ -590,7 +593,7 @@ async function findAllMessageHashesInConversation( ): Promise> { const msgAttrs = await channels.findAllMessageHashesInConversation(args); - if (!msgAttrs || isEmpty(msgAttrs)) { + if (!msgAttrs || isEmpty(msgAttrs) || !isArray(msgAttrs)) { return []; } @@ -602,7 +605,7 @@ async function findAllMessageHashesInConversationMatchingAuthor( ): Promise> { const msgAttrs = await channels.findAllMessageHashesInConversationMatchingAuthor(args); - if (!msgAttrs || isEmpty(msgAttrs)) { + if (!msgAttrs || isEmpty(msgAttrs) || !isArray(msgAttrs)) { return []; } diff --git a/ts/models/conversation.ts b/ts/models/conversation.ts index 0f5d57332..6bbda4f52 100644 --- a/ts/models/conversation.ts +++ b/ts/models/conversation.ts @@ -673,6 +673,18 @@ export class ConversationModel extends Backbone.Model { }); return; } + + if (this.isClosedGroupV2()) { + // we need the return await so that errors are caught in the catch {} + await this.sendMessageToGroupV2(chatMessageParams); + await Reactions.handleMessageReaction({ + reaction, + sender: UserUtils.getOurPubKeyStrFromCache(), + you: true, + }); + return; + } + if (this.isClosedGroup()) { const chatMessageMediumGroup = new VisibleMessage(chatMessageParams); const closedGroupVisibleMessage = new ClosedGroupVisibleMessage({ diff --git a/ts/state/selectors/conversations.ts b/ts/state/selectors/conversations.ts index 5c9c2c480..40d1f2a42 100644 --- a/ts/state/selectors/conversations.ts +++ b/ts/state/selectors/conversations.ts @@ -316,7 +316,8 @@ const _getContacts = ( ): Array => { return sortedConversations.filter(convo => { // a private conversation not approved is a message request. Include them in the list of contacts - return !convo.isBlocked && convo.isPrivate && !convo.isMe; + // Note: we filter out non 05-pubkeys as we don't want blinded message request to be part of this list + return !convo.isBlocked && convo.isPrivate && !convo.isMe && PubKey.is05Pubkey(convo.id); }); }; @@ -481,7 +482,7 @@ export type DirectContactsByNameType = { }; // make sure that createSelector is called here so this function is memoized -export const getSortedContacts = createSelector( +const getSortedContacts = createSelector( getContacts, (contacts: Array): Array => { const us = UserUtils.getOurPubKeyStrFromCache(); diff --git a/ts/state/selectors/groups.ts b/ts/state/selectors/groups.ts index 904adb457..6c1a70044 100644 --- a/ts/state/selectors/groups.ts +++ b/ts/state/selectors/groups.ts @@ -232,18 +232,27 @@ export function useMemberPromoteSending(groupPk: GroupPubkeyType, memberPk: Pubk } type MemberStateGroupV2WithSending = MemberStateGroupV2 | 'INVITE_SENDING' | 'PROMOTION_SENDING'; +type MemberWithV2Sending = Pick & { + memberStatus: MemberStateGroupV2WithSending; +}; export function useStateOf03GroupMembers(convoId?: string) { const us = UserUtils.getOurPubKeyStrFromCache(); let unsortedMembers = useSelector((state: StateType) => getMembersOfGroup(state, convoId)); const invitesSendingPk = useMembersInviteSending(convoId); const promotionsSendingPk = useMembersPromoteSending(convoId); - let invitesSending = compact( - invitesSendingPk.map(sending => unsortedMembers.find(m => m.pubkeyHex === sending)) - ); - const promotionSending = compact( - promotionsSendingPk.map(sending => unsortedMembers.find(m => m.pubkeyHex === sending)) + let invitesSending: Array = compact( + invitesSendingPk + .map(sending => unsortedMembers.find(m => m.pubkeyHex === sending)) + .map(m => { + return m ? { ...m, memberStatus: 'INVITE_SENDING' as const } : null; + }) ); + const promotionSending: Array = compact( promotionsSendingPk + .map(sending => unsortedMembers.find(m => m.pubkeyHex === sending)) + .map(m => { + return m ? { ...m, memberStatus: 'PROMOTION_SENDING' as const } : null; + })); // promotionSending has priority against invitesSending, so removing anything in invitesSending found in promotionSending invitesSending = differenceBy(invitesSending, promotionSending, value => value.pubkeyHex); @@ -283,7 +292,6 @@ export function useStateOf03GroupMembers(convoId?: string) { unsortedWithStatuses.push(...promotionSending); unsortedWithStatuses.push(...differenceBy(invitesSending, promotionSending)); unsortedWithStatuses.push(...differenceBy(unsortedMembers, invitesSending, promotionSending)); - const names = useConversationsNicknameRealNameOrShortenPubkey( unsortedWithStatuses.map(m => m.pubkeyHex) ); @@ -336,6 +344,5 @@ export function useStateOf03GroupMembers(convoId?: string) { index++; return sortingOrder; }); - return sorted; }