[IMP] mail: rename discuss legacy dialog component in code

Code part of renaming discuss legacy dialog.
In preparation to using dialog modelling.

Task-2738648

Part-of: odoo/odoo#83522
This commit is contained in:
Alexandre Kühn
2022-01-27 18:03:36 +00:00
parent d35946e845
commit 51c0dff6d5
16 changed files with 64 additions and 64 deletions
@@ -297,17 +297,17 @@ QUnit.test('remove attachment should ask for confirmation', async function (asse
await afterNextRender(() => document.querySelector('.o_AttachmentCard_asideItemUnlink').click());
assert.containsOnce(
document.body,
'.o_AttachmentDeleteConfirmDialog',
'.o_AttachmentDeleteConfirm',
"A confirmation dialog should have been opened"
);
assert.strictEqual(
document.querySelector('.o_AttachmentDeleteConfirmDialog_mainText').textContent,
document.querySelector('.o_AttachmentDeleteConfirm_mainText').textContent,
`Do you really want to delete "Blah.txt"?`,
"Confirmation dialog should contain the attachment delete confirmation text"
);
// Confirm the deletion
await afterNextRender(() => document.querySelector('.o_AttachmentDeleteConfirmDialog_confirmButton').click());
await afterNextRender(() => document.querySelector('.o_AttachmentDeleteConfirm_confirmButton').click());
assert.containsNone(
document.body,
'.o_AttachmentCard',
@@ -57,7 +57,7 @@
</div>
</t>
<t t-if="attachmentCard.hasDeleteConfirmDialog">
<AttachmentDeleteConfirmDialog
<AttachmentDeleteConfirm
attachmentLocalId="attachmentCard.attachment.localId"
onAttachmentRemoved="props.onAttachmentRemoved"
onClosed="attachmentCard.onDeleteConfirmDialogClosed"
@@ -6,7 +6,7 @@ import Dialog from 'web.OwlDialog';
const { Component, escape } = owl;
export class AttachmentDeleteConfirmDialog extends Component {
export class AttachmentDeleteConfirm extends Component {
//--------------------------------------------------------------------------
// Public
@@ -62,7 +62,7 @@ export class AttachmentDeleteConfirmDialog extends Component {
}
Object.assign(AttachmentDeleteConfirmDialog, {
Object.assign(AttachmentDeleteConfirm, {
components: { Dialog },
props: {
attachmentLocalId: String,
@@ -75,7 +75,7 @@ Object.assign(AttachmentDeleteConfirmDialog, {
optional: true,
}
},
template: 'mail.AttachmentDeleteConfirmDialog',
template: 'mail.AttachmentDeleteConfirm',
});
registerMessagingComponent(AttachmentDeleteConfirmDialog);
registerMessagingComponent(AttachmentDeleteConfirm);
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<t t-name="mail.AttachmentDeleteConfirmDialog" owl="1">
<Dialog contentClass="'o_AttachmentDeleteConfirmDialog'" title="getTitle()" size="'medium'" onClosed="props.onClosed" t-ref="root">
<p class="o_AttachmentDeleteConfirmDialog_mainText" t-esc="getBody()"/>
<t t-name="mail.AttachmentDeleteConfirm" owl="1">
<Dialog contentClass="'o_AttachmentDeleteConfirm'" title="getTitle()" size="'medium'" onClosed="props.onClosed" t-ref="root">
<p class="o_AttachmentDeleteConfirm_mainText" t-esc="getBody()"/>
<t t-set-slot="buttons">
<button class="o_AttachmentDeleteConfirmDialog_confirmButton btn btn-primary" t-on-click="_onClickOk">Ok</button>
<button class="o_AttachmentDeleteConfirmDialog_cancelButton btn btn-secondary" t-on-click="_onClickCancel">Cancel</button>
<button class="o_AttachmentDeleteConfirm_confirmButton btn btn-primary" t-on-click="_onClickOk">Ok</button>
<button class="o_AttachmentDeleteConfirm_cancelButton btn btn-secondary" t-on-click="_onClickCancel">Cancel</button>
</t>
</Dialog>
</t>
@@ -32,7 +32,7 @@
</div>
</div>
<t t-if="attachmentImage.hasDeleteConfirmDialog">
<AttachmentDeleteConfirmDialog
<AttachmentDeleteConfirm
attachmentLocalId="attachmentImage.attachment.localId"
onAttachmentRemoved="props.onAttachmentRemoved"
onClosed="attachmentImage.onDeleteConfirmDialogClosed"
@@ -299,9 +299,9 @@ QUnit.test('clicking on the delete attachment button multiple times should do th
});
await afterNextRender(() => {
document.querySelector('.o_AttachmentDeleteConfirmDialog_confirmButton').click();
document.querySelector('.o_AttachmentDeleteConfirmDialog_confirmButton').click();
document.querySelector('.o_AttachmentDeleteConfirmDialog_confirmButton').click();
document.querySelector('.o_AttachmentDeleteConfirm_confirmButton').click();
document.querySelector('.o_AttachmentDeleteConfirm_confirmButton').click();
document.querySelector('.o_AttachmentDeleteConfirm_confirmButton').click();
});
assert.verifySteps(
['attachment_unlink'],
@@ -6,7 +6,7 @@ import Dialog from 'web.OwlDialog';
const { Component } = owl;
export class DeleteMessageConfirmDialog extends Component {
export class DeleteMessageConfirm extends Component {
/**
* @override
@@ -24,14 +24,14 @@ export class DeleteMessageConfirmDialog extends Component {
}
}
Object.assign(DeleteMessageConfirmDialog, {
Object.assign(DeleteMessageConfirm, {
components: {
Dialog,
},
props: {
localId: String,
},
template: 'mail.DeleteMessageConfirmDialog',
template: 'mail.DeleteMessageConfirm',
});
registerMessagingComponent(DeleteMessageConfirmDialog);
registerMessagingComponent(DeleteMessageConfirm);
@@ -1,3 +1,3 @@
.o_DeleteMessageConfirmDialog_blockquote {
.o_DeleteMessageConfirm_blockquote {
font-style: normal;
}
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<t t-name="mail.DeleteMessageConfirmDialog" owl="1">
<Dialog contentClass="'o_DeleteMessageConfirmDialog ' + className" title="title" onClosed="messageActionList and messageActionList.onDeleteConfirmDialogClosed" t-ref="root">
<t t-name="mail.DeleteMessageConfirm" owl="1">
<Dialog contentClass="'o_DeleteMessageConfirm ' + className" title="title" onClosed="messageActionList and messageActionList.onDeleteConfirmDialogClosed" t-ref="root">
<t t-if="messageActionList">
<p>Are you sure you want to delete this message?</p>
<blockquote class="o_DeleteMessageConfirmDialog_blockquote">
<blockquote class="o_DeleteMessageConfirm_blockquote">
<Message localId="messageActionList.messageViewForDelete.localId"/>
</blockquote>
<small t-if="!messageActionList.message.originThread or messageActionList.message.originThread.model !== 'mail.channel'">Pay attention: The followers of this document who were notified by email will still be able to read the content of this message and reply to it.</small>
@@ -682,17 +682,17 @@ QUnit.test('allow attachment delete on authored message', async function (assert
await afterNextRender(() => document.querySelector('.o_AttachmentImage_actionUnlink').click());
assert.containsOnce(
document.body,
'.o_AttachmentDeleteConfirmDialog',
'.o_AttachmentDeleteConfirm',
"An attachment delete confirmation dialog should have been opened"
);
assert.strictEqual(
document.querySelector('.o_AttachmentDeleteConfirmDialog_mainText').textContent,
document.querySelector('.o_AttachmentDeleteConfirm_mainText').textContent,
`Do you really want to delete "BLAH"?`,
"Confirmation dialog should contain the attachment delete confirmation text"
);
await afterNextRender(() =>
document.querySelector('.o_AttachmentDeleteConfirmDialog_confirmButton').click()
document.querySelector('.o_AttachmentDeleteConfirm_confirmButton').click()
);
assert.containsNone(
document.body,
@@ -14,7 +14,7 @@
<span t-if="messageActionList.hasMarkAsReadIcon" class="o_MessageActionList_action o_MessageActionList_actionMarkRead p-2 fa fa-lg fa-check" title="Mark as Read" t-on-click="messageActionList.onClickMarkAsRead"/>
<span t-if="messageActionList.message.canBeDeleted" class="o_MessageActionList_action o_MessageActionList_actionEdit p-2 fa fa-lg fa-pencil" title="Edit" t-on-click="messageActionList.onClickEdit"/>
<span t-if="messageActionList.message.canBeDeleted" class="o_MessageActionList_action o_MessageActionList_actionDelete p-2 fa fa-lg fa-trash" title="Delete" t-on-click="messageActionList.onClickDelete"/>
<DeleteMessageConfirmDialog t-if="messageActionList.showDeleteConfirm" localId="messageActionList.localId"/>
<DeleteMessageConfirm t-if="messageActionList.showDeleteConfirm" localId="messageActionList.localId"/>
</t>
</div>
</t>
@@ -1019,7 +1019,7 @@ QUnit.test("delete all attachments of message without content should no longer d
}"] .o_AttachmentCard_asideItemUnlink`).click();
});
await afterNextRender(() =>
document.querySelector('.o_AttachmentDeleteConfirmDialog_confirmButton').click()
document.querySelector('.o_AttachmentDeleteConfirm_confirmButton').click()
);
assert.containsNone(
document.body,
@@ -1079,7 +1079,7 @@ QUnit.test('delete all attachments of a message with some text content should st
}"] .o_AttachmentCard_asideItemUnlink`).click();
});
await afterNextRender(() =>
document.querySelector('.o_AttachmentDeleteConfirmDialog_confirmButton').click()
document.querySelector('.o_AttachmentDeleteConfirm_confirmButton').click()
);
assert.containsOnce(
document.body,
@@ -1146,7 +1146,7 @@ QUnit.test('delete all attachments of a message with tracking fields should stil
}"] .o_AttachmentCard_asideItemUnlink`).click();
});
await afterNextRender(() =>
document.querySelector('.o_AttachmentDeleteConfirmDialog_confirmButton').click()
document.querySelector('.o_AttachmentDeleteConfirm_confirmButton').click()
);
assert.containsOnce(
document.body,
@@ -18,7 +18,7 @@
<xpath expr="//*[@name='rootCondition']" position="inside">
<t t-if="snailmailState.hasDialog">
<SnailmailErrorDialog messageLocalId="messageView.message.localId" onClosed="_onDialogClosedSnailmailError"/>
<SnailmailError messageLocalId="messageView.message.localId" onClosed="_onDialogClosedSnailmailError"/>
</t>
</xpath>
@@ -324,26 +324,26 @@ QUnit.test('No Price Available', async function (assert) {
});
assert.containsOnce(
document.body,
'.o_SnailmailErrorDialog',
'.o_SnailmailError',
"error dialog should be open"
);
assert.containsOnce(
document.body,
'.o_SnailmailErrorDialog_contentPrice',
'.o_SnailmailError_contentPrice',
"error dialog should have the 'no price' content"
);
assert.containsOnce(
document.body,
'.o_SnailmailErrorDialog_cancelLetterButton',
'.o_SnailmailError_cancelLetterButton',
"dialog should have a 'Cancel letter' button"
);
await afterNextRender(() => {
document.querySelector('.o_SnailmailErrorDialog_cancelLetterButton').click();
document.querySelector('.o_SnailmailError_cancelLetterButton').click();
});
assert.containsNone(
document.body,
'.o_SnailmailErrorDialog',
'.o_SnailmailError',
"dialog should be closed after click on 'Cancel letter'"
);
assert.verifySteps(
@@ -416,31 +416,31 @@ QUnit.test('Credit Error', async function (assert) {
});
assert.containsOnce(
document.body,
'.o_SnailmailErrorDialog',
'.o_SnailmailError',
"error dialog should be open"
);
assert.containsOnce(
document.body,
'.o_SnailmailErrorDialog_contentCredit',
'.o_SnailmailError_contentCredit',
"error dialog should have the 'credit' content"
);
assert.containsOnce(
document.body,
'.o_SnailmailErrorDialog_resendLetterButton',
'.o_SnailmailError_resendLetterButton',
"dialog should have a 'Re-send letter' button"
);
assert.containsOnce(
document.body,
'.o_SnailmailErrorDialog_cancelLetterButton',
'.o_SnailmailError_cancelLetterButton',
"dialog should have a 'Cancel letter' button"
);
await afterNextRender(() => {
document.querySelector('.o_SnailmailErrorDialog_resendLetterButton').click();
document.querySelector('.o_SnailmailError_resendLetterButton').click();
});
assert.containsNone(
document.body,
'.o_SnailmailErrorDialog',
'.o_SnailmailError',
"dialog should be closed after click on 'Re-send letter'"
);
assert.verifySteps(
@@ -513,31 +513,31 @@ QUnit.test('Trial Error', async function (assert) {
});
assert.containsOnce(
document.body,
'.o_SnailmailErrorDialog',
'.o_SnailmailError',
"error dialog should be open"
);
assert.containsOnce(
document.body,
'.o_SnailmailErrorDialog_contentTrial',
'.o_SnailmailError_contentTrial',
"error dialog should have the 'trial' content"
);
assert.containsOnce(
document.body,
'.o_SnailmailErrorDialog_resendLetterButton',
'.o_SnailmailError_resendLetterButton',
"dialog should have a 'Re-send letter' button"
);
assert.containsOnce(
document.body,
'.o_SnailmailErrorDialog_cancelLetterButton',
'.o_SnailmailError_cancelLetterButton',
"dialog should have a 'Cancel letter' button"
);
await afterNextRender(() => {
document.querySelector('.o_SnailmailErrorDialog_resendLetterButton').click();
document.querySelector('.o_SnailmailError_resendLetterButton').click();
});
assert.containsNone(
document.body,
'.o_SnailmailErrorDialog',
'.o_SnailmailError',
"dialog should be closed after click on 'Re-send letter'"
);
assert.verifySteps(
@@ -6,7 +6,7 @@ import Dialog from 'web.OwlDialog';
const { Component } = owl;
class SnailmailErrorDialog extends Component {
class SnailmailError extends Component {
//--------------------------------------------------------------------------
// Public
@@ -73,7 +73,7 @@ class SnailmailErrorDialog extends Component {
}
Object.assign(SnailmailErrorDialog, {
Object.assign(SnailmailError, {
components: { Dialog },
props: {
messageLocalId: String,
@@ -82,9 +82,9 @@ Object.assign(SnailmailErrorDialog, {
optional: true,
},
},
template: 'snailmail.SnailmailErrorDialog',
template: 'snailmail.SnailmailError',
});
registerMessagingComponent(SnailmailErrorDialog);
registerMessagingComponent(SnailmailError);
export default SnailmailErrorDialog;
export default SnailmailError;
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<t t-name="snailmail.SnailmailErrorDialog" owl="1">
<Dialog contentClass="'o_SnailmailErrorDialog'" title="title" size="'medium'" onClosed="props.onClosed" t-ref="root">
<t t-name="snailmail.SnailmailError" owl="1">
<Dialog contentClass="'o_SnailmailError'" title="title" size="'medium'" onClosed="props.onClosed" t-ref="root">
<t t-if="message and notification">
<t t-if="notification.failure_type === 'sn_credit'">
<p class="o_SnailmailErrorDialog_contentCredit">
<p class="o_SnailmailError_contentCredit">
The letter could not be sent due to insufficient credits on your IAP account.
</p>
<t t-if="messaging.snailmail_credits_url">
@@ -17,7 +17,7 @@
</t>
</t>
<t t-elif="notification.failure_type === 'sn_trial'">
<p class="o_SnailmailErrorDialog_contentTrial">
<p class="o_SnailmailError_contentTrial">
You need credits on your IAP account to send a letter.
</p>
<t t-if="messaging.snailmail_credits_url_trial">
@@ -29,21 +29,21 @@
</t>
</t>
<t t-elif="notification.failure_type === 'sn_price'">
<p class="o_SnailmailErrorDialog_contentPrice">
<p class="o_SnailmailError_contentPrice">
The country to which you want to send the letter is not supported by our service.
</p>
</t>
<t t-elif="notification.failure_type === 'sn_error'">
<p class="o_SnailmailErrorDialog_contentError">
<p class="o_SnailmailError_contentError">
An unknown error occurred. Please contact our <a href="https://www.odoo.com/help" target="new">support</a> for further assistance.
</p>
</t>
<t t-set-slot="buttons">
<t t-if="hasCreditsError">
<button class="o_SnailmailErrorDialog_resendLetterButton btn btn-primary" t-on-click="_onClickResendLetter">Re-send letter</button>
<button class="o_SnailmailError_resendLetterButton btn btn-primary" t-on-click="_onClickResendLetter">Re-send letter</button>
</t>
<button class="o_SnailmailErrorDialog_cancelLetterButton btn"
<button class="o_SnailmailError_cancelLetterButton btn"
t-att-class="{
'btn-primary': !hasCreditsError,
'btn-secondary': hasCreditsError,
@@ -52,7 +52,7 @@
>
Cancel letter
</button>
<button class="o_SnailmailErrorDialog_closeButton btn btn-secondary" t-on-click="_onClickClose">Close</button>
<button class="o_SnailmailError_closeButton btn btn-secondary" t-on-click="_onClickClose">Close</button>
</t>
</t>
</Dialog>