Stories: Fix sender key persistence, pipe story: true into sends

This commit is contained in:
Scott Nonnenberg 2022-09-30 09:59:36 -07:00 committed by GitHub
parent 67c706a7ef
commit 2b2594c20a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 76 additions and 30 deletions

View file

@ -134,6 +134,8 @@ export default class OutgoingMessage {
urgent: boolean;
story?: boolean;
recipients: Record<string, Array<number>>;
sendLogCallback?: SendLogCallbackType;
@ -147,6 +149,7 @@ export default class OutgoingMessage {
options,
sendLogCallback,
server,
story,
timestamp,
urgent,
}: {
@ -158,6 +161,7 @@ export default class OutgoingMessage {
options?: OutgoingMessageOptionsType;
sendLogCallback?: SendLogCallbackType;
server: WebAPIType;
story?: boolean;
timestamp: number;
urgent: boolean;
}) {
@ -175,6 +179,7 @@ export default class OutgoingMessage {
this.contentHint = contentHint;
this.groupId = groupId;
this.callback = callback;
this.story = story;
this.urgent = urgent;
this.identifiersCompleted = 0;
@ -310,11 +315,17 @@ export default class OutgoingMessage {
identifier,
jsonData,
timestamp,
{ accessKey, online: this.online, urgent: this.urgent }
{
accessKey,
online: this.online,
story: this.story,
urgent: this.urgent,
}
);
} else {
promise = this.server.sendMessages(identifier, jsonData, timestamp, {
online: this.online,
story: this.story,
urgent: this.urgent,
});
}

View file

@ -1203,6 +1203,7 @@ export default class MessageSender {
proto,
recipients,
sendLogCallback,
story,
timestamp,
urgent,
}: Readonly<{
@ -1213,6 +1214,7 @@ export default class MessageSender {
proto: Proto.Content | Proto.DataMessage | PlaintextContent;
recipients: ReadonlyArray<string>;
sendLogCallback?: SendLogCallbackType;
story?: boolean;
timestamp: number;
urgent: boolean;
}>): void {
@ -1233,6 +1235,7 @@ export default class MessageSender {
options,
sendLogCallback,
server: this.server,
story,
timestamp,
urgent,
});
@ -2220,6 +2223,7 @@ export default class MessageSender {
proto,
recipients,
sendLogCallback,
story,
timestamp = Date.now(),
urgent,
}: Readonly<{
@ -2229,6 +2233,7 @@ export default class MessageSender {
proto: Proto.Content;
recipients: ReadonlyArray<string>;
sendLogCallback?: SendLogCallbackType;
story?: boolean;
timestamp: number;
urgent: boolean;
}>): Promise<CallbackResultType> {
@ -2269,6 +2274,7 @@ export default class MessageSender {
proto,
recipients: identifiers,
sendLogCallback,
story,
timestamp,
urgent,
});
@ -2341,6 +2347,7 @@ export default class MessageSender {
groupId,
identifiers,
throwIfNotInDatabase,
story,
urgent,
}: Readonly<{
contentHint: number;
@ -2348,6 +2355,7 @@ export default class MessageSender {
groupId: string | undefined;
identifiers: ReadonlyArray<string>;
throwIfNotInDatabase?: boolean;
story?: boolean;
urgent: boolean;
}>,
options?: Readonly<SendOptionsType>
@ -2380,6 +2388,7 @@ export default class MessageSender {
proto: contentMessage,
recipients: identifiers,
sendLogCallback,
story,
timestamp,
urgent,
});

View file

@ -917,13 +917,18 @@ export type WebAPIType = {
destination: string,
messageArray: ReadonlyArray<MessageType>,
timestamp: number,
options: { online?: boolean; urgent?: boolean }
options: { online?: boolean; story?: boolean; urgent?: boolean }
) => Promise<void>;
sendMessagesUnauth: (
destination: string,
messageArray: ReadonlyArray<MessageType>,
timestamp: number,
options: { accessKey?: string; online?: boolean; urgent?: boolean }
options: {
accessKey?: string;
online?: boolean;
story?: boolean;
urgent?: boolean;
}
) => Promise<void>;
sendWithSenderKey: (
payload: Uint8Array,
@ -2084,12 +2089,19 @@ export function initialize({
accessKey,
online,
urgent = true,
}: { accessKey?: string; online?: boolean; urgent?: boolean }
story = false,
}: {
accessKey?: string;
online?: boolean;
story?: boolean;
urgent?: boolean;
}
) {
const jsonData = {
messages,
timestamp,
online: Boolean(online),
story,
urgent,
};
@ -2108,12 +2120,17 @@ export function initialize({
destination: string,
messages: ReadonlyArray<MessageType>,
timestamp: number,
{ online, urgent = true }: { online?: boolean; urgent?: boolean }
{
online,
urgent = true,
story = false,
}: { online?: boolean; story?: boolean; urgent?: boolean }
) {
const jsonData = {
messages,
timestamp,
online: Boolean(online),
story,
urgent,
};