[IMP] mail, *: pass record instead of local id in props

*: hr_holidays, im_livechat, snailmail, website_livechat

Task-2847927

closes odoo/odoo#90882

Related: odoo/enterprise#27110
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
This commit is contained in:
Alexandre Kühn
2022-05-09 20:58:31 +02:00
parent c962fe4e19
commit da40fedde0
154 changed files with 367 additions and 405 deletions
@@ -11,7 +11,7 @@ QUnit.module('partner_im_status_icon_tests.js', {
beforeEach() {
this.createPartnerImStatusIcon = async (partner, target) => {
await createRootMessagingComponent(partner.env, "PartnerImStatusIcon", {
props: { partnerLocalId: partner.localId },
props: { partner },
target,
});
};
@@ -12,7 +12,7 @@ QUnit.module('thread_icon_tests.js', {
beforeEach() {
this.createThreadIcon = async (thread, target) => {
await createRootMessagingComponent(thread.env, "ThreadIcon", {
props: { threadLocalId: thread.localId },
props: { thread },
target,
});
};
@@ -6,7 +6,7 @@
<t t-if="categoryLivechat and categoryLivechat.categoryItems.length">
<DiscussSidebarCategory
className="'o_DiscussSidebar_category o_DiscussSidebar_categoryLivechat'"
localId="categoryLivechat.localId"
record="categoryLivechat"
/>
</t>
</xpath>
@@ -13,7 +13,7 @@ QUnit.module('thread_icon_tests.js', {
beforeEach() {
this.createThreadIcon = async (thread, target) => {
await createRootMessagingComponent(thread.env, "ThreadIcon", {
props: { threadLocalId: thread.localId },
props: { thread },
target,
});
};
@@ -13,7 +13,7 @@ QUnit.module('thread_textual_typing_status_tests.js', {
beforeEach() {
this.createThreadTextualTypingStatusComponent = async (thread, target) => {
await createRootMessagingComponent(thread.env, "ThreadTextualTypingStatus", {
props: { threadLocalId: thread.localId },
props: { thread },
target,
});
};
@@ -2,7 +2,7 @@
import { clear } from '@mail/model/model_field_command';
const { onWillDestroy, onWillUpdateProps, useComponent } = owl;
const { onWillUpdateProps, useComponent } = owl;
/**
* This hook provides support for saving the reference of the component directly
@@ -11,29 +11,16 @@ const { onWillDestroy, onWillUpdateProps, useComponent } = owl;
*
* @param {Object} param0
* @param {string} param0.fieldName Name of the field on the target record.
* @param {string} param0.modelName Name of the model of the target record.
*/
export function useComponentToModel({ fieldName, modelName }) {
export function useComponentToModel({ fieldName }) {
const component = useComponent();
const { modelManager } = component.env.services.messaging;
const record = modelManager.models[modelName].get(component.props.localId);
if (record) {
record.update({ [fieldName]: component });
}
component.props.record.update({ [fieldName]: component });
onWillUpdateProps(nextProps => {
const currentRecord = modelManager.models[modelName].get(component.props.localId);
const nextRecord = modelManager.models[modelName].get(nextProps.localId);
if (currentRecord && currentRecord !== nextRecord) {
const currentRecord = component.props.record;
const nextRecord = nextProps.record;
if (currentRecord.exists() && currentRecord !== nextRecord) {
currentRecord.update({ [fieldName]: clear() });
}
if (nextRecord) {
nextRecord.update({ [fieldName]: component });
}
});
onWillDestroy(() => {
const record = modelManager.models[modelName].get(component.props.localId);
if (record) {
record.update({ [fieldName]: clear() });
}
nextRecord.update({ [fieldName]: component });
});
}
@@ -2,7 +2,7 @@
import { clear } from '@mail/model/model_field_command';
const { onWillDestroy, onWillUpdateProps, useComponent, useRef } = owl;
const { onWillUpdateProps, useComponent, useRef } = owl;
/**
* This hook provides support for saving the result of useRef directly into the
@@ -11,31 +11,18 @@ const { onWillDestroy, onWillUpdateProps, useComponent, useRef } = owl;
*
* @param {Object} param0
* @param {string} param0.fieldName Name of the field on the target record.
* @param {string} param0.modelName Name of the model of the target record.
* @param {string} param0.refName Name of the t-ref on this component.
*/
export function useRefToModel({ fieldName, modelName, refName }) {
export function useRefToModel({ fieldName, refName }) {
const component = useComponent();
const { modelManager } = component.env.services.messaging;
const record = modelManager.models[modelName].get(component.props.localId);
const ref = useRef(refName);
if (record) {
record.update({ [fieldName]: ref });
}
component.props.record.update({ [fieldName]: ref });
onWillUpdateProps(nextProps => {
const currentRecord = modelManager.models[modelName].get(component.props.localId);
const nextRecord = modelManager.models[modelName].get(nextProps.localId);
if (currentRecord && currentRecord !== nextRecord) {
const currentRecord = component.props.record;
const nextRecord = nextProps.record;
if (currentRecord.exists() && currentRecord !== nextRecord) {
currentRecord.update({ [fieldName]: clear() });
}
if (nextRecord) {
nextRecord.update({ [fieldName]: ref });
}
});
onWillDestroy(() => {
const record = modelManager.models[modelName].get(component.props.localId);
if (record) {
record.update({ [fieldName]: clear() });
}
nextRecord.update({ [fieldName]: ref });
});
}
@@ -10,14 +10,10 @@ const { useComponent } = owl;
*
* @param {Object} param0
* @param {string} param0.methodName Name of the method on the target record.
* @param {string} param0.modelName Name of the model of the target record.
*/
export function useUpdateToModel({ methodName, modelName }) {
export function useUpdateToModel({ methodName }) {
const component = useComponent();
useUpdate({ func: () => {
const record = component.env.services.messaging.modelManager.models[modelName].get(component.props.localId);
if (record) {
record[methodName]();
}
component.props.record[methodName]();
} });
}
@@ -14,21 +14,21 @@ export class Activity extends LegacyComponent {
*/
setup() {
super.setup();
useComponentToModel({ fieldName: 'component', modelName: 'ActivityView' });
useRefToModel({ fieldName: 'markDoneButtonRef', modelName: 'ActivityView', refName: 'markDoneButton', });
useComponentToModel({ fieldName: 'component' });
useRefToModel({ fieldName: 'markDoneButtonRef', refName: 'markDoneButton', });
}
/**
* @returns {ActivityView}
*/
get activityView() {
return this.messaging && this.messaging.models['ActivityView'].get(this.props.localId);
return this.props.record;
}
}
Object.assign(Activity, {
props: { localId: String },
props: { record: Object },
template: 'mail.Activity',
components: { Popover },
});
@@ -111,7 +111,7 @@
<t t-foreach="activityView.mailTemplateViews" t-as="mailTemplateView" t-key="mailTemplateView.localId">
<MailTemplate
className="'o_Activity_mailTemplate'"
localId="mailTemplateView.localId"
record="mailTemplateView"
/>
</t>
</div>
@@ -122,7 +122,7 @@
<button class="o_Activity_toolButton o_Activity_markDoneButton btn btn-link btn-primary pt-0 pl-0" t-att-title="activityView.markDoneText" t-ref="markDoneButton" t-on-click="activityView.onClickMarkDoneButton">
<i class="fa fa-check"/> Mark Done
</button>
<PopoverView t-if="activityView.markDonePopoverView" localId="activityView.markDonePopoverView.localId"/>
<PopoverView t-if="activityView.markDonePopoverView" record="activityView.markDonePopoverView"/>
<t t-if="activityView.fileUploader">
<button class="o_Activity_toolButton o_Activity_uploadButton btn btn-link btn-primary pt-0 pl-0" t-on-click="activityView.onClickUploadDocument">
<i class="fa fa-upload"/> Upload Document
@@ -10,13 +10,13 @@ export class ActivityBox extends Component {
* @returns {ActivityBoxView}
*/
get activityBoxView() {
return this.messaging && this.messaging.models['ActivityBoxView'].get(this.props.localId);
return this.props.record;
}
}
Object.assign(ActivityBox, {
props: { localId: String },
props: { record: Object },
template: 'mail.ActivityBox',
});
@@ -34,7 +34,7 @@
<t t-if="activityBoxView.isActivityListVisible">
<div class="o_ActivityBox_activityList">
<t t-foreach="activityBoxView.activityViews" t-as="activityView" t-key="activityView.localId">
<Activity className="'o_ActivityBox_activity'" localId="activityView.localId"/>
<Activity className="'o_ActivityBox_activity'" record="activityView"/>
</t>
</div>
</t>
@@ -14,8 +14,8 @@ export class ActivityMarkDonePopoverContent extends LegacyComponent {
*/
setup() {
super.setup();
useComponentToModel({ fieldName: 'component', modelName: 'ActivityMarkDonePopoverContentView' });
useRefToModel({ fieldName: 'feedbackTextareaRef', modelName: 'ActivityMarkDonePopoverContentView', refName: 'feedbackTextarea' });
useComponentToModel({ fieldName: 'component' });
useRefToModel({ fieldName: 'feedbackTextareaRef', refName: 'feedbackTextarea' });
this._feedbackTextareaRef = useRef('feedbackTextarea');
onMounted(() => this._mounted());
}
@@ -35,13 +35,13 @@ export class ActivityMarkDonePopoverContent extends LegacyComponent {
* @returns {ActivityMarkDonePopoverContentView}
*/
get activityMarkDonePopoverContentView() {
return this.messaging && this.messaging.models['ActivityMarkDonePopoverContentView'].get(this.props.localId);
return this.props.record;
}
}
Object.assign(ActivityMarkDonePopoverContent, {
props: { localId: String },
props: { record: Object },
template: 'mail.ActivityMarkDonePopoverContent',
});
@@ -12,7 +12,7 @@ export class AttachmentBox extends Component {
*/
setup() {
super.setup();
useComponentToModel({ fieldName: 'component', modelName: 'AttachmentBoxView' });
useComponentToModel({ fieldName: 'component' });
}
//--------------------------------------------------------------------------
@@ -23,13 +23,13 @@ export class AttachmentBox extends Component {
* @returns {AttachmentBoxView|undefined}
*/
get attachmentBoxView() {
return this.messaging && this.messaging.models['AttachmentBoxView'].get(this.props.localId);
return this.props.record;
}
}
Object.assign(AttachmentBox, {
props: { localId: String },
props: { record: Object },
template: 'mail.AttachmentBox',
});
@@ -15,13 +15,13 @@
<t t-if="attachmentBoxView.dropZoneView">
<DropZone
className="'o_AttachmentBox_dropZone'"
localId="attachmentBoxView.dropZoneView.localId"
record="attachmentBoxView.dropZoneView"
/>
</t>
<t t-if="attachmentBoxView.attachmentList">
<AttachmentList
className="'o_attachmentBox_attachmentList'"
localId="attachmentBoxView.attachmentList.localId"
record="attachmentBoxView.attachmentList"
/>
</t>
<button class="o_AttachmentBox_buttonAdd btn btn-link" type="button" t-on-click="attachmentBoxView.onClickAddAttachment">
@@ -10,13 +10,13 @@ export class AttachmentCard extends Component {
* @returns {AttachmentCard}
*/
get attachmentCard() {
return this.messaging && this.messaging.models['AttachmentCard'].get(this.props.localId);
return this.props.record;
}
}
Object.assign(AttachmentCard, {
props: { localId: String },
props: { record: Object },
template: 'mail.AttachmentCard',
});
@@ -11,20 +11,20 @@ export class AttachmentDeleteConfirm extends Component {
* @override
*/
setup() {
useComponentToModel({ fieldName: 'component', modelName: 'AttachmentDeleteConfirmView' });
useComponentToModel({ fieldName: 'component' });
}
/**
* @returns {AttachmentDeleteConfirmView}
*/
get attachmentDeleteConfirmView() {
return this.messaging && this.messaging.models['AttachmentDeleteConfirmView'].get(this.props.localId);
return this.props.record;
}
}
Object.assign(AttachmentDeleteConfirm, {
props: { localId: String },
props: { record: Object },
template: 'mail.AttachmentDeleteConfirm',
});
@@ -10,13 +10,13 @@ export class AttachmentImage extends Component {
* @returns {AttachmentImage}
*/
get attachmentImage() {
return this.messaging && this.messaging.models['AttachmentImage'].get(this.props.localId);
return this.props.record;
}
}
Object.assign(AttachmentImage, {
props: { localId: String },
props: { record: Object },
template: 'mail.AttachmentImage',
});
@@ -10,13 +10,13 @@ export class AttachmentList extends Component {
* @returns {AttachmentList}
*/
get attachmentList() {
return this.messaging && this.messaging.models['AttachmentList'].get(this.props.localId);
return this.props.record;
}
}
Object.assign(AttachmentList, {
props: { localId: String },
props: { record: Object },
template: 'mail.AttachmentList',
});
@@ -6,12 +6,12 @@
<div class="o_AttachmentList d-flex flex-column justify-content-start" t-attf-class="{{ className }}" t-ref="root">
<div class="o_AttachmentList_partialList o_AttachmentList_partialListImages d-flex flex-grow-1 flex-wrap">
<t t-foreach="attachmentList.attachmentImages" t-as="attachmentImage" t-key="attachmentImage.localId">
<AttachmentImage className="'o_AttachmentList_attachment my-1 me-1 mw-100'" localId="attachmentImage.localId"/>
<AttachmentImage className="'o_AttachmentList_attachment my-1 me-1 mw-100'" record="attachmentImage"/>
</t>
</div>
<div class="o_AttachmentList_partialList o_AttachmentList_partialListNonImages d-flex flex-grow-1 flex-wrap justify-content-start m-1">
<t t-foreach="attachmentList.attachmentCards" t-as="attachmentCard" t-key="attachmentCard.localId">
<AttachmentCard className="'o_AttachmentList_attachment my-1 me-1 mw-100'" localId="attachmentCard.localId"/>
<AttachmentCard className="'o_AttachmentList_attachment my-1 me-1 mw-100'" record="attachmentCard"/>
</t>
</div>
</div>
@@ -18,7 +18,7 @@ export class AttachmentViewer extends Component {
*/
setup() {
super.setup();
useComponentToModel({ fieldName: 'component', modelName: 'AttachmentViewer' });
useComponentToModel({ fieldName: 'component' });
this.MIN_SCALE = MIN_SCALE;
/**
* Used to ensure that the ref is always up to date, which seems to be needed if the element
@@ -79,7 +79,7 @@ export class AttachmentViewer extends Component {
* @returns {AttachmentViewer}
*/
get attachmentViewer() {
return this.messaging && this.messaging.models['AttachmentViewer'].get(this.props.localId);
return this.props.record;
}
//--------------------------------------------------------------------------
@@ -347,7 +347,7 @@ export class AttachmentViewer extends Component {
}
Object.assign(AttachmentViewer, {
props: { localId: String },
props: { record: Object },
template: 'mail.AttachmentViewer',
});
@@ -61,7 +61,7 @@ export class AutocompleteInput extends Component {
* @returns {AutocompleteInputView}
*/
get autocompleteInputView() {
return this.messaging && this.messaging.models['AutocompleteInputView'].get(this.props.localId);
return this.props.record;
}
//--------------------------------------------------------------------------
@@ -163,7 +163,7 @@ Object.assign(AutocompleteInput, {
type: Function,
optional: true,
},
localId: String,
record: Object,
onHide: {
type: Function,
optional: true,
@@ -14,19 +14,19 @@ export class ChannelInvitationForm extends Component {
*/
setup() {
super.setup();
useComponentToModel({ fieldName: 'component', modelName: 'ChannelInvitationForm' });
useRefToModel({ fieldName: 'searchInputRef', modelName: 'ChannelInvitationForm', refName: 'searchInput' });
useUpdateToModel({ methodName: 'onComponentUpdate', modelName: 'ChannelInvitationForm' });
useComponentToModel({ fieldName: 'component' });
useRefToModel({ fieldName: 'searchInputRef', refName: 'searchInput' });
useUpdateToModel({ methodName: 'onComponentUpdate' });
}
get channelInvitationForm() {
return this.messaging && this.messaging.models['ChannelInvitationForm'].get(this.props.localId);
return this.props.record;
}
}
Object.assign(ChannelInvitationForm, {
props: { localId: String },
props: { record: Object },
template: 'mail.ChannelInvitationForm',
});
@@ -11,7 +11,7 @@
</div>
<div class="d-flex flex-column flex-grow-1 mx-0 py-2 overflow-auto">
<t t-foreach="channelInvitationForm.selectablePartners" t-as="selectablePartner" t-key="selectablePartner.localId">
<ChannelInvitationFormSelectablePartner channelInvitationFormLocalId="channelInvitationForm.localId" selectablePartnerLocalId="selectablePartner.localId"/>
<ChannelInvitationFormSelectablePartner channelInvitationForm="channelInvitationForm" selectablePartner="selectablePartner"/>
</t>
<t t-if="channelInvitationForm.selectablePartners.length === 0">
<div class="mx-3">No user found that is not already a member of this channel.</div>
@@ -27,7 +27,7 @@
<h4>Selected users:</h4>
<div class="o_ChannelInvitationForm_selectedPartners overflow-auto">
<t t-foreach="channelInvitationForm.selectedPartners" t-as="selectedPartner" t-key="selectedPartner.localId">
<ChannelInvitationFormSelectedPartner channelInvitationFormLocalId="channelInvitationForm.localId" selectedPartnerLocalId="selectedPartner.localId"/>
<ChannelInvitationFormSelectedPartner channelInvitationForm="channelInvitationForm" selectedPartner="selectedPartner"/>
</t>
</div>
</div>
@@ -10,22 +10,22 @@ export class ChannelInvitationFormSelectablePartner extends Component {
* @returns {ChannelInvitationForm}
*/
get channelInvitationForm() {
return this.messaging && this.messaging.models['ChannelInvitationForm'].get(this.props.channelInvitationFormLocalId);
return this.props.channelInvitationForm;
}
/**
* @returns {Partner}
*/
get selectablePartner() {
return this.messaging && this.messaging.models['Partner'].get(this.props.selectablePartnerLocalId);
return this.props.selectablePartner;
}
}
Object.assign(ChannelInvitationFormSelectablePartner, {
props: {
channelInvitationFormLocalId: String,
selectablePartnerLocalId: String,
channelInvitationForm: Object,
selectablePartner: Object,
},
template: 'mail.ChannelInvitationFormSelectablePartner',
});
@@ -12,7 +12,7 @@
'o_ChannelInvitationFormSelectablePartner_imStatusIcon-mobile': messaging.device.isSmall,
'small' : !messaging.device.isSmall,
}"
partnerLocalId="selectablePartner.localId"
partner="selectablePartner"
/>
</t>
</div>
@@ -10,22 +10,22 @@ export class ChannelInvitationFormSelectedPartner extends Component {
* @returns {ChannelInvitationForm}
*/
get channelInvitationForm() {
return this.messaging && this.messaging.models['ChannelInvitationForm'].get(this.props.channelInvitationFormLocalId);
return this.props.channelInvitationForm;
}
/**
* @returns {Partner}
*/
get selectedPartner() {
return this.messaging && this.messaging.models['Partner'].get(this.props.selectedPartnerLocalId);
return this.props.selectedPartner;
}
}
Object.assign(ChannelInvitationFormSelectedPartner, {
props: {
channelInvitationFormLocalId: String,
selectedPartnerLocalId: String,
channelInvitationForm: Object,
selectedPartner: Object,
},
template: 'mail.ChannelInvitationFormSelectedPartner',
});
@@ -10,22 +10,22 @@ export class ChannelMember extends Component {
* @returns {Thread}
*/
get channel() {
return this.messaging.models['Thread'].get(this.props.channelLocalId);
return this.props.channel;
}
/**
* @returns {Partner}
*/
get member() {
return this.messaging.models['Partner'].get(this.props.memberLocalId);
return this.props.member;
}
}
Object.assign(ChannelMember, {
props: {
channelLocalId: String,
memberLocalId: String,
channel: Object,
member: Object,
},
template: 'mail.ChannelMember',
});
@@ -13,7 +13,7 @@
'o-isDeviceSmall': messaging.device.isSmall,
'small': !messaging.device.isSmall,
}"
partnerLocalId="member.localId"
partner="member"
/>
</t>
</div>
@@ -10,13 +10,13 @@ export class ChannelMemberList extends Component {
* @returns {ChannelMemberListView}
*/
get channelMemberListView() {
return this.messaging && this.messaging.models['ChannelMemberListView'].get(this.props.localId);
return this.props.record;
}
}
Object.assign(ChannelMemberList, {
props: { localId: String },
props: { record: Object },
template: 'mail.ChannelMemberList',
});
@@ -34,7 +34,7 @@
<t t-name="mail.ChannelMemberList_memberList" owl="1">
<h6 class="m-2"><t t-esc="title"/> - <t t-esc="members.length"/></h6>
<t t-foreach="members" t-as="member" t-key="member.localId">
<ChannelMember channelLocalId="channelMemberListView.channel.localId" memberLocalId="member.localId"/>
<ChannelMember channel="channelMemberListView.channel" member="member"/>
</t>
</t>
@@ -30,7 +30,7 @@ export class ChatWindow extends Component {
* @returns {ChatWindow}
*/
get chatWindow() {
return this.messaging && this.messaging.models['ChatWindow'].get(this.props.localId);
return this.props.record;
}
//--------------------------------------------------------------------------
@@ -59,7 +59,7 @@ export class ChatWindow extends Component {
}
Object.assign(ChatWindow, {
props: { localId: String },
props: { record: Object },
template: 'mail.ChatWindow',
});
@@ -15,20 +15,20 @@
>
<ChatWindowHeader
className="'o_ChatWindow_header flex-grow-0 flex-shrink-0'"
chatWindowLocalId="chatWindow.localId"
localId="chatWindow.chatWindowHeaderView.localId"
chatWindow="chatWindow"
record="chatWindow.chatWindowHeaderView"
onClicked="chatWindow.onClickHeader"
/>
<t t-if="chatWindow.channelMemberListView">
<ChannelMemberList localId="chatWindow.channelMemberListView.localId" className="'bg-white'"/>
<ChannelMemberList record="chatWindow.channelMemberListView" className="'bg-white'"/>
</t>
<t t-if="chatWindow.channelInvitationForm">
<ChannelInvitationForm className="'o_ChatWindow_channelInvitationForm'" localId="chatWindow.channelInvitationForm.localId"/>
<ChannelInvitationForm className="'o_ChatWindow_channelInvitationForm'" record="chatWindow.channelInvitationForm"/>
</t>
<t t-if="chatWindow.threadView">
<ThreadView
className="'o_ChatWindow_thread flex-grow-1 flex-shrink-1'"
localId="chatWindow.threadView.localId"
record="chatWindow.threadView"
/>
</t>
<t t-if="chatWindow.newMessageAutocompleteInputView">
@@ -38,7 +38,7 @@
</span>
<AutocompleteInput
className="'o_ChatWindow_newMessageFormInput flex-grow-1 flex-shrink-1 border'"
localId="chatWindow.newMessageAutocompleteInputView.localId"
record="chatWindow.newMessageAutocompleteInputView"
select="chatWindow.onAutocompleteSelect"
source="chatWindow.onAutocompleteSource"
inputRef="_inputRef"
@@ -15,14 +15,14 @@ export class ChatWindowHeader extends Component {
* @returns {ChatWindow}
*/
get chatWindow() {
return this.messaging && this.messaging.models['ChatWindow'].get(this.props.chatWindowLocalId);
return this.props.chatWindow;
}
/**
* @returns {ChatWindowHeaderView}
*/
get chatWindowHeaderView() {
return this.messaging && this.messaging.models['ChatWindowHeaderView'].get(this.props.localId);
return this.props.record;
}
//--------------------------------------------------------------------------
@@ -53,8 +53,8 @@ export class ChatWindowHeader extends Component {
Object.assign(ChatWindowHeader, {
props: {
chatWindowLocalId: String,
localId: String,
chatWindow: Object,
record: Object,
onClicked: {
type: Function,
optional: true,
@@ -12,7 +12,7 @@
<t t-if="chatWindow.thread and chatWindow.thread.model === 'mail.channel'">
<ThreadIcon
className="'o_ChatWindowHeader_icon o_ChatWindowHeader_item ms-3 me-1 my-0'"
threadLocalId="chatWindow.thread.localId"
thread="chatWindow.thread"
/>
</t>
<div class="o_ChatWindowHeader_item o_ChatWindowHeader_name mh-100 mx-1 my-0 text-truncate" t-att-class="{'ms-3':!chatWindow.thread or chatWindow.thread.model !== 'mail.channel'}" t-att-title="chatWindow.name">
@@ -11,7 +11,7 @@
</div>
<ul class="o_ChatWindowHiddenMenu_list dropdown-menu dropdown-menu-right m-0 p-0 overflow-auto" t-att-class="{ show: messaging.chatWindowManager.isHiddenMenuOpen }" role="menu" t-ref="list">
<t t-foreach="messaging.chatWindowManager.hiddenChatWindowHeaderViews" t-as="chatWindowHeaderView" t-key="chatWindowHeaderView.localId">
<ChatWindowHiddenMenuItem chatWindowHeaderViewLocalId="chatWindowHeaderView.localId" isLast="chatWindowHeaderView_last"/>
<ChatWindowHiddenMenuItem chatWindowHeaderView="chatWindowHeaderView" isLast="chatWindowHeaderView_last"/>
</t>
</ul>
<t t-if="messaging.chatWindowManager.unreadHiddenConversationAmount > 0">
@@ -10,7 +10,7 @@ export class ChatWindowHiddenMenuItem extends Component {
* @returns {ChatWindowHeaderView}
*/
get chatWindowHeaderView() {
return this.messaging && this.messaging.models['ChatWindowHeaderView'].get(this.props.chatWindowHeaderViewLocalId);
return this.props.chatWindowHeaderView;
}
}
@@ -19,7 +19,7 @@ Object.assign(ChatWindowHiddenMenuItem, {
isLast: false,
},
props: {
chatWindowHeaderViewLocalId: String,
chatWindowHeaderView: Object,
isLast: {
type: Boolean,
optional: true,
@@ -5,8 +5,8 @@
<li class="o_ChatWindowHiddenMenuItem" t-att-class="{ 'border-bottom' : !props.isLast }" role="menuitem" t-attf-class="{{ className }}" t-ref="root">
<ChatWindowHeader
className="'o_ChatWindowHiddenMenuItem_chatWindowHeader opacity-100-hover'"
localId="chatWindowHeaderView.localId"
chatWindowLocalId="chatWindowHeaderView.chatWindowOwner.localId"
record="chatWindowHeaderView"
chatWindow="chatWindowHeaderView.chatWindowOwner"
onClicked="chatWindowHeaderView.chatWindowOwner.onClickFromChatWindowHiddenMenu"
/>
</li>
@@ -9,7 +9,7 @@
<ChatWindowHiddenMenu className="'o_ChatWindowManager_hiddenMenu'"/>
</t>
<t t-foreach="messaging.chatWindowManager.allOrderedVisible" t-as="chatWindow" t-key="chatWindow.localId">
<ChatWindow localId="chatWindow.localId"/>
<ChatWindow record="chatWindow"/>
</t>
</t>
</div>
@@ -14,8 +14,8 @@ export class Chatter extends LegacyComponent {
setup() {
super.setup();
useUpdate({ func: () => this._update() });
useComponentToModel({ fieldName: 'component', modelName: 'Chatter' });
useRefToModel({ fieldName: 'scrollPanelRef', modelName: 'Chatter', refName: 'scrollPanel' });
useComponentToModel({ fieldName: 'component' });
useRefToModel({ fieldName: 'scrollPanelRef', refName: 'scrollPanel' });
}
//--------------------------------------------------------------------------
@@ -26,7 +26,7 @@ export class Chatter extends LegacyComponent {
* @returns {Chatter}
*/
get chatter() {
return this.messaging && this.messaging.models['Chatter'].get(this.props.localId);
return this.props.record;
}
//--------------------------------------------------------------------------
@@ -58,7 +58,7 @@ export class Chatter extends LegacyComponent {
}
Object.assign(Chatter, {
props: { localId: String },
props: { record: Object },
template: 'mail.Chatter',
});
@@ -7,13 +7,13 @@
<div class="o_Chatter_fixedPanel">
<ChatterTopbar
className="'o_Chatter_topbar'"
localId="chatter.localId"
record="chatter"
/>
<t t-if="chatter.composerView">
<Composer
className="'o_Chatter_composer border-bottom'"
classNameObj="{ 'o-bordered border-left border-right': chatter.hasExternalBorder }"
localId="chatter.composerView.localId"
record="chatter.composerView"
/>
</t>
</div>
@@ -21,19 +21,19 @@
<t t-if="chatter.attachmentBoxView">
<AttachmentBox
className="'o_Chatter_attachmentBox'"
localId="chatter.attachmentBoxView.localId"
record="chatter.attachmentBoxView"
/>
</t>
<t t-if="chatter.activityBoxView">
<ActivityBox
className="'o_Chatter_activityBox'"
localId="chatter.activityBoxView.localId"
record="chatter.activityBoxView"
/>
</t>
<t t-if="chatter.threadView">
<ThreadView
className="'o_Chatter_thread'"
localId="chatter.threadView.localId"
record="chatter.threadView"
/>
</t>
</div>
@@ -4,7 +4,7 @@
<t t-name="mail.ChatterContainer" owl="1">
<div class="o_ChatterContainer flex-grow-1 d-flex w-100" t-attf-class="{{ className }}" data-command-category="mail" t-ref="root">
<t t-if="chatter">
<Chatter localId="chatter.localId"/>
<Chatter record="chatter"/>
</t>
<t t-else="">
<div class="o_ChatterContainer_noChatter flex-grow-1 align-items-center justify-content-center d-flex"><i class="o_ChatterContainer_noChatterIcon fa fa-circle-o-notch fa-spin me-2"/>Please wait...</div>
@@ -10,13 +10,13 @@ export class ChatterTopbar extends Component {
* @returns {Chatter}
*/
get chatter() {
return this.messaging && this.messaging.models['Chatter'].get(this.props.localId);
return this.props.record;
}
}
Object.assign(ChatterTopbar, {
props: { localId: String },
props: { record: Object },
template: 'mail.ChatterTopbar',
});
@@ -56,14 +56,14 @@
<t t-if="chatter.followButtonView">
<FollowButton
className="'o_ChatterTopbar_followButton'"
localId="chatter.followButtonView.localId"
record="chatter.followButtonView"
/>
</t>
<FollowerListMenu
className="'o_ChatterTopbar_followerListMenu'"
isDisabled="chatter.isDisabled"
localId="chatter.followerListMenuView.localId"
threadLocalId="chatter.thread.localId"
record="chatter.followerListMenuView"
thread="chatter.thread"
isChatterButton="true"
/>
</t>
@@ -13,8 +13,8 @@ export class Composer extends Component {
*/
setup() {
super.setup();
useComponentToModel({ fieldName: 'component', modelName: 'ComposerView' });
useRefToModel({ fieldName: 'buttonEmojisRef', modelName: 'ComposerView', refName: 'buttonEmojis' });
useComponentToModel({ fieldName: 'component' });
useRefToModel({ fieldName: 'buttonEmojisRef', refName: 'buttonEmojis' });
}
//--------------------------------------------------------------------------
@@ -25,13 +25,13 @@ export class Composer extends Component {
* @returns {ComposerView}
*/
get composerView() {
return this.messaging && this.messaging.models['ComposerView'].get(this.props.localId);
return this.props.record;
}
}
Object.assign(Composer, {
props: { localId: String },
props: { record: Object },
template: 'mail.Composer',
});
@@ -20,7 +20,7 @@
<t t-if="composerView.dropZoneView">
<DropZone
className="'o_Composer_dropZone'"
localId="composerView.dropZoneView.localId"
record="composerView.dropZoneView"
/>
</t>
<t t-if="composerView.hasHeader">
@@ -48,7 +48,7 @@
</t>
</b>
</small>
<ComposerSuggestedRecipientList localId="composerView.composerSuggestedRecipientListView.localId"/>
<ComposerSuggestedRecipientList record="composerView.composerSuggestedRecipientListView"/>
</t>
</div>
</t>
@@ -75,7 +75,7 @@
'o_Composer_textInput-mobile': messaging.device.isSmall,
'o-has-current-partner-avatar': composerView.hasCurrentPartnerAvatar,
}"
localId="composerView.localId"
record="composerView"
t-key="composerView.localId"
/>
<div class="o_Composer_buttons" t-att-class="{ 'o-composer-is-compact': composerView.isCompact, 'o-isDeviceSmall': messaging.device.isSmall, 'o-messaging-in-editing': composerView and composerView.messageViewInEditing }">
@@ -99,7 +99,7 @@
>
<i class="fa fa-smile-o"/>
</button>
<PopoverView t-if="composerView.emojisPopoverView" localId="composerView.emojisPopoverView.localId"/>
<PopoverView t-if="composerView.emojisPopoverView" record="composerView.emojisPopoverView"/>
<button class="o_Composer_button o_Composer_buttonAttachment o_Composer_toolButton btn btn-light fa fa-paperclip" t-att-class="{ 'o-isDeviceSmall': messaging.device.isSmall }" title="Add attachment" type="button" t-on-click="composerView.onClickAddAttachment"/>
</div>
<t t-if="composerView.isExpandable">
@@ -116,13 +116,13 @@
<t t-if="composerView.hasFooter">
<div class="o_Composer_coreFooter" t-att-class="{ 'o-composer-is-compact': composerView.isCompact }">
<t t-if="composerView.hasThreadTyping">
<ThreadTextualTypingStatus className="'o_Composer_threadTextualTypingStatus'" threadLocalId="composerView.composer.activeThread.localId"/>
<ThreadTextualTypingStatus className="'o_Composer_threadTextualTypingStatus'" thread="composerView.composer.activeThread"/>
</t>
<AttachmentList
t-if="composerView.attachmentList"
className="'o_Composer_attachmentList'"
classNameObj="{ 'o-composer-is-compact': composerView.isCompact }"
localId="composerView.attachmentList.localId"
record="composerView.attachmentList"
/>
<t t-if="!composerView.isCompact">
<t t-call="mail.Composer.actionButtons"/>
@@ -72,7 +72,7 @@ export class ComposerSuggestedRecipient extends Component {
* @returns {SuggestedRecipientInfo}
*/
get suggestedRecipientInfo() {
return this.messaging && this.messaging.models['SuggestedRecipientInfo'].get(this.props.suggestedRecipientInfoLocalId);
return this.props.record;
}
//--------------------------------------------------------------------------
@@ -126,9 +126,7 @@ export class ComposerSuggestedRecipient extends Component {
Object.assign(ComposerSuggestedRecipient, {
components: { FormViewDialogComponentAdapter },
props: {
suggestedRecipientInfoLocalId: String,
},
props: { record: Object },
template: 'mail.ComposerSuggestedRecipient',
});
@@ -14,13 +14,13 @@ export class ComposerSuggestedRecipientList extends Component {
* @returns {ComposerSuggestedRecipientListView}
*/
get composerSuggestedRecipientListView() {
return this.messaging && this.messaging.models['ComposerSuggestedRecipientListView'].get(this.props.localId);
return this.props.record;
}
}
Object.assign(ComposerSuggestedRecipientList, {
props: { localId: String },
props: { record: Object },
template: 'mail.ComposerSuggestedRecipientList',
});
@@ -4,9 +4,7 @@
<t t-if="composerSuggestedRecipientListView">
<div class="o_ComposerSuggestedRecipientList mb-2" t-attf-class="{{ className }}" t-ref="root">
<t t-foreach="composerSuggestedRecipientListView.hasShowMoreButton ? composerSuggestedRecipientListView.thread.suggestedRecipientInfoList : composerSuggestedRecipientListView.thread.suggestedRecipientInfoList.slice(0,3)" t-as="recipientInfo" t-key="recipientInfo.localId">
<ComposerSuggestedRecipient
suggestedRecipientInfoLocalId="recipientInfo.localId"
/>
<ComposerSuggestedRecipient record="recipientInfo"/>
</t>
<t t-if="composerSuggestedRecipientListView.thread.suggestedRecipientInfoList.length > 3">
<t t-if="!composerSuggestedRecipientListView.hasShowMoreButton" >
@@ -23,7 +23,7 @@ export class ComposerSuggestion extends Component {
* @returns {ComposerSuggestion}
*/
get composerSuggestion() {
return this.messaging && this.messaging.models['ComposerSuggestion'].get(this.props.localId);
return this.props.record;
}
//--------------------------------------------------------------------------
@@ -51,7 +51,7 @@ export class ComposerSuggestion extends Component {
}
Object.assign(ComposerSuggestion, {
props: { localId: String },
props: { record: Object },
template: 'mail.ComposerSuggestion',
});
@@ -19,7 +19,7 @@
<PartnerImStatusIcon
className="'o_ComposerSuggestion_partnerImStatusIcon flex-shrink-0 mr-1'"
hasBackground="false"
partnerLocalId="composerSuggestion.record.localId"
partner="composerSuggestion.record"
/>
<strong class="o_ComposerSuggestion_part1 flex-shrink-0 mw-100 pr-2 text-truncate"><t t-esc="composerSuggestion.record.nameOrDisplayName"/></strong>
<t t-if="composerSuggestion.record.email">
@@ -14,13 +14,13 @@ export class ComposerSuggestionList extends Component {
* @returns {ComposerSuggestionListView}
*/
get composerSuggestionListView() {
return this.messaging && this.messaging.models['ComposerSuggestionListView'].get(this.props.localId);
return this.props.record;
}
}
Object.assign(ComposerSuggestionList, {
props: { localId: String },
props: { record: Object },
template: 'mail.ComposerSuggestionList',
});
@@ -7,13 +7,13 @@
<div class="o_ComposerSuggestionList_drop w-100" t-att-class="{ 'dropdown': composerSuggestionListView.composerViewOwner.hasMentionSuggestionsBelowPosition, 'dropup': !composerSuggestionListView.composerViewOwner.hasMentionSuggestionsBelowPosition }">
<div class="o_ComposerSuggestionList_list dropdown-menu show w-100 overflow-auto">
<t t-foreach="composerSuggestionListView.composerViewOwner.mainSuggestions" t-as="suggestion" t-key="suggestion.localId">
<ComposerSuggestion localId="suggestion.localId"/>
<ComposerSuggestion record="suggestion"/>
</t>
<t t-if="composerSuggestionListView.composerViewOwner.mainSuggestions.length > 0 and composerSuggestionListView.composerViewOwner.extraSuggestions.length > 0">
<div role="separator" class="dropdown-divider"/>
</t>
<t t-foreach="composerSuggestionListView.composerViewOwner.extraSuggestions" t-as="suggestion" t-key="suggestion.localId">
<ComposerSuggestion localId="suggestion.localId"/>
<ComposerSuggestion record="suggestion"/>
</t>
</div>
</div>
@@ -13,8 +13,8 @@ export class ComposerTextInput extends Component {
*/
setup() {
super.setup();
useRefToModel({ fieldName: 'mirroredTextareaRef', modelName: 'ComposerView', refName: 'mirroredTextarea' });
useRefToModel({ fieldName: 'textareaRef', modelName: 'ComposerView', refName: 'textarea' });
useRefToModel({ fieldName: 'mirroredTextareaRef', refName: 'mirroredTextarea' });
useRefToModel({ fieldName: 'textareaRef', refName: 'textarea' });
/**
* Updates the composer text input content when composer is mounted
* as textarea content can't be changed from the DOM.
@@ -30,7 +30,7 @@ export class ComposerTextInput extends Component {
* @returns {ComposerView}
*/
get composerView() {
return this.messaging && this.messaging.models['ComposerView'].get(this.props.localId);
return this.props.record;
}
//--------------------------------------------------------------------------
@@ -112,7 +112,7 @@ export class ComposerTextInput extends Component {
}
Object.assign(ComposerTextInput, {
props: { localId: String },
props: { record: Object },
template: 'mail.ComposerTextInput',
});
@@ -5,7 +5,7 @@
<t t-if="composerView">
<div class="o_ComposerTextInput" t-attf-class="{{ className }}" t-on-paste="composerView.onPasteTextInput" t-ref="root">
<t t-if="composerView.composerSuggestionListView">
<ComposerSuggestionList localId="composerView.composerSuggestionListView.localId"/>
<ComposerSuggestionList record="composerView.composerSuggestionListView"/>
</t>
<textarea class="o_ComposerTextInput_textarea o_ComposerTextInput_textareaStyle" t-att-class="{ 'o-composer-is-compact': composerView.isCompact }" t-esc="composerView.composer.textInputContent" t-att-placeholder="composerView.composer.placeholder" t-on-click="composerView.onClickTextarea" t-on-focusin="composerView.onFocusinTextarea" t-on-focusout="composerView.onFocusoutTextarea" t-on-keydown="composerView.onKeydownTextarea" t-on-keyup="composerView.onKeyupTextarea" t-on-input="_onInputTextarea" t-ref="textarea"/>
<!--
@@ -12,20 +12,20 @@ export class DeleteMessageConfirm extends Component {
*/
setup() {
super.setup();
useComponentToModel({ fieldName: 'component', modelName: 'DeleteMessageConfirmView' });
useComponentToModel({ fieldName: 'component' });
}
/**
* @returns {DeleteMessageConfirmView}
*/
get deleteMessageConfirmView() {
return this.messaging && this.messaging.models['DeleteMessageConfirmView'].get(this.props.localId);
return this.props.record;
}
}
Object.assign(DeleteMessageConfirm, {
props: { localId: String },
props: { record: Object },
template: 'mail.DeleteMessageConfirm',
});
@@ -7,7 +7,7 @@
<hr class="mt-0 mb-3"/>
<p class="mx-3 mb-3">Are you sure you want to delete this message?</p>
<blockquote class="o_DeleteMessageConfirm_blockquote mx-3 mb-3 fst-normal">
<Message localId="deleteMessageConfirmView.messageView.localId"/>
<Message record="deleteMessageConfirmView.messageView"/>
</blockquote>
<small t-if="!deleteMessageConfirmView.message.originThread or deleteMessageConfirmView.message.originThread.model !== 'mail.channel'" class="mx-3 mb-3">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>
<hr class="mt-0 mb-3"/>
@@ -14,13 +14,13 @@ export class Dialog extends Component {
* @returns {Dialog}
*/
get dialog() {
return this.messaging && this.messaging.models['Dialog'].get(this.props.localId);
return this.props.record;
}
}
Object.assign(Dialog, {
props: { localId: String },
props: { record: Object },
template: 'mail.Dialog',
});
@@ -8,7 +8,7 @@
t-component="constructor.components[dialog.componentName]"
t-props="{
className: `o_Dialog_component ${dialog.componentClassName}`,
localId: dialog.record.localId,
record: dialog.record,
}"
/>
</div>
@@ -7,7 +7,7 @@
<t t-foreach="messaging.dialogManager.dialogs" t-as="dialog" t-key="dialog.localId">
<Dialog
className="'o_DialogManager_dialog'"
localId="dialog.localId"
record="dialog"
/>
</t>
</t>
@@ -42,7 +42,7 @@ export class Discuss extends LegacyComponent {
* @returns {DiscussView}
*/
get discussView() {
return this.messaging && this.messaging.models['DiscussView'].get(this.props.localId);
return this.props.record;
}
//--------------------------------------------------------------------------
@@ -79,7 +79,7 @@ export class Discuss extends LegacyComponent {
}
Object.assign(Discuss, {
props: { localId: String },
props: { record: Object },
template: 'mail.Discuss',
});
@@ -8,7 +8,7 @@
t-ref="root"
>
<t t-if="!messaging.device.isSmall">
<DiscussSidebar className="'o_Discuss_sidebar bg-light border-right'" localId="discussView.localId"/>
<DiscussSidebar className="'o_Discuss_sidebar bg-light border-right'" record="discussView"/>
</t>
<t t-if="messaging.device.isSmall" t-call="mail.Discuss.content"/>
<t t-else="">
@@ -22,13 +22,13 @@
<t t-name="mail.Discuss.content" owl="1">
<t t-if="messaging.device.isSmall and discussView.discuss.activeMobileNavbarTabId === 'mailbox'">
<DiscussMobileMailboxSelection className="'o_Discuss_mobileMailboxSelection border-bottom'" localId="discussView.localId"/>
<DiscussMobileMailboxSelection className="'o_Discuss_mobileMailboxSelection border-bottom'" record="discussView"/>
</t>
<t t-if="discussView.mobileAddItemHeaderAutocompleteInputView">
<div class="o_Discuss_mobileAddItemHeader border-bottom">
<AutocompleteInput
className="'o_Discuss_mobileAddItemHeaderInput'"
localId="discussView.mobileAddItemHeaderAutocompleteInputView.localId"
record="discussView.mobileAddItemHeaderAutocompleteInputView"
select="discussView.onMobileAddItemHeaderInputSelect"
source="discussView.onMobileAddItemHeaderInputSource"
onHide="discussView.onHideMobileAddItemHeader"
@@ -40,7 +40,7 @@
<ThreadView
className="'o_Discuss_thread'"
classNameObj="{ 'o-isDeviceSmall': messaging.device.isSmall }"
localId="discussView.discuss.threadView.localId"
record="discussView.discuss.threadView"
/>
</t>
<t t-if="!discussView.discuss.thread and (!messaging.device.isSmall or discussView.discuss.activeMobileNavbarTabId === 'mailbox')">
@@ -61,12 +61,12 @@
</t>
</t>
<t t-if="discussView.discuss.notificationListView">
<NotificationList className="'o_Discuss_notificationList'" localId="discussView.discuss.notificationListView.localId"/>
<NotificationList className="'o_Discuss_notificationList'" record="discussView.discuss.notificationListView"/>
</t>
<t t-if="discussView.discuss.mobileMessagingNavbarView">
<MobileMessagingNavbar
className="'o_Discuss_mobileNavbar'"
localId="discussView.discuss.mobileMessagingNavbarView.localId"
record="discussView.discuss.mobileMessagingNavbarView"
/>
</t>
</t>
@@ -3,7 +3,7 @@
<t t-name="mail.DiscussContainer" owl="1">
<div class="o_DiscussContainer d-flex flex-grow-1 flex-column">
<Discuss t-if="messaging and messaging.discuss and messaging.discuss.discussView and messaging.isInitialized" className="'flex-grow-1'" localId="messaging.discuss.discussView.localId"/>
<Discuss t-if="messaging and messaging.discuss and messaging.discuss.discussView and messaging.isInitialized" className="'flex-grow-1'" record="messaging.discuss.discussView"/>
<div t-else="" class="o_DiscussContainer_spinner d-flex flex-grow-1 align-items-center justify-content-center">
<i class="o_DiscussContainer_spinnerIcon fa fa-circle-o-notch fa-spin me-2"/>Please wait...
</div>
@@ -14,13 +14,13 @@ export class DiscussMobileMailboxSelection extends Component {
* @returns {DiscussView}
*/
get discussView() {
return this.messaging && this.messaging.models['DiscussView'].get(this.props.localId);
return this.props.record;
}
}
Object.assign(DiscussMobileMailboxSelection, {
props: { localId: String },
props: { record: Object },
template: 'mail.DiscussMobileMailboxSelection',
});
@@ -4,7 +4,7 @@
<t t-name="mail.DiscussMobileMailboxSelection" owl="1">
<div class="o_DiscussMobileMailboxSelection d-flex" t-attf-class="{{ className }}" t-ref="root">
<t t-foreach="discussView.discuss.orderedMailboxes" t-as="mailbox" t-key="mailbox.localId">
<DiscussMobileMailboxSelectionItem discussViewLocalId="discussView.localId" mailboxLocalId="mailbox.localId"/>
<DiscussMobileMailboxSelectionItem discussView="discussView" mailbox="mailbox"/>
</t>
</div>
</t>
@@ -14,22 +14,22 @@ export class DiscussMobileMailboxSelectionItem extends Component {
* @returns {DiscussView}
*/
get discussView() {
return this.messaging && this.messaging.models['DiscussView'].get(this.props.discussViewLocalId);
return this.props.discussView;
}
/**
* @returns {Thread}
*/
get mailbox() {
return this.messaging && this.messaging.models['Thread'].get(this.props.mailboxLocalId);
return this.props.mailbox;
}
}
Object.assign(DiscussMobileMailboxSelectionItem, {
props: {
discussViewLocalId: String,
mailboxLocalId: String,
discussView: Object,
mailbox: Object,
},
template: 'mail.DiscussMobileMailboxSelectionItem',
});
@@ -10,12 +10,12 @@ class DiscussPublicView extends Component {
* @returns {DiscussPublicView}
*/
get discussPublicView() {
return this.messaging && this.messaging.models['DiscussPublicView'].get(this.props.localId);
return this.props.record;
}
}
Object.assign(DiscussPublicView, {
props: { localId: String },
props: { record: Object },
template: 'mail.DiscussPublicView',
});
@@ -4,10 +4,10 @@
<t t-if="discussPublicView">
<div class="o_DiscussPublicView d-flex flex-column h-100" t-attf-class="{{ className }}" t-ref="root">
<ThreadView t-if="discussPublicView.threadView"
localId="discussPublicView.threadView.localId"
record="discussPublicView.threadView"
/>
<WelcomeView t-if="discussPublicView.welcomeView"
localId="discussPublicView.welcomeView.localId"
record="discussPublicView.welcomeView"
/>
</div>
</t>
@@ -14,7 +14,7 @@ export class DiscussSidebar extends Component {
setup() {
super.setup();
useUpdate({ func: () => this._update() });
useRefToModel({ fieldName: 'quickSearchInputRef', modelName: 'DiscussView', refName: 'quickSearchInput' });
useRefToModel({ fieldName: 'quickSearchInputRef', refName: 'quickSearchInput' });
}
//--------------------------------------------------------------------------
@@ -25,7 +25,7 @@ export class DiscussSidebar extends Component {
* @returns {DiscussView}
*/
get discussView() {
return this.messaging && this.messaging.models['DiscussView'].get(this.props.localId);
return this.props.record;
}
//--------------------------------------------------------------------------
@@ -47,7 +47,7 @@ export class DiscussSidebar extends Component {
}
Object.assign(DiscussSidebar, {
props: { localId: String },
props: { record: Object },
template: 'mail.DiscussSidebar',
});
@@ -11,9 +11,9 @@
</div>
<hr class="o_DiscussSidebar_separator"/>
<div class="o_DiscussSidebar_category o_DiscussSidebar_categoryMailbox">
<DiscussSidebarMailbox localId="discussView.inboxView.localId"/>
<DiscussSidebarMailbox localId="discussView.starredView.localId"/>
<DiscussSidebarMailbox localId="discussView.historyView.localId"/>
<DiscussSidebarMailbox record="discussView.inboxView"/>
<DiscussSidebarMailbox record="discussView.starredView"/>
<DiscussSidebarMailbox record="discussView.historyView"/>
</div>
<hr class="o_DiscussSidebar_separator"/>
<t t-if="messaging.models['Thread'].all(thread => thread.isPinned and thread.model === 'mail.channel').length > 19">
@@ -22,13 +22,13 @@
<DiscussSidebarCategory
t-if="discussView.discuss.categoryChannel"
className="'o_DiscussSidebar_category o_DiscussSidebar_categoryChannel'"
localId="discussView.discuss.categoryChannel.localId"
record="discussView.discuss.categoryChannel"
/>
<t name="beforeCategoryChat"/>
<DiscussSidebarCategory
t-if="discussView.discuss.categoryChat"
className="'o_DiscussSidebar_category o_DiscussSidebar_categoryChat'"
localId="discussView.discuss.categoryChat.localId"
record="discussView.discuss.categoryChat"
/>
</div>
</t>
@@ -10,12 +10,12 @@ export class DiscussSidebarCategory extends Component {
* @returns {DiscussSidebarCategory}
*/
get category() {
return this.messaging && this.messaging.models['DiscussSidebarCategory'].get(this.props.localId);
return this.props.record;
}
}
Object.assign(DiscussSidebarCategory, {
props: { localId: String },
props: { record: Object },
template: 'mail.DiscussSidebarCategory',
});
@@ -30,7 +30,7 @@
<div class="o_DiscussSidebarCategory_addingItem d-flex mb-2">
<AutocompleteInput
className="'o_DiscussSidebarCategory_addingItemInput flex-grow-1'"
localId="category.addingItemAutocompleteInputView.localId"
record="category.addingItemAutocompleteInputView"
select="category.onAddItemAutocompleteSelect"
source="category.onAddItemAutocompleteSource"
onHide="category.onHideAddingItem"
@@ -40,14 +40,14 @@
<t t-foreach="category.filteredCategoryItems" t-as="item" t-key="item.localId">
<DiscussSidebarCategoryItem
className="'o_DiscussSidebarCategory_item'"
localId="item.localId"
record="item"
/>
</t>
</t>
<t t-if="!category.isOpen and category.activeItem">
<DiscussSidebarCategoryItem
className="'o_DiscussSidebarCategory_item'"
localId="category.activeItem.localId"
record="category.activeItem"
/>
</t>
</div>
@@ -10,13 +10,13 @@ export class DiscussSidebarCategoryItem extends Component {
* @returns {DiscussSidebarCategoryItem}
*/
get categoryItem() {
return this.messaging.models['DiscussSidebarCategoryItem'].get(this.props.localId);
return this.props.record;
}
}
Object.assign(DiscussSidebarCategoryItem, {
props: { localId: String },
props: { record: Object },
template: 'mail.DiscussSidebarCategoryItem',
});
@@ -13,7 +13,7 @@
<div class="o_DiscussSidebarCategoryItem_imageContainer">
<img class="o_DiscussSidebarCategoryItem_image rounded-circle" t-att-src="categoryItem.avatarUrl" alt="Thread Image"/>
<t t-if="categoryItem.hasThreadIcon">
<ThreadIcon className="'o_DiscussSidebarCategoryItem_threadIcon'" threadLocalId="categoryItem.channel.localId"/>
<ThreadIcon className="'o_DiscussSidebarCategoryItem_threadIcon'" thread="categoryItem.channel"/>
</t>
</div>
</div>
@@ -10,13 +10,13 @@ export class DiscussSidebarMailbox extends Component {
* @returns {DiscussSidebarMailboxView}
*/
get discussSidebarMailboxView() {
return this.messaging && this.messaging.models['DiscussSidebarMailboxView'].get(this.props.localId);
return this.props.record;
}
}
Object.assign(DiscussSidebarMailbox, {
props: { localId: String },
props: { record: Object },
template: 'mail.DiscussSidebarMailbox',
});
@@ -8,7 +8,7 @@
}" t-attf-class="{{ className }}" t-on-click="discussSidebarMailboxView.mailbox.onClick" t-att-data-thread-local-id="discussSidebarMailboxView.mailbox.localId" t-att-data-thread-name="discussSidebarMailboxView.mailbox.displayName"
t-ref="root"
>
<ThreadIcon className="'o_DiscussSidebarMailbox_item'" threadLocalId="discussSidebarMailboxView.mailbox.localId"/>
<ThreadIcon className="'o_DiscussSidebarMailbox_item'" thread="discussSidebarMailboxView.mailbox"/>
<div class="o_DiscussSidebarMailbox_item o_DiscussSidebarMailbox_name">
<t t-esc="discussSidebarMailboxView.mailbox.displayName"/>
</div>
@@ -14,7 +14,7 @@ export class DropZone extends Component {
* @returns {DropZoneView}
*/
get dropZoneView() {
return this.messaging && this.messaging.models['DropZoneView'].get(this.props.localId);
return this.props.record;
}
/**
@@ -31,7 +31,7 @@ export class DropZone extends Component {
Object.assign(DropZone, {
props: {
localId: String,
record: Object,
onDropzoneFilesDropped: {
type: Function,
optional: true,
@@ -10,7 +10,7 @@ export class Emoji extends Component {
* @returns {EmojiListView}
*/
get emojiListView() {
return this.messaging && this.messaging.models['EmojiListView'].get(this.props.emojiListViewLocalId);
return this.props.emojiListView;
}
}
@@ -18,7 +18,7 @@ export class Emoji extends Component {
Object.assign(Emoji, {
props: {
emoji: Object,
emojiListViewLocalId: String,
emojiListView: Object,
},
template: 'mail.Emoji',
});
@@ -17,7 +17,7 @@ export class EmojiList extends LegacyComponent {
}
get emojiListView() {
return this.messaging && this.messaging.models['EmojiListView'].get(this.props.localId);
return this.props.record;
}
//--------------------------------------------------------------------------
@@ -52,7 +52,7 @@ export class EmojiList extends LegacyComponent {
}
Object.assign(EmojiList, {
props: { localId: String },
props: { record: Object },
template: 'mail.EmojiList',
});
@@ -5,7 +5,7 @@
<div class="o_EmojiList" t-attf-class="{{ className }}" t-ref="root">
<t t-if="emojiListView">
<t t-foreach="emojis" t-as="emoji" t-key="emoji.unicode">
<Emoji emoji="emoji" emojiListViewLocalId="emojiListView.localId"/>
<Emoji emoji="emoji" emojiListView="emojiListView"/>
</t>
</t>
</div>
@@ -14,13 +14,13 @@ export class FollowButton extends Component {
* @return {FollowButtonView}
*/
get followButtonView() {
return this.messaging && this.messaging.models['FollowButtonView'].get(this.props.localId);
return this.props.record;
}
}
Object.assign(FollowButton, {
props: { localId: String },
props: { record: Object },
template: 'mail.FollowButton',
});
@@ -14,7 +14,7 @@ export class Follower extends Component {
* @returns {Follower}
*/
get follower() {
return this.messaging && this.messaging.models['Follower'].get(this.props.followerLocalId);
return this.props.follower;
}
}
@@ -24,7 +24,7 @@ Object.assign(Follower, {
onClick: () => {},
},
props: {
followerLocalId: String,
follower: Object,
onClick: {
type: Function,
optional: true,
@@ -33,14 +33,14 @@ export class FollowerListMenu extends Component {
* @return {FollowerListMenuView}
*/
get followerListMenuView() {
return this.messaging && this.messaging.models['FollowerListMenuView'].get(this.props.localId);
return this.props.record;
}
/**
* @return {Thread}
*/
get thread() {
return this.messaging && this.messaging.models['Thread'].get(this.props.threadLocalId);
return this.props.thread;
}
//--------------------------------------------------------------------------
@@ -79,9 +79,9 @@ Object.assign(FollowerListMenu, {
},
props: {
isDisabled: { type: Boolean, optional: true },
threadLocalId: String,
thread: Object,
isChatterButton: { type: Boolean, optional: true },
localId: String,
record: Object,
},
template: 'mail.FollowerListMenu',
});
@@ -24,7 +24,7 @@
<Follower
t-foreach="thread.followers" t-as="follower" t-key="follower.localId"
className="'o_FollowerMenu_follower dropdown-item'"
followerLocalId="follower.localId"
follower="follower"
onClick="followerListMenuView.onClickFollower"
/>
</t>
@@ -14,13 +14,13 @@ export class FollowerSubtype extends Component {
* @returns {FollowerSubtypeView}
*/
get followerSubtypeView() {
return this.messaging && this.messaging.models['FollowerSubtypeView'].get(this.props.localId);
return this.props.record;
}
}
Object.assign(FollowerSubtype, {
props: { localId: String },
props: { record: Object },
template: 'mail.FollowerSubtype',
});
@@ -12,7 +12,7 @@ export class FollowerSubtypeList extends Component {
*/
setup() {
super.setup();
useComponentToModel({ fieldName: 'component', modelName: 'FollowerSubtypeList' });
useComponentToModel({ fieldName: 'component' });
}
//--------------------------------------------------------------------------
@@ -23,13 +23,13 @@ export class FollowerSubtypeList extends Component {
* @returns {FollowerSubtypeList}
*/
get followerSubtypeList() {
return this.messaging && this.messaging.models['FollowerSubtypeList'].get(this.props.localId);
return this.props.record;
}
}
Object.assign(FollowerSubtypeList, {
props: { localId: String },
props: { record: Object },
template: 'mail.FollowerSubtypeList',
});
@@ -16,7 +16,7 @@
<t t-foreach="followerSubtypeList.followerSubtypeViews" t-as="followerSubtypeView" t-key="followerSubtypeView.localId">
<FollowerSubtype
className="'o_FollowerSubtypeList_subtype'"
localId="followerSubtypeView.localId"
record="followerSubtypeView"
/>
</t>
</div>
@@ -14,13 +14,13 @@ export class MailTemplate extends Component {
* @returns {MailTemplateView}
*/
get mailTemplateView() {
return this.messaging && this.messaging.models['MailTemplateView'].get(this.props.localId);
return this.props.record;
}
}
Object.assign(MailTemplate, {
props: { localId: String },
props: { record: Object },
template: 'mail.MailTemplate',
});
@@ -12,20 +12,20 @@ export class MediaPreview extends Component {
*/
setup() {
super.setup();
useRefToModel({ fieldName: 'audioRef', modelName: 'MediaPreview', refName: 'audio' });
useRefToModel({ fieldName: 'videoRef', modelName: 'MediaPreview', refName: 'video' });
useRefToModel({ fieldName: 'audioRef', refName: 'audio' });
useRefToModel({ fieldName: 'videoRef', refName: 'video' });
}
/**
* @returns {MediaPreview}
*/
get mediaPreview() {
return this.messaging && this.messaging.models['MediaPreview'].get(this.props.localId);
return this.props.record;
}
}
Object.assign(MediaPreview, {
props: { localId: String },
props: { record: Object },
template: 'mail.MediaPreview',
});
@@ -20,8 +20,8 @@ export class Message extends Component {
*/
setup() {
super.setup();
useComponentToModel({ fieldName: 'component', modelName: 'MessageView' });
useUpdateToModel({ methodName: 'onComponentUpdate', modelName: 'MessageView' });
useComponentToModel({ fieldName: 'component' });
useUpdateToModel({ methodName: 'onComponentUpdate' });
useUpdate({ func: () => this._update() });
/**
* Value of the last rendered prettyBody. Useful to compare to new value
@@ -120,7 +120,7 @@ export class Message extends Component {
* @returns {MessageView}
*/
get messageView() {
return this.messaging && this.messaging.models['MessageView'].get(this.props.localId);
return this.props.record;
}
/**
@@ -277,7 +277,7 @@ export class Message extends Component {
}
Object.assign(Message, {
props: { localId: String },
props: { record: Object },
template: 'mail.Message',
components: { Popover },
});
@@ -25,9 +25,9 @@
}" t-attf-class="{{ messageView.extraClass }} {{ className }}" t-on-click="messageView.onClick" t-on-mouseenter="messageView.onMouseenter" t-on-mouseleave="messageView.onMouseleave" t-att-data-message-local-id="messageView.message.localId"
t-ref="root"
>
<MessageInReplyToView t-if="messageView.messageInReplyToView" localId="messageView.messageInReplyToView.localId"/>
<MessageInReplyToView t-if="messageView.messageInReplyToView" record="messageView.messageInReplyToView"/>
<div t-if="messageView.isActive and messageView.messageActionList" class="o_Message_actionListContainer position-absolute pl-5 pr-3" t-att-class="{ 'o-squashed': messageView.isSquashed }">
<MessageActionList localId="messageView.messageActionList.localId"/>
<MessageActionList record="messageView.messageActionList"/>
</div>
<div class="d-flex flex-shrink-0">
<div class="o_Message_highlightIndicator h-100" t-att-class="{ 'o-active bg-primary': messageView.message.isHighlighted or messageView.isHighlighted }"/>
@@ -46,7 +46,7 @@
'text-100': !messageView.message.isDiscussionOrNotification and !messageView.isSelected,
}"
hasOpenChat="messageView.hasAuthorOpenChat"
partnerLocalId="messageView.message.author.localId"
partner="messageView.message.author"
/>
</t>
</div>
@@ -58,7 +58,7 @@
</small>
</t>
<t t-if="!messageView.isActive and messageView.messageSeenIndicatorView">
<MessageSeenIndicator className="'o_Message_seenIndicator'" localId="messageView.messageSeenIndicatorView.localId"/>
<MessageSeenIndicator className="'o_Message_seenIndicator'" record="messageView.messageSeenIndicatorView"/>
</t>
</t>
</div>
@@ -98,7 +98,7 @@
</small>
</t>
<t t-if="messageView.messageSeenIndicatorView">
<MessageSeenIndicator className="'o_Message_seenIndicator'" localId="messageView.messageSeenIndicatorView.localId"/>
<MessageSeenIndicator className="'o_Message_seenIndicator'" record="messageView.messageSeenIndicatorView"/>
</t>
<t t-if="messageView.threadView and messageView.message.originThread and messageView.message.originThread !== messageView.threadView.thread">
<small class="o_Message_originThread" t-att-class="{ 'o-message-selected text-600': messageView.isSelected, 'text-500': !messageView.isSelected }">
@@ -122,7 +122,7 @@
<i name="notificationIcon" class="o_Message_notificationIcon fa fa-envelope-o"/>
</span>
<t t-set-slot="opened">
<MessageNotificationPopoverContent localId="messageView.localId"/>
<MessageNotificationPopoverContent record="messageView"/>
</t>
</Popover>
</t>
@@ -139,7 +139,7 @@
<t t-if="messageView.composerViewInEditing">
<Composer
className="'o_Message_composer mb-1'"
localId="messageView.composerViewInEditing.localId"
record="messageView.composerViewInEditing"
/>
</t>
<t t-if="messageView.message.subtype_description and !messageView.message.isBodyEqualSubtypeDescription">
@@ -153,10 +153,10 @@
</ul>
</t>
</div>
<AttachmentList t-if="messageView.attachmentList" localId="messageView.attachmentList.localId"/>
<AttachmentList t-if="messageView.attachmentList" record="messageView.attachmentList"/>
<div t-if="messageView.message.messageReactionGroups.length > 0" class="d-flex flex-wrap ml-2">
<t t-foreach="messageView.message.messageReactionGroups" t-as="messageReactionGroup" t-key="messageReactionGroup.localId">
<MessageReactionGroup className="'mr-1 mb-1'" localId="messageReactionGroup.localId"/>
<MessageReactionGroup className="'mr-1 mb-1'" record="messageReactionGroup"/>
</t>
</div>
</div>
@@ -12,20 +12,20 @@ export class MessageActionList extends Component {
*/
setup() {
super.setup();
useRefToModel({ fieldName: 'actionReactionRef', modelName: 'MessageActionList', refName: 'actionReaction' });
useRefToModel({ fieldName: 'actionReactionRef', refName: 'actionReaction' });
}
/**
* @returns {MessageActionList}
*/
get messageActionList() {
return this.messaging && this.messaging.models['MessageActionList'].get(this.props.localId);
return this.props.record;
}
}
Object.assign(MessageActionList, {
props: { localId: String },
props: { record: Object },
template: "mail.MessageActionList",
});
@@ -4,7 +4,7 @@
<t t-if="messageActionList">
<div class="o_MessageActionList d-flex border rounded-sm bg-white" t-attf-class="{{ className }}" t-on-click="messageActionList.onClick" t-ref="root">
<i t-if="messageActionList.message.hasReactionIcon" class="o_MessageActionList_action o_MessageActionList_actionReaction fa fa-lg fa-smile-o p-2 o_cursor_pointer" t-att-title="messageActionList.addReactionText" t-on-click="messageActionList.onClickActionReaction" t-ref="actionReaction"/>
<PopoverView t-if="messageActionList.reactionPopoverView" localId="messageActionList.reactionPopoverView.localId"/>
<PopoverView t-if="messageActionList.reactionPopoverView" record="messageActionList.reactionPopoverView"/>
<span t-if="messageActionList.message.canStarBeToggled" class="o_MessageActionList_action o_MessageActionList_actionStar p-2 o_cursor_pointer" t-att-class="{
'o_MessageActionList_actionStar_active': messageActionList.message.isStarred,
'fa fa-lg fa-star': messageActionList.message.isStarred,
@@ -10,13 +10,13 @@ export class MessageAuthorPrefix extends Component {
* @returns {MessageAuthorPrefixView}
*/
get messageAuthorPrefixView() {
return this.messaging && this.messaging.models['MessageAuthorPrefixView'].get(this.props.localId);
return this.props.record;
}
}
Object.assign(MessageAuthorPrefix, {
props: { localId: String },
props: { record: Object },
template: 'mail.MessageAuthorPrefix',
});
@@ -10,12 +10,12 @@ export class MessageInReplyToView extends Component {
* @returns {MessageInReplyToView}
*/
get messageInReplyToView() {
return this.messaging && this.messaging.models['MessageInReplyToView'].get(this.props.localId);
return this.props.record;
}
}
Object.assign(MessageInReplyToView, {
props: { localId: String },
props: { record: Object },
template: "mail.MessageInReplyToView",
});
@@ -16,7 +16,7 @@ export class MessageList extends Component {
*/
setup() {
super.setup();
useComponentToModel({ fieldName: 'component', modelName: 'MessageListView' });
useComponentToModel({ fieldName: 'component' });
/**
* Reference of the "load more" item. Useful to trigger load more
* on scroll when it becomes visible.
@@ -146,7 +146,7 @@ export class MessageList extends Component {
* @returns {MessageListView}
*/
get messageListView() {
return this.messaging && this.messaging.models['MessageListView'].get(this.props.localId);
return this.props.record;
}
//--------------------------------------------------------------------------
@@ -331,7 +331,7 @@ export class MessageList extends Component {
Object.assign(MessageList, {
components: { Transition },
props: { localId: String },
props: { record: Object },
template: 'mail.MessageList',
});
@@ -62,7 +62,7 @@
<t t-set="current_day" t-value="message_day"/>
</div>
</t>
<Message localId="messageView.localId"/>
<Message record="messageView"/>
</t>
</t>
<!-- LOADING (if order desc)-->
@@ -10,13 +10,13 @@ export class MessageNotificationPopoverContent extends Component {
* @returns {MessageView}
*/
get messageView() {
return this.messaging && this.messaging.models['MessageView'].get(this.props.localId);
return this.props.record;
}
}
Object.assign(MessageNotificationPopoverContent, {
props: { localId: String },
props: { record: Object },
template: 'mail.MessageNotificationPopoverContent',
});
@@ -7,13 +7,13 @@ const { Component } = owl;
export class MessageReactionGroup extends Component {
get messageReactionGroup() {
return this.messaging.models['MessageReactionGroup'].get(this.props.localId);
return this.props.record;
}
}
Object.assign(MessageReactionGroup, {
props: { localId: String },
props: { record: Object },
template: 'mail.MessageReactionGroup',
});
@@ -14,12 +14,12 @@ export class MessageSeenIndicator extends Component {
* @returns {MessageSeenIndicator}
*/
get messageSeenIndicatorView() {
return this.messaging && this.messaging.models['MessageSeenIndicatorView'].get(this.props.localId);
return this.props.record;
}
}
Object.assign(MessageSeenIndicator, {
props: { localId: String },
props: { record: Object },
template: 'mail.MessageSeenIndicator',
});

Some files were not shown because too many files have changed in this diff Show More