Remove accepted message without explicit user action

This commit is contained in:
Jamie Kyle 2024-03-15 12:11:48 -07:00 committed by GitHub
parent 8a21f8655f
commit 11ea595457
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 28 additions and 39 deletions

View file

@ -2163,11 +2163,15 @@ export class ConversationModel extends window.Backbone
if (didResponseChange) {
if (response === messageRequestEnum.ACCEPT) {
drop(
this.addMessageRequestResponseEventMessage(
MessageRequestResponseEvent.ACCEPT
)
);
// Only add a message when the user took an explicit action to accept
// the message request on one of their devices
if (!viaStorageServiceSync) {
drop(
this.addMessageRequestResponseEventMessage(
MessageRequestResponseEvent.ACCEPT
)
);
}
}
if (
response === messageRequestEnum.BLOCK ||

View file

@ -114,7 +114,7 @@ Bootstrap.benchmark(async (bootstrap: Bootstrap): Promise<void> => {
const item = leftPane
.locator(
'.module-conversation-list__item--contact-or-conversation' +
'>> text="You accepted the message request"'
`>> text="${LAST_MESSAGE}"`
)
.first();
await item.click({ timeout: 2 * MINUTE });

View file

@ -149,7 +149,7 @@ describe('pnp/merge', function (this: Mocha.Suite) {
assert.strictEqual(await messages.count(), 0, 'message count');
await expectSystemMessages(window, [
'You accepted the message request',
// none
]);
}
@ -210,21 +210,16 @@ describe('pnp/merge', function (this: Mocha.Suite) {
if (withPNIMessage) {
if (pniSignatureVerified) {
await expectSystemMessages(window, [
'You accepted the message request',
'You accepted the message request',
/Your message history with ACI Contact and their number .* has been merged\./,
]);
} else {
await expectSystemMessages(window, [
'You accepted the message request',
'You accepted the message request',
/Your message history with ACI Contact and their number .* has been merged\./,
]);
}
} else {
await expectSystemMessages(window, [
'You accepted the message request',
'You accepted the message request',
// none
]);
}
}

View file

@ -144,10 +144,7 @@ describe('pnp/phone discovery', function (this: Mocha.Suite) {
const messages = window.locator('.module-message__text');
assert.strictEqual(await messages.count(), 1, 'message count');
await expectSystemMessages(window, [
'You accepted the message request',
/.* belongs to ACI Contact/,
]);
await expectSystemMessages(window, [/.* belongs to ACI Contact/]);
}
});
});

View file

@ -96,9 +96,9 @@ describe('pnp/PNI Change', function (this: Mocha.Suite) {
// No messages
const messages = window.locator('.module-message__text');
assert.strictEqual(await messages.count(), 0, 'message count');
// No notifications
await expectSystemMessages(window, ['You accepted the message request']);
await expectSystemMessages(window, [
// none
]);
}
debug('Send message to contactA');
@ -165,10 +165,7 @@ describe('pnp/PNI Change', function (this: Mocha.Suite) {
assert.strictEqual(await messages.count(), 1, 'message count');
// Only a PhoneNumberDiscovery notification
await expectSystemMessages(window, [
'You accepted the message request',
/.* belongs to ContactA/,
]);
await expectSystemMessages(window, [/.* belongs to ContactA/]);
}
});
@ -198,7 +195,9 @@ describe('pnp/PNI Change', function (this: Mocha.Suite) {
const messages = window.locator('.module-message__text');
assert.strictEqual(await messages.count(), 0, 'message count');
await expectSystemMessages(window, ['You accepted the message request']);
await expectSystemMessages(window, [
// 'You accepted the message request'
]);
}
debug('Send message to contactA');
@ -266,7 +265,6 @@ describe('pnp/PNI Change', function (this: Mocha.Suite) {
// Two notifications - the safety number change and PhoneNumberDiscovery
await expectSystemMessages(window, [
'You accepted the message request',
/.* belongs to ContactA/,
/Safety Number has changed/,
]);
@ -299,7 +297,9 @@ describe('pnp/PNI Change', function (this: Mocha.Suite) {
const messages = window.locator('.module-message__text');
assert.strictEqual(await messages.count(), 0, 'message count');
await expectSystemMessages(window, ['You accepted the message request']);
await expectSystemMessages(window, [
// none
]);
}
debug('Send message to contactA');
@ -397,7 +397,6 @@ describe('pnp/PNI Change', function (this: Mocha.Suite) {
// Three notifications - accepted, the safety number change and PhoneNumberDiscovery
await expectSystemMessages(window, [
'You accepted the message request',
/.* belongs to ContactA/,
/Safety Number has changed/,
]);
@ -429,9 +428,9 @@ describe('pnp/PNI Change', function (this: Mocha.Suite) {
// No messages
const messages = window.locator('.module-message__text');
assert.strictEqual(await messages.count(), 0, 'message count');
// No notifications
await expectSystemMessages(window, ['You accepted the message request']);
await expectSystemMessages(window, [
// none
]);
}
debug('Send message to contactA');
@ -551,10 +550,7 @@ describe('pnp/PNI Change', function (this: Mocha.Suite) {
assert.strictEqual(await messages.count(), 2, 'message count');
// Only a PhoneNumberDiscovery notification
await expectSystemMessages(window, [
'You accepted the message request',
/.* belongs to ContactA/,
]);
await expectSystemMessages(window, [/.* belongs to ContactA/]);
}
});
});

View file

@ -423,10 +423,7 @@ describe('pnp/PNI Signature', function (this: Mocha.Suite) {
assert.strictEqual(await messages.count(), 3, 'messages');
// Title transition notification
await expectSystemMessages(window, [
'You accepted the message request',
/You started this chat with/,
]);
await expectSystemMessages(window, [/You started this chat with/]);
assert.isEmpty(await phone.getOrphanedStorageKeys());
}