Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: show sogs without display name in convo list #2479

Merged
merged 1 commit into from
Sep 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions ts/models/conversation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>;
Expand Down Expand Up @@ -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)) {
Expand Down
4 changes: 4 additions & 0 deletions ts/session/apis/open_group_api/opengroupV2/JoinOpenGroupV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
4 changes: 3 additions & 1 deletion ts/session/apis/open_group_api/sogsv3/sogsApiV3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>;
Expand Down Expand Up @@ -122,7 +123,8 @@ async function handlePollInfoResponse(
'image_id',
'moderators',
'hidden_admins',
'hidden_moderators'
'hidden_moderators',
'name'
),
});
}
Expand Down
8 changes: 0 additions & 8 deletions ts/state/selectors/conversations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down