GroupsV2: Use both sent_at and received_at when processing changes
This commit is contained in:
parent
deb3dd5d4e
commit
cad9803d38
2 changed files with 10 additions and 6 deletions
|
@ -2463,7 +2463,8 @@
|
||||||
conversation,
|
conversation,
|
||||||
groupChangeBase64: groupChange,
|
groupChangeBase64: groupChange,
|
||||||
newRevision: revision,
|
newRevision: revision,
|
||||||
timestamp: message.get('received_at'),
|
receivedAt: message.get('received_at'),
|
||||||
|
sentAt: message.get('sent_at'),
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const errorText = error && error.stack ? error.stack : error;
|
const errorText = error && error.stack ? error.stack : error;
|
||||||
|
|
13
ts/groups.ts
13
ts/groups.ts
|
@ -268,7 +268,8 @@ type MaybeUpdatePropsType = {
|
||||||
conversation: ConversationModelType;
|
conversation: ConversationModelType;
|
||||||
groupChangeBase64?: string;
|
groupChangeBase64?: string;
|
||||||
newRevision?: number;
|
newRevision?: number;
|
||||||
timestamp?: number;
|
receivedAt?: number;
|
||||||
|
sentAt?: number;
|
||||||
dropInitialJoinMessage?: boolean;
|
dropInitialJoinMessage?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -294,10 +295,11 @@ export async function waitThenMaybeUpdateGroup(options: MaybeUpdatePropsType) {
|
||||||
|
|
||||||
export async function maybeUpdateGroup({
|
export async function maybeUpdateGroup({
|
||||||
conversation,
|
conversation,
|
||||||
|
dropInitialJoinMessage,
|
||||||
groupChangeBase64,
|
groupChangeBase64,
|
||||||
newRevision,
|
newRevision,
|
||||||
timestamp,
|
receivedAt,
|
||||||
dropInitialJoinMessage,
|
sentAt,
|
||||||
}: MaybeUpdatePropsType) {
|
}: MaybeUpdatePropsType) {
|
||||||
const logId = conversation.idForLogging();
|
const logId = conversation.idForLogging();
|
||||||
|
|
||||||
|
@ -321,8 +323,8 @@ export async function maybeUpdateGroup({
|
||||||
|
|
||||||
// Ensure that all generated message are ordered properly. Before the provided timestamp
|
// Ensure that all generated message are ordered properly. Before the provided timestamp
|
||||||
// so update messages appear before the initiating message, or after now().
|
// so update messages appear before the initiating message, or after now().
|
||||||
let syntheticTimestamp = timestamp
|
let syntheticTimestamp = receivedAt
|
||||||
? timestamp - (groupChangeMessages.length + 1)
|
? receivedAt - (groupChangeMessages.length + 1)
|
||||||
: Date.now();
|
: Date.now();
|
||||||
// Save all synthetic messages describing group changes
|
// Save all synthetic messages describing group changes
|
||||||
const changeMessagesToSave = groupChangeMessages.map(changeMessage => {
|
const changeMessagesToSave = groupChangeMessages.map(changeMessage => {
|
||||||
|
@ -333,6 +335,7 @@ export async function maybeUpdateGroup({
|
||||||
...changeMessage,
|
...changeMessage,
|
||||||
conversationId: conversation.id,
|
conversationId: conversation.id,
|
||||||
received_at: syntheticTimestamp,
|
received_at: syntheticTimestamp,
|
||||||
|
sent_at: sentAt,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue