[IMP] mail: move code from components to models (ThreadTextualTypingStatus)
Task-3002619. Part-of: odoo/odoo#103317
This commit is contained in:
committed by
Alexandre Kühn
parent
2a57a6765f
commit
2ae8ad027c
@@ -122,8 +122,8 @@
|
||||
</div>
|
||||
<t t-if="composerView.hasFooter">
|
||||
<div class="o_Composer_coreFooter overflow-auto" t-att-class="{ 'o-composer-is-compact': composerView.isCompact, 'ms-0': !composerView.isCompact }">
|
||||
<t t-if="composerView.hasThreadTyping">
|
||||
<ThreadTextualTypingStatus className="'o_Composer_threadTextualTypingStatus small'" thread="composerView.composer.activeThread"/>
|
||||
<t t-if="composerView.threadTextualTypingStatusView">
|
||||
<ThreadTextualTypingStatus className="'o_Composer_threadTextualTypingStatus small'" record="composerView.threadTextualTypingStatusView"/>
|
||||
</t>
|
||||
<AttachmentList
|
||||
t-if="composerView.attachmentList"
|
||||
|
||||
+4
-4
@@ -7,16 +7,16 @@ const { Component } = owl;
|
||||
export class ThreadTextualTypingStatus extends Component {
|
||||
|
||||
/**
|
||||
* @returns {Thread}
|
||||
* @returns {ThreadTextualTypingStatusView}
|
||||
*/
|
||||
get thread() {
|
||||
return this.props.thread;
|
||||
get threadTextualTypingStatusView() {
|
||||
return this.props.record;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Object.assign(ThreadTextualTypingStatus, {
|
||||
props: { thread: Object },
|
||||
props: { record: Object },
|
||||
template: 'mail.ThreadTextualTypingStatus',
|
||||
});
|
||||
|
||||
|
||||
+3
-3
@@ -2,12 +2,12 @@
|
||||
<templates xml:space="preserve">
|
||||
|
||||
<t t-name="mail.ThreadTextualTypingStatus" owl="1">
|
||||
<t t-if="thread">
|
||||
<t t-if="threadTextualTypingStatusView">
|
||||
<div class="o_ThreadTextualTypingStatus d-flex" t-attf-class="{{ className }}" t-ref="root">
|
||||
<t t-if="thread.orderedOtherTypingMembers.length > 0">
|
||||
<t t-if="threadTextualTypingStatusView.thread.orderedOtherTypingMembers.length > 0">
|
||||
<ThreadTypingIcon animation="'pulse'" size="'medium'"/>
|
||||
<span class="o_ThreadTextualTypingStatus_separator ms-1"/>
|
||||
<span class="text-truncate" t-esc="thread.typingStatusText"/>
|
||||
<span class="text-truncate" t-esc="threadTextualTypingStatusView.thread.typingStatusText"/>
|
||||
</t>
|
||||
</div>
|
||||
</t>
|
||||
|
||||
@@ -1424,6 +1424,15 @@ registerModel({
|
||||
default: {},
|
||||
inverse: 'owner',
|
||||
}),
|
||||
threadTextualTypingStatusView: one('ThreadTextualTypingStatusView', {
|
||||
compute() {
|
||||
if (this.hasThreadTyping) {
|
||||
return {};
|
||||
}
|
||||
return clear();
|
||||
},
|
||||
inverse: 'owner',
|
||||
}),
|
||||
/**
|
||||
* States the thread view on which this composer allows editing (if any).
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { one } from '@mail/model/model_field';
|
||||
|
||||
registerModel({
|
||||
name: 'ThreadTextualTypingStatusView',
|
||||
fields: {
|
||||
owner: one('ComposerView', {
|
||||
identifying: true,
|
||||
inverse: 'threadTextualTypingStatusView',
|
||||
}),
|
||||
thread: one('Thread', {
|
||||
compute() {
|
||||
return this.owner.composer.activeThread;
|
||||
},
|
||||
required: true,
|
||||
}),
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user