fix: show sogs without display name in convo list

also use the pollinfo to update whatever the displayname if needed
pull/2479/head
Audric Ackermann 3 years ago
parent cdb010ac47
commit e8fe564a08

@ -1514,6 +1514,7 @@ export class ConversationModel extends Backbone.Model<ConversationAttributes> {
details: {
admins?: Array<string>;
image_id?: number;
name?: string;
moderators?: Array<string>;
hidden_admins?: Array<string>;
hidden_moderators?: Array<string>;
@ -1562,6 +1563,11 @@ export class ConversationModel extends Backbone.Model<ConversationAttributes> {
type: 'mods',
});
if (details.name && details.name !== this.getRealSessionUsername()) {
hasChange = hasChange || true;
this.setSessionDisplayNameNoCommit(details.name);
}
hasChange = hasChange || modsChanged;
if (this.isOpenGroupV2() && details.image_id && isNumber(details.image_id)) {

@ -134,6 +134,10 @@ export async function joinOpenGroupV2WithUIEvents(
const alreadyExist = hasExistingOpenGroup(parsedRoom.serverUrl, parsedRoom.roomId);
const conversationID = getOpenGroupV2ConversationId(parsedRoom.serverUrl, parsedRoom.roomId);
if (alreadyExist || getConversationController().get(conversationID)) {
const existingConvo = getConversationController().get(conversationID);
await existingConvo.setDidApproveMe(true, false);
await existingConvo.setIsApproved(true, false);
await existingConvo.commit();
if (showToasts) {
ToastUtils.pushToastError('publicChatExists', window.i18n('publicChatExists'));
}

@ -197,6 +197,8 @@ export class OpenGroupManagerV2 {
active_at: Date.now(),
displayNameInProfile: room.roomName,
isApproved: true,
didApproveMe: true,
isTrustedForAttachmentDownload: true, // we always trust attachments when sent to an opengroup
});
await conversation.commit();

@ -77,6 +77,7 @@ async function handlePollInfoResponse(
details: {
admins?: Array<string>;
image_id: number;
name?: string;
moderators?: Array<string>;
hidden_admins?: Array<string>;
hidden_moderators?: Array<string>;
@ -122,7 +123,8 @@ async function handlePollInfoResponse(
'image_id',
'moderators',
'hidden_admins',
'hidden_moderators'
'hidden_moderators',
'name'
),
});
}

@ -419,14 +419,6 @@ export const _getSortedConversations = (
};
}
// Add Open Group to list as soon as the name has been set
if (
conversation.isPublic &&
(!conversation.displayNameInProfile || conversation.displayNameInProfile === 'Unknown group')
) {
continue;
}
// Remove all invalid conversations and conversatons of devices associated
// with cancelled attempted links
if (!conversation.isPublic && !conversation.activeAt) {

Loading…
Cancel
Save