create closed group mark as approved

also, do not filter closed group based on the isApproved field in redux
This commit is contained in:
Audric Ackermann 2022-03-16 10:49:19 +11:00
parent 0e329d8c68
commit 74cf88cf81
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4
6 changed files with 6 additions and 8 deletions

View File

@ -776,7 +776,6 @@ export class ConversationModel extends Backbone.Model<ConversationAttributes> {
messageRequestResponse: {
isApproved: 1,
},
unread: 1, // 1 means unread
expireTimer: 0,
});
@ -945,7 +944,6 @@ export class ConversationModel extends Backbone.Model<ConversationAttributes> {
if (isOutgoing) {
message = await this.addSingleOutgoingMessage({
...commonAttributes,
unread: 0,
sent_at: timestamp,
});
} else {
@ -1017,7 +1015,7 @@ export class ConversationModel extends Backbone.Model<ConversationAttributes> {
public async addSingleOutgoingMessage(
messageAttributes: Omit<
MessageAttributesOptionals,
'conversationId' | 'source' | 'type' | 'direction' | 'received_at'
'conversationId' | 'source' | 'type' | 'direction' | 'received_at' | 'unread'
>
) {
return this.addSingleMessage({
@ -1026,6 +1024,7 @@ export class ConversationModel extends Backbone.Model<ConversationAttributes> {
source: UserUtils.getOurPubKeyStrFromCache(),
type: 'outgoing',
direction: 'outgoing',
unread: 0, // an outgoing message must be read right?
received_at: messageAttributes.sent_at, // make sure to set an received_at timestamp for an outgoing message, so the order are right.
});
}

View File

@ -954,7 +954,7 @@ export async function createClosedGroup(groupName: string, members: Array<string
UserUtils.getOurPubKeyStrFromCache(),
Date.now()
);
await convo.setIsApproved(true, false);
// be sure to call this before sending the message.
// the sending pipeline needs to know from GroupUtils when a message is for a medium group
await ClosedGroup.updateOrCreateClosedGroup(groupDetails);

View File

@ -616,7 +616,8 @@ export async function handleDataExtractionNotification(
const envelopeTimestamp = Lodash.toNumber(timestamp);
const referencedAttachmentTimestamp = Lodash.toNumber(referencedAttachment);
await convo.addSingleOutgoingMessage({
await convo.addSingleIncomingMessage({
source,
sent_at: envelopeTimestamp,
dataExtractionNotification: {
type,

View File

@ -174,7 +174,6 @@ export async function addUpdateMessage(
const outgoingMessage = await convo.addSingleOutgoingMessage({
sent_at: sentAt,
group_update: groupUpdate,
unread: 1,
expireTimer: 0,
});
return outgoingMessage;

View File

@ -503,7 +503,6 @@ export async function USER_callRecipient(recipient: string) {
sent_at: now,
expireTimer: 0,
callNotificationType: 'started-call',
unread: 0,
});
// initiating a call is analgous to sending a message request

View File

@ -352,7 +352,7 @@ export const _getLeftPaneLists = (
directConversations.push(conversation);
}
if (!conversation.isApproved) {
if (!conversation.isApproved && conversation.isPrivate) {
// dont increase unread counter, don't push to convo list.
continue;
}