Reload conversation messages on merge
This commit is contained in:
parent
801dea2969
commit
f8978328a8
2 changed files with 118 additions and 63 deletions
|
@ -1120,13 +1120,19 @@ export class ConversationController {
|
||||||
this._conversations.resetLookups();
|
this._conversations.resetLookups();
|
||||||
|
|
||||||
current.captureChange('combineConversations');
|
current.captureChange('combineConversations');
|
||||||
void current.updateLastMessage();
|
drop(current.updateLastMessage());
|
||||||
|
|
||||||
|
const state = window.reduxStore.getState();
|
||||||
|
if (state.conversations.selectedConversationId === current.id) {
|
||||||
|
// TODO: DESKTOP-4807
|
||||||
|
drop(current.loadNewestMessages(undefined, undefined));
|
||||||
|
}
|
||||||
|
|
||||||
const titleIsUseful = Boolean(
|
const titleIsUseful = Boolean(
|
||||||
obsoleteTitleInfo && getTitleNoDefault(obsoleteTitleInfo)
|
obsoleteTitleInfo && getTitleNoDefault(obsoleteTitleInfo)
|
||||||
);
|
);
|
||||||
if (!fromPniSignature && obsoleteTitleInfo && titleIsUseful) {
|
if (!fromPniSignature && obsoleteTitleInfo && titleIsUseful) {
|
||||||
void current.addConversationMerge(obsoleteTitleInfo);
|
drop(current.addConversationMerge(obsoleteTitleInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
log.warn(`${logId}: Complete!`);
|
log.warn(`${logId}: Complete!`);
|
||||||
|
|
|
@ -99,21 +99,38 @@ describe('pnp/merge', function needsName() {
|
||||||
await bootstrap.teardown();
|
await bootstrap.teardown();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('happens via storage service, with notification', async () => {
|
for (const finalContact of [UUIDKind.ACI, UUIDKind.PNI]) {
|
||||||
|
// eslint-disable-next-line no-loop-func
|
||||||
|
it(`happens via storage service, with notification (${finalContact})`, async () => {
|
||||||
const { phone } = bootstrap;
|
const { phone } = bootstrap;
|
||||||
|
|
||||||
const window = await app.getWindow();
|
const window = await app.getWindow();
|
||||||
|
|
||||||
debug('opening conversation with the pni contact');
|
|
||||||
{
|
|
||||||
const leftPane = window.locator('.left-pane-wrapper');
|
const leftPane = window.locator('.left-pane-wrapper');
|
||||||
|
|
||||||
|
debug('opening conversation with the aci contact');
|
||||||
|
await leftPane
|
||||||
|
.locator('_react=ConversationListItem[title = "ACI Contact"]')
|
||||||
|
.click();
|
||||||
|
|
||||||
|
await window.locator('.module-conversation-hero').waitFor();
|
||||||
|
|
||||||
|
debug('Send message to ACI');
|
||||||
|
{
|
||||||
|
const composeArea = window.locator(
|
||||||
|
'.composition-area-wrapper, .conversation .ConversationView'
|
||||||
|
);
|
||||||
|
const compositionInput = composeArea.locator('_react=CompositionInput');
|
||||||
|
|
||||||
|
await compositionInput.type('Hello ACI');
|
||||||
|
await compositionInput.press('Enter');
|
||||||
|
}
|
||||||
|
|
||||||
|
debug('opening conversation with the pni contact');
|
||||||
await leftPane
|
await leftPane
|
||||||
.locator('_react=ConversationListItem[title = "PNI Contact"]')
|
.locator('_react=ConversationListItem[title = "PNI Contact"]')
|
||||||
.click();
|
.click();
|
||||||
|
|
||||||
await window.locator('.module-conversation-hero').waitFor();
|
await window.locator('.module-conversation-hero').waitFor();
|
||||||
}
|
|
||||||
|
|
||||||
debug('Verify starting state');
|
debug('Verify starting state');
|
||||||
{
|
{
|
||||||
|
@ -123,7 +140,31 @@ describe('pnp/merge', function needsName() {
|
||||||
|
|
||||||
// No notifications
|
// No notifications
|
||||||
const notifications = window.locator('.SystemMessage');
|
const notifications = window.locator('.SystemMessage');
|
||||||
assert.strictEqual(await notifications.count(), 0, 'notification count');
|
assert.strictEqual(
|
||||||
|
await notifications.count(),
|
||||||
|
0,
|
||||||
|
'notification count'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
debug('Send message to PNI');
|
||||||
|
{
|
||||||
|
const composeArea = window.locator(
|
||||||
|
'.composition-area-wrapper, .conversation .ConversationView'
|
||||||
|
);
|
||||||
|
const compositionInput = composeArea.locator('_react=CompositionInput');
|
||||||
|
|
||||||
|
await compositionInput.type('Hello PNI');
|
||||||
|
await compositionInput.press('Enter');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (finalContact === UUIDKind.ACI) {
|
||||||
|
debug('switching back to ACI conversation');
|
||||||
|
await leftPane
|
||||||
|
.locator('_react=ConversationListItem[title = "ACI Contact"]')
|
||||||
|
.click();
|
||||||
|
|
||||||
|
await window.locator('.module-conversation-hero').waitFor();
|
||||||
}
|
}
|
||||||
|
|
||||||
debug(
|
debug(
|
||||||
|
@ -161,13 +202,20 @@ describe('pnp/merge', function needsName() {
|
||||||
|
|
||||||
debug('Verify final state');
|
debug('Verify final state');
|
||||||
{
|
{
|
||||||
// No messages
|
// Should have both PNI and ACI messages
|
||||||
|
await window.locator('.module-message__text >> "Hello ACI"').waitFor();
|
||||||
|
await window.locator('.module-message__text >> "Hello PNI"').waitFor();
|
||||||
|
|
||||||
const messages = window.locator('.module-message__text');
|
const messages = window.locator('.module-message__text');
|
||||||
assert.strictEqual(await messages.count(), 0, 'message count');
|
assert.strictEqual(await messages.count(), 2, 'message count');
|
||||||
|
|
||||||
// One notification - the merge
|
// One notification - the merge
|
||||||
const notifications = window.locator('.SystemMessage');
|
const notifications = window.locator('.SystemMessage');
|
||||||
assert.strictEqual(await notifications.count(), 1, 'notification count');
|
assert.strictEqual(
|
||||||
|
await notifications.count(),
|
||||||
|
1,
|
||||||
|
'notification count'
|
||||||
|
);
|
||||||
|
|
||||||
const first = await notifications.first();
|
const first = await notifications.first();
|
||||||
assert.match(
|
assert.match(
|
||||||
|
@ -176,4 +224,5 @@ describe('pnp/merge', function needsName() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue