Skip to content

Commit e519690

Browse files
author
Thomas Belin
authored
runfix(core): Revert changes to sending regular ping messages (#12048)
1 parent e585a99 commit e519690

File tree

3 files changed

+40
-13
lines changed

3 files changed

+40
-13
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"dependencies": {
33
"@wireapp/antiscroll-2": "1.0.2",
44
"@wireapp/avs": "7.2.91",
5-
"@wireapp/core": "17.20.0",
5+
"@wireapp/core": "17.20.2",
66
"@wireapp/react-ui-kit": "7.54.0",
77
"@wireapp/store-engine-dexie": "1.6.7",
88
"@wireapp/store-engine-sqleet": "1.7.11",

src/script/conversation/MessageRepository.ts

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
Ephemeral,
2828
External,
2929
GenericMessage,
30+
Knock,
3031
LastRead,
3132
LegalHoldStatus,
3233
MessageDelete,
@@ -223,16 +224,42 @@ export class MessageRepository {
223224
* @returns Resolves after sending the knock
224225
*/
225226
public async sendPing(conversation: Conversation): Promise<void> {
226-
const ping = this.core.service!.conversation.messageBuilder.createPing({
227-
conversationId: conversation.id,
228-
ping: {
229-
expectsReadConfirmation: this.expectReadReceipt(conversation),
230-
hotKnock: false,
231-
legalHoldStatus: conversation.legalHoldStatus(),
232-
},
227+
if (conversation.isFederated()) {
228+
const ping = this.core.service!.conversation.messageBuilder.createPing({
229+
conversationId: conversation.id,
230+
ping: {
231+
expectsReadConfirmation: this.expectReadReceipt(conversation),
232+
hotKnock: false,
233+
legalHoldStatus: conversation.legalHoldStatus(),
234+
},
235+
});
236+
237+
this.sendAndInjectGenericCoreMessage(ping, conversation, {playPingAudio: true});
238+
}
239+
const protoKnock = new Knock({
240+
[PROTO_MESSAGE_TYPE.EXPECTS_READ_CONFIRMATION]: this.expectReadReceipt(conversation),
241+
[PROTO_MESSAGE_TYPE.LEGAL_HOLD_STATUS]: conversation.legalHoldStatus(),
242+
hotKnock: false,
243+
});
244+
245+
let genericMessage = new GenericMessage({
246+
[GENERIC_MESSAGE_TYPE.KNOCK]: protoKnock,
247+
messageId: createRandomUuid(),
233248
});
234249

235-
this.sendAndInjectGenericCoreMessage(ping, conversation, {playPingAudio: true});
250+
if (conversation.messageTimer()) {
251+
genericMessage = this.wrapInEphemeralMessage(genericMessage, conversation.messageTimer());
252+
}
253+
254+
try {
255+
await this._sendAndInjectGenericMessage(conversation, genericMessage);
256+
} catch (error) {
257+
if (!this.isUserCancellationError(error)) {
258+
this.logger.error(`Error while sending knock: ${error.message}`, error);
259+
throw error;
260+
}
261+
}
262+
return undefined;
236263
}
237264

238265
/**

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2964,10 +2964,10 @@
29642964
logdown "3.3.1"
29652965
rimraf "3.0.2"
29662966

2967-
"@wireapp/[email protected].0":
2968-
version "17.20.0"
2969-
resolved "https://registry.yarnpkg.com/@wireapp/core/-/core-17.20.0.tgz#ed26b22c997cb9992fbf54b2c42533364d35659a"
2970-
integrity sha512-Bot7Rd0IuAC0ckQZAEbgMhkfRe2WP1j0XahXURS6V/T0cb4DtZG0uZEO67fib6axkQnbZUHhL0ai0CPE5JVT4g==
2967+
"@wireapp/[email protected].2":
2968+
version "17.20.2"
2969+
resolved "https://registry.yarnpkg.com/@wireapp/core/-/core-17.20.2.tgz#9d5a31dd0659540e5d8b0adb7f7666bdf5c3b12c"
2970+
integrity sha512-wyErqAQO+ucdX4mVeXtsBeKeAWmdC4y+brBdBNr2Za+aSxbiNrM8ieRb5xohutd6Fn4aaIjrAY7i9e2uXowr6g==
29712971
dependencies:
29722972
"@types/long" "4.0.1"
29732973
"@types/node" "~14"

0 commit comments

Comments
 (0)