[IMP] mail, *: remove explicit usage of insert-and-replace
* = calendar, im_livechat, rating, snailmail, test_discuss_full, test_mail,
website_livechat
Distinction between "replace" and "insert-and-replace" can be guessed based on
the type of the provided data.
task-2957295
closes odoo/odoo#98404
Related: odoo/enterprise#30580
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
@@ -49,7 +49,7 @@ class Users(models.Model):
|
||||
'name': meeting_label,
|
||||
'model': 'calendar.event',
|
||||
'icon': modules.module.get_module_icon(self.env['calendar.event']._original_module),
|
||||
'meetings': [('insert-and-replace', meetings_lines)],
|
||||
'meetings': meetings_lines,
|
||||
}
|
||||
res.insert(0, meetings_systray)
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ patch(MockServer.prototype, 'calendar', {
|
||||
if (meetingsLines.length) {
|
||||
activities.unshift({
|
||||
id: 'calendar.event', // for simplicity
|
||||
meetings: [['insert-and-replace', meetingsLines]],
|
||||
meetings: meetingsLines,
|
||||
model: 'calendar.event',
|
||||
name: 'Today\'s Meetings',
|
||||
type: 'meeting',
|
||||
|
||||
@@ -6,7 +6,7 @@ import time from 'web.time';
|
||||
import utils from 'web.utils';
|
||||
|
||||
import LivechatButton from '@im_livechat/legacy/widgets/livechat_button';
|
||||
import { increment, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { increment } from '@mail/model/model_field_command';
|
||||
|
||||
const _t = core._t;
|
||||
|
||||
@@ -299,7 +299,7 @@ const _t = core._t;
|
||||
this._chatbotAddMessage(nextStep.chatbot_posted_message);
|
||||
}
|
||||
|
||||
this.messaging.publicLivechatGlobal.chatbot.update({ currentStep: insertAndReplace({ data: nextStep.chatbot_step }) });
|
||||
this.messaging.publicLivechatGlobal.chatbot.update({ currentStep: { data: nextStep.chatbot_step } });
|
||||
|
||||
this._chatbotProcessStep();
|
||||
} else {
|
||||
@@ -412,12 +412,12 @@ const _t = core._t;
|
||||
*/
|
||||
_sendWelcomeChatbotMessage(stepIndex, welcomeMessageDelay) {
|
||||
const chatbotStep = this.messaging.publicLivechatGlobal.chatbot.welcomeSteps[stepIndex];
|
||||
this.messaging.publicLivechatGlobal.chatbot.update({ currentStep: insertAndReplace({ data: chatbotStep }) });
|
||||
this.messaging.publicLivechatGlobal.chatbot.update({ currentStep: { data: chatbotStep } });
|
||||
|
||||
if (chatbotStep.chatbot_step_message) {
|
||||
this.messaging.publicLivechatGlobal.livechatButtonView.addMessage({
|
||||
id: '_welcome_' + stepIndex,
|
||||
is_discussion: true, // important for css style -> we only want white background for chatbot
|
||||
is_discussion: true, // important for css style -> we only want white background for chatbot
|
||||
author_id: (
|
||||
this.messaging.publicLivechatGlobal.publicLivechat.operator
|
||||
? [
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
import { addFields, patchRecordMethods } from '@mail/model/model_core';
|
||||
import { one } from '@mail/model/model_field';
|
||||
import { insertAndReplace } from '@mail/model/model_field_command';
|
||||
// ensure that the model definition is loaded before the patch
|
||||
import '@mail/models/discuss';
|
||||
|
||||
@@ -23,7 +22,7 @@ addFields('Discuss', {
|
||||
* Discuss sidebar category for `livechat` channel threads.
|
||||
*/
|
||||
categoryLivechat: one('DiscussSidebarCategory', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
inverse: 'discussAsLivechat',
|
||||
isCausal: true,
|
||||
}),
|
||||
|
||||
@@ -4,7 +4,7 @@ import PublicLivechatMessage from '@im_livechat/legacy/models/public_livechat_me
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, one } from '@mail/model/model_field';
|
||||
import { clear, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear } from '@mail/model/model_field_command';
|
||||
|
||||
import { qweb } from 'web.core';
|
||||
import { get_cookie, set_cookie, unaccent } from 'web.utils';
|
||||
@@ -55,7 +55,7 @@ registerModel({
|
||||
},
|
||||
askFeedback() {
|
||||
this.chatWindow.legacyChatWindow.$('.o_thread_composer input').prop('disabled', true);
|
||||
this.messaging.publicLivechatGlobal.update({ feedbackView: insertAndReplace() });
|
||||
this.messaging.publicLivechatGlobal.update({ feedbackView: {} });
|
||||
/**
|
||||
* When we enter the "ask feedback" process of the chat, we hide some elements that become
|
||||
* unnecessary and irrelevant (restart / end messages, any text field values, ...).
|
||||
@@ -164,7 +164,7 @@ registerModel({
|
||||
}
|
||||
const chatbotState = localStorage.getItem(this.messaging.publicLivechatGlobal.chatbotSessionCookieKey);
|
||||
if (chatbotState) {
|
||||
this.messaging.publicLivechatGlobal.chatbot.update({ currentStep: insertAndReplace({ data: this.messaging.publicLivechatGlobal.localStorageChatbotState._chatbotCurrentStep }) });
|
||||
this.messaging.publicLivechatGlobal.chatbot.update({ currentStep: { data: this.messaging.publicLivechatGlobal.localStorageChatbotState._chatbotCurrentStep } });
|
||||
}
|
||||
},
|
||||
closeChat() {
|
||||
@@ -191,7 +191,7 @@ registerModel({
|
||||
}
|
||||
},
|
||||
async openChatWindow() {
|
||||
this.update({ chatWindow: insertAndReplace() });
|
||||
this.update({ chatWindow: {} });
|
||||
await this.chatWindow.legacyChatWindow.appendTo($('body'));
|
||||
const cssProps = { bottom: 0 };
|
||||
cssProps[this.messaging.locale.textDirection === 'rtl' ? 'left' : 'right'] = 0;
|
||||
@@ -412,14 +412,14 @@ registerModel({
|
||||
}
|
||||
} else {
|
||||
this.messaging.publicLivechatGlobal.update({
|
||||
publicLivechat: insertAndReplace({ data: livechatData }),
|
||||
publicLivechat: { data: livechatData },
|
||||
});
|
||||
return this.openChatWindow().then(() => {
|
||||
if (!this.messaging.publicLivechatGlobal.history) {
|
||||
this.widget._sendWelcomeMessage();
|
||||
}
|
||||
this.widget._renderMessages();
|
||||
this.messaging.publicLivechatGlobal.update({ notificationHandler: insertAndReplace() });
|
||||
this.messaging.publicLivechatGlobal.update({ notificationHandler: {} });
|
||||
|
||||
set_cookie('im_livechat_session', unaccent(JSON.stringify(this.messaging.publicLivechatGlobal.publicLivechat.legacyPublicLivechat.toData()), true), 60 * 60);
|
||||
set_cookie('im_livechat_auto_popup', JSON.stringify(false), 60 * 60);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { patchModelMethods, patchRecordMethods } from '@mail/model/model_core';
|
||||
import { insertAndReplace } from '@mail/model/model_field_command';
|
||||
// ensure the model definition is loaded before the patch
|
||||
import '@mail/models/message';
|
||||
|
||||
@@ -15,10 +14,10 @@ patchModelMethods('Message', {
|
||||
if (data.author_id[2]) {
|
||||
// flux specific for livechat, a 3rd param is livechat_username
|
||||
// and means 2nd param (display_name) should be ignored
|
||||
data2.author = insertAndReplace({
|
||||
data2.author = {
|
||||
id: data.author_id[0],
|
||||
livechat_username: data.author_id[2],
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
return data2;
|
||||
|
||||
@@ -4,7 +4,7 @@ import PublicLivechat from '@im_livechat/legacy/models/public_livechat';
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, one } from '@mail/model/model_field';
|
||||
import { clear, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear } from '@mail/model/model_field_command';
|
||||
|
||||
registerModel({
|
||||
name: 'PublicLivechat',
|
||||
@@ -56,10 +56,10 @@ registerModel({
|
||||
if (!this.data.operator_pid[0]) {
|
||||
return clear();
|
||||
}
|
||||
return insertAndReplace({
|
||||
return {
|
||||
id: this.data.operator_pid[0],
|
||||
name: this.data.operator_pid[1],
|
||||
});
|
||||
};
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, many, one } from '@mail/model/model_field';
|
||||
import { clear, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear } from '@mail/model/model_field_command';
|
||||
|
||||
import { qweb } from 'web.core';
|
||||
|
||||
@@ -54,16 +54,16 @@ registerModel({
|
||||
*/
|
||||
_computeChatbot() {
|
||||
if (this.isTestChatbot) {
|
||||
return insertAndReplace({ data: this.testChatbotData.chatbot });
|
||||
return { data: this.testChatbotData.chatbot };
|
||||
}
|
||||
if (this.chatbotState === 'init') {
|
||||
return insertAndReplace({ data: this.rule.chatbot });
|
||||
return { data: this.rule.chatbot };
|
||||
}
|
||||
if (this.chatbotState === 'welcome') {
|
||||
return insertAndReplace({ data: this.livechatInit.rule.chatbot });
|
||||
return { data: this.livechatInit.rule.chatbot };
|
||||
}
|
||||
if (this.chatbotState === 'restore_session' && this.localStorageChatbotState) {
|
||||
return insertAndReplace({ data: this.localStorageChatbotState._chatbot });
|
||||
return { data: this.localStorageChatbotState._chatbot };
|
||||
}
|
||||
return clear();
|
||||
},
|
||||
@@ -106,7 +106,7 @@ registerModel({
|
||||
*/
|
||||
_computeLivechatButtonView() {
|
||||
if (this.isAvailable && this.isAvailableForMe && this.hasLoadedQWebTemplate && this.env.services.public_livechat_service) {
|
||||
return insertAndReplace();
|
||||
return {};
|
||||
}
|
||||
return clear();
|
||||
},
|
||||
@@ -193,9 +193,9 @@ registerModel({
|
||||
// -> initialize necessary state
|
||||
if (this.rule.chatbot_welcome_steps && this.rule.chatbot_welcome_steps.length !== 0) {
|
||||
this.chatbot.update({
|
||||
currentStep: insertAndReplace({
|
||||
currentStep: {
|
||||
data: this.chatbot.lastWelcomeStep,
|
||||
}),
|
||||
},
|
||||
});
|
||||
}
|
||||
} else if (this.chatbotState === 'welcome') {
|
||||
|
||||
@@ -4,7 +4,6 @@ import PublicLivechatWindow from '@im_livechat/legacy/widgets/public_livechat_wi
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, one } from '@mail/model/model_field';
|
||||
import { insertAndReplace } from '@mail/model/model_field_command';
|
||||
|
||||
registerModel({
|
||||
name: 'PublicLivechatWindow',
|
||||
@@ -46,7 +45,7 @@ registerModel({
|
||||
inverse: 'chatWindow',
|
||||
}),
|
||||
publicLivechatView: one('PublicLivechatView', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
inverse: 'publicLivechatWindowOwner',
|
||||
isCausal: true,
|
||||
}),
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { addFields, addRecordMethods, patchModelMethods, patchRecordMethods } from '@mail/model/model_core';
|
||||
import { one } from '@mail/model/model_field';
|
||||
import { clear, insert, link, unlink } from '@mail/model/model_field_command';
|
||||
import { clear } from '@mail/model/model_field_command';
|
||||
// ensure that the model definition is loaded before the patch
|
||||
import '@mail/models/thread';
|
||||
|
||||
@@ -57,19 +57,18 @@ patchModelMethods('Thread', {
|
||||
* of polluting the database, it is therefore acceptable and
|
||||
* easier to handle one temporary partner per channel.
|
||||
*/
|
||||
data2.members.push(unlink(this.messaging.publicPartners));
|
||||
const partner = this.messaging.models['Partner'].insert(
|
||||
Object.assign(
|
||||
this.messaging.models['Partner'].convertData(data.livechat_visitor),
|
||||
{ id: this.messaging.models['Partner'].getNextPublicId() }
|
||||
)
|
||||
const publicPartnerIds = this.messaging.publicPartners.map(partner => partner.id);
|
||||
data2.members = data2.members.filter(partnerData => !publicPartnerIds.includes(partnerData.id));
|
||||
const partnerData = Object.assign(
|
||||
this.messaging.models['Partner'].convertData(data.livechat_visitor),
|
||||
{ id: this.messaging.models['Partner'].getNextPublicId() }
|
||||
);
|
||||
data2.members.push(link(partner));
|
||||
data2.correspondent = partner;
|
||||
data2.members.push(partnerData);
|
||||
data2.correspondent = partnerData;
|
||||
} else {
|
||||
const partnerData = this.messaging.models['Partner'].convertData(data.livechat_visitor);
|
||||
data2.members.push(insert(partnerData));
|
||||
data2.correspondent = insert(partnerData);
|
||||
data2.members.push(partnerData);
|
||||
data2.correspondent = partnerData;
|
||||
}
|
||||
}
|
||||
return data2;
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
import { publicLivechatService } from '@im_livechat/services/public_livechat_service';
|
||||
import { isAvailable, options, serverUrl } from 'im_livechat.loaderData';
|
||||
|
||||
import { insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { messagingService } from '@mail/services/messaging_service';
|
||||
import { makeMessagingToLegacyEnv } from '@mail/utils/make_messaging_to_legacy_env';
|
||||
|
||||
@@ -12,7 +11,7 @@ import { registry } from '@web/core/registry';
|
||||
const messagingValuesService = {
|
||||
start() {
|
||||
return {
|
||||
publicLivechatGlobal: insertAndReplace({ isAvailable, options, serverUrl }),
|
||||
publicLivechatGlobal: { isAvailable, options, serverUrl },
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
@@ -43,7 +43,7 @@ class TestImLivechatMessage(TransactionCase):
|
||||
rating_id=record_rating.id,
|
||||
)
|
||||
self.assertEqual(message.message_format(), [{
|
||||
'attachment_ids': [('insert-and-replace', [])],
|
||||
'attachment_ids': [],
|
||||
'author_id': (self.users[1].partner_id.id, "test1"),
|
||||
'body': message.body,
|
||||
'date': message.date,
|
||||
@@ -53,16 +53,16 @@ class TestImLivechatMessage(TransactionCase):
|
||||
'is_note': True,
|
||||
'is_notification': False,
|
||||
'message_type': 'notification',
|
||||
'messageReactionGroups': [('insert-and-replace', [])],
|
||||
'messageReactionGroups': [],
|
||||
'model': 'mail.channel',
|
||||
'module_icon': '/mail/static/description/icon.png',
|
||||
'needaction_partner_ids': [],
|
||||
'notifications': [],
|
||||
'rating': [('insert-and-replace', {
|
||||
'rating': {
|
||||
'id': record_rating.id,
|
||||
'ratingImageUrl': record_rating.rating_image_url,
|
||||
'ratingText': record_rating.rating_text,
|
||||
})],
|
||||
},
|
||||
'recipients': [],
|
||||
'record_name': "test1 Ernest Employee",
|
||||
'res_id': channel_livechat_1.id,
|
||||
@@ -71,5 +71,5 @@ class TestImLivechatMessage(TransactionCase):
|
||||
'subject': False,
|
||||
'subtype_description': False,
|
||||
'subtype_id': (self.env.ref('mail.mt_note').id, 'Note'),
|
||||
'trackingValues': [('insert-and-replace', [])],
|
||||
'trackingValues': [],
|
||||
}])
|
||||
|
||||
@@ -245,7 +245,7 @@ class DiscussController(http.Controller):
|
||||
return {
|
||||
'id': message_sudo.id,
|
||||
'body': message_sudo.body,
|
||||
'attachments': [('insert-and-replace', message_sudo.attachment_ids._attachment_format())],
|
||||
'attachments': message_sudo.attachment_ids._attachment_format(),
|
||||
}
|
||||
|
||||
@http.route('/mail/attachment/upload', methods=['POST'], type='http', auth='public')
|
||||
@@ -334,7 +334,7 @@ class DiscussController(http.Controller):
|
||||
'content': content,
|
||||
'count': len(reactions),
|
||||
'guests': guests,
|
||||
'message': [('insert-and-replace', {'id', message_sudo.id})],
|
||||
'message': {'id', message_sudo.id},
|
||||
'partners': partners,
|
||||
})],
|
||||
}
|
||||
@@ -362,7 +362,7 @@ class DiscussController(http.Controller):
|
||||
'content': content,
|
||||
'count': len(reactions),
|
||||
'guests': guests,
|
||||
'message': [('insert-and-replace', {'id': message_sudo.id})],
|
||||
'message': {'id': message_sudo.id},
|
||||
'partners': partners,
|
||||
})],
|
||||
}
|
||||
|
||||
@@ -634,7 +634,7 @@ class Channel(models.Model):
|
||||
self.env['bus.bus']._sendone(self, 'mail.message/insert', {
|
||||
'id': message.id,
|
||||
'body': message.body,
|
||||
'attachments': [('insert-and-replace', message.attachment_ids._attachment_format())],
|
||||
'attachments': message.attachment_ids._attachment_format(),
|
||||
})
|
||||
return super()._message_update_content_after_hook(message=message)
|
||||
|
||||
@@ -653,7 +653,7 @@ class Channel(models.Model):
|
||||
'content': content,
|
||||
'count': len(reactions),
|
||||
'guests': guests,
|
||||
'message': [('insert-and-replace', {'id': message.id})],
|
||||
'message': {'id': message.id},
|
||||
'partners': partners,
|
||||
})],
|
||||
})
|
||||
@@ -674,7 +674,7 @@ class Channel(models.Model):
|
||||
'content': content,
|
||||
'count': len(reactions),
|
||||
'guests': guests,
|
||||
'message': [('insert-and-replace', {'id': message.id})],
|
||||
'message': {'id': message.id},
|
||||
'partners': partners,
|
||||
})],
|
||||
})
|
||||
@@ -823,7 +823,7 @@ class Channel(models.Model):
|
||||
'rtcSessions': [('insert', rtc_sessions_by_channel.get(channel, []))],
|
||||
})
|
||||
|
||||
info['channel'] = [('insert-and-replace', channel_data)]
|
||||
info['channel'] = channel_data
|
||||
|
||||
channel_infos.append(info)
|
||||
return channel_infos
|
||||
|
||||
@@ -125,24 +125,24 @@ class ChannelMember(models.Model):
|
||||
for member in self:
|
||||
if member.partner_id:
|
||||
persona = {
|
||||
'partner': [('insert-and-replace', {
|
||||
'partner': {
|
||||
'id': member.partner_id.id,
|
||||
'name': member.partner_id.name,
|
||||
'im_status': member.partner_id.im_status,
|
||||
})],
|
||||
},
|
||||
}
|
||||
if member.guest_id:
|
||||
persona = {
|
||||
'guest': [('insert-and-replace', {
|
||||
'guest': {
|
||||
'id': member.guest_id.id,
|
||||
'name': member.guest_id.name,
|
||||
'im_status': member.guest_id.im_status,
|
||||
})],
|
||||
},
|
||||
}
|
||||
members_formatted_data.append({
|
||||
'id': member.id,
|
||||
'channel': [('insert-and-replace', {'id': member.channel_id.id})],
|
||||
'persona': [('insert-and-replace', persona)],
|
||||
'channel': {'id': member.channel_id.id},
|
||||
'persona': persona,
|
||||
})
|
||||
return members_formatted_data
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ class MailRtcSession(models.Model):
|
||||
self.ensure_one()
|
||||
vals = {
|
||||
'id': self.id,
|
||||
'channelMember': [('insert-and-replace', self.channel_member_id.mail_channel_member_format()[0])],
|
||||
'channelMember': self.channel_member_id.mail_channel_member_format()[0],
|
||||
}
|
||||
if complete_info:
|
||||
vals.update({
|
||||
|
||||
@@ -869,20 +869,20 @@ class Message(models.Model):
|
||||
reactions_per_content = defaultdict(lambda: self.env['mail.message.reaction'])
|
||||
for reaction in message_sudo.reaction_ids:
|
||||
reactions_per_content[reaction.content] |= reaction
|
||||
reaction_groups = [('insert-and-replace', [{
|
||||
reaction_groups = [{
|
||||
'content': content,
|
||||
'count': len(reactions),
|
||||
'guests': [('insert-and-replace', [{'id': guest.id, 'name': guest.name} for guest in reactions.guest_id])],
|
||||
'message': [('insert-and-replace', {'id': message_sudo.id})],
|
||||
'partners': [('insert-and-replace', [{'id': partner.id, 'name': partner.name} for partner in reactions.partner_id])],
|
||||
} for content, reactions in reactions_per_content.items()])]
|
||||
'guests': [{'id': guest.id, 'name': guest.name} for guest in reactions.guest_id],
|
||||
'message': {'id': message_sudo.id},
|
||||
'partners': [{'id': partner.id, 'name': partner.name} for partner in reactions.partner_id],
|
||||
} for content, reactions in reactions_per_content.items()]
|
||||
if format_reply and message_sudo.model == 'mail.channel' and message_sudo.parent_id:
|
||||
vals['parentMessage'] = message_sudo.parent_id.message_format(format_reply=False)[0]
|
||||
allowed_tracking_ids = message_sudo.tracking_value_ids.filtered(lambda tracking: not tracking.field_groups or self.env.is_superuser() or self.user_has_groups(tracking.field_groups))
|
||||
vals.update({
|
||||
'notifications': message_sudo.notification_ids._filtered_for_web_client()._notification_format(),
|
||||
'attachment_ids': [('insert-and-replace', message_sudo.attachment_ids._attachment_format())] if not legacy else message_sudo.attachment_ids._attachment_format(legacy=True),
|
||||
'trackingValues': [('insert-and-replace', allowed_tracking_ids._tracking_value_format())],
|
||||
'attachment_ids': message_sudo.attachment_ids._attachment_format() if not legacy else message_sudo.attachment_ids._attachment_format(legacy=True),
|
||||
'trackingValues': allowed_tracking_ids._tracking_value_format(),
|
||||
'messageReactionGroups': reaction_groups,
|
||||
'record_name': record_name,
|
||||
})
|
||||
@@ -913,30 +913,30 @@ class Message(models.Model):
|
||||
'body': HTML content of the message
|
||||
'model': u'res.partner',
|
||||
'record_name': u'Agrolait',
|
||||
'attachment_ids': [('insert-and-replace', [
|
||||
'attachment_ids': [
|
||||
{
|
||||
'file_type_icon': u'webimage',
|
||||
'id': 45,
|
||||
'name': u'sample.png',
|
||||
'filename': u'sample.png'
|
||||
}
|
||||
])],
|
||||
],
|
||||
'needaction_partner_ids': [], # list of partner ids
|
||||
'res_id': 7,
|
||||
'trackingValues': [('insert-and-replace',
|
||||
'trackingValues': [
|
||||
{
|
||||
'changedField': "Customer",
|
||||
'id': 2965,
|
||||
'newValue': [('insert-and-replace', {
|
||||
'newValue': {
|
||||
'currencyId': "",
|
||||
'fieldType': 'char',
|
||||
'value': "Axelor",
|
||||
})],
|
||||
'oldValue': [('insert-and-replace', {
|
||||
],
|
||||
'oldValue': {
|
||||
'currencyId': "",
|
||||
'fieldType': 'char',
|
||||
'value': "",
|
||||
})],
|
||||
],
|
||||
}
|
||||
],
|
||||
'author_id': (3, u'Administrator'),
|
||||
|
||||
@@ -3164,7 +3164,7 @@ class MailThread(models.AbstractModel):
|
||||
res['activities'] = self.activity_ids.activity_format()
|
||||
if 'attachments' in request_list:
|
||||
res['attachments'] = self._get_mail_thread_data_attachments()._attachment_format()
|
||||
res['mainAttachment'] = [('insert-and-replace', {'id': self.message_main_attachment_id.id})] if self.message_main_attachment_id else [('clear',)]
|
||||
res['mainAttachment'] = {'id': self.message_main_attachment_id.id} if self.message_main_attachment_id else [('clear',)]
|
||||
if 'followers' in request_list:
|
||||
res['followers'] = [{
|
||||
'id': follower.id,
|
||||
|
||||
@@ -92,14 +92,16 @@ class MailTracking(models.Model):
|
||||
tracking_values = [{
|
||||
'changedField': tracking.field_desc,
|
||||
'id': tracking.id,
|
||||
'newValue': [('insert-and-replace', {
|
||||
'newValue': {
|
||||
'currencyId': tracking.currency_id.id,
|
||||
'fieldType': tracking.field_type,
|
||||
'value': tracking._get_new_display_value()[0]})],
|
||||
'oldValue': [('insert-and-replace', {
|
||||
'value': tracking._get_new_display_value()[0],
|
||||
},
|
||||
'oldValue': {
|
||||
'currencyId': tracking.currency_id.id,
|
||||
'fieldType': tracking.field_type,
|
||||
'value': tracking._get_old_display_value()[0]})],
|
||||
'value': tracking._get_old_display_value()[0],
|
||||
},
|
||||
} for tracking in self]
|
||||
return tracking_values
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ class ResUsersSettings(models.Model):
|
||||
fields_to_format = [name for name, field in self._fields.items() if name == 'id' or not field.automatic]
|
||||
res = self._read_format(fnames=fields_to_format)[0]
|
||||
if 'user_id' in fields_to_format:
|
||||
res['user_id'] = [('insert-and-replace', {'id': self.user_id.id})]
|
||||
res['user_id'] = {'id': self.user_id.id}
|
||||
if 'volume_settings_ids' in fields_to_format:
|
||||
volume_settings = self.volume_settings_ids._discuss_users_settings_volume_format()
|
||||
res['volume_settings_ids'] = [('insert', volume_settings)]
|
||||
|
||||
@@ -26,15 +26,15 @@ class ResUsersSettingsVolumes(models.Model):
|
||||
return [{
|
||||
'id': volume_setting.id,
|
||||
'volume': volume_setting.volume,
|
||||
'guest_id': [('insert-and-replace', {
|
||||
'guest_id': {
|
||||
'id': volume_setting.guest_id.id,
|
||||
'name': volume_setting.guest_id.name,
|
||||
})] if volume_setting.guest_id else [('clear',)],
|
||||
'partner_id': [('insert-and-replace', {
|
||||
} if volume_setting.guest_id else [('clear',)],
|
||||
'partner_id': {
|
||||
'id': volume_setting.partner_id.id,
|
||||
'name': volume_setting.partner_id.name,
|
||||
})] if volume_setting.partner_id else [('clear',)],
|
||||
'user_setting_id': [('insert-and-replace', {
|
||||
} if volume_setting.partner_id else [('clear',)],
|
||||
'user_setting_id': {
|
||||
'id': volume_setting.user_setting_id.id,
|
||||
})],
|
||||
},
|
||||
} for volume_setting in self]
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
import { useModels } from '@mail/component_hooks/use_models';
|
||||
// ensure component is registered before-hand
|
||||
import '@mail/components/discuss/discuss';
|
||||
import { insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { getMessagingComponent } from "@mail/utils/messaging_component";
|
||||
|
||||
const { Component, onWillDestroy } = owl;
|
||||
@@ -25,9 +24,9 @@ export class DiscussContainer extends Component {
|
||||
'mail.box_inbox';
|
||||
this.discuss = this.messaging.discuss;
|
||||
this.discuss.update({
|
||||
discussView: insertAndReplace({
|
||||
discussView: {
|
||||
actionId: action.id,
|
||||
}),
|
||||
},
|
||||
initActiveId,
|
||||
});
|
||||
// Wait for messaging to be initialized to make sure the system
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
*/
|
||||
|
||||
export const registry = new Map();
|
||||
|
||||
export const IS_RECORD = Symbol("Record");
|
||||
|
||||
/**
|
||||
* Concats `contextMessage` at the beginning of any error raising when calling
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { clear, FieldCommand, link, unlink, unlinkAll } from '@mail/model/model_field_command';
|
||||
import { IS_RECORD } from '@mail/model/model_core';
|
||||
|
||||
/**
|
||||
* Class whose instances represent field on a model.
|
||||
@@ -261,9 +262,20 @@ export class ModelField {
|
||||
} else if (newVal instanceof Array && newVal[0] instanceof FieldCommand) {
|
||||
return newVal;
|
||||
} else if (this.fieldType === 'relation') {
|
||||
if (newVal instanceof Array && newVal[0] && ['clear', 'insert', 'insert-and-replace', 'insert-and-unlink', 'link', 'replace', 'unlink', 'unlink-all'].includes(newVal[0][0])) {
|
||||
if (newVal instanceof Array && newVal[0] instanceof Array && ['clear', 'insert', 'insert-and-replace', 'insert-and-unlink', 'link', 'replace', 'unlink', 'unlink-all'].includes(newVal[0][0])) {
|
||||
// newVal: [['insert', ...], ...]
|
||||
return newVal.map(([name, value]) => new FieldCommand(name, value));
|
||||
} else if (newVal instanceof Array && newVal[0] && !newVal[0][IS_RECORD]) {
|
||||
// newVal: [data, ...]
|
||||
return [new FieldCommand('insert-and-replace', newVal)];
|
||||
} else if (newVal instanceof Array && newVal[0]) {
|
||||
// newVal: [record, ...]
|
||||
return [new FieldCommand('replace', newVal)];
|
||||
} else if (!newVal[IS_RECORD]) {
|
||||
// newVal: data
|
||||
return [new FieldCommand('insert-and-replace', newVal)];
|
||||
} else {
|
||||
// newVal: record
|
||||
return [new FieldCommand('replace', newVal)];
|
||||
}
|
||||
} else {
|
||||
@@ -846,7 +858,7 @@ export class ModelField {
|
||||
if (!record) {
|
||||
throw Error(`record is undefined. Did you try to link() or insert() empty value? Considering clear() instead.`);
|
||||
}
|
||||
if (!record.modelManager) {
|
||||
if (!record[IS_RECORD]) {
|
||||
throw Error(`${record} is not a record. Did you try to use link() instead of insert() with data?`);
|
||||
}
|
||||
const otherModel = record.modelManager.models[this.to];
|
||||
|
||||
@@ -93,20 +93,6 @@ function insert(data) {
|
||||
return new FieldCommand('insert', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a insert-and-replace command to give to the model manager at create/update.
|
||||
* `insertAndReplace` command can be used for relation fields.
|
||||
* - Create new record(s) from data if the record(s) do not exist;
|
||||
* - or update the record(s) if they can be found from identifying data;
|
||||
* - and then replace the record(s) for a relation field.
|
||||
*
|
||||
* @param {Object|Object[]} [data={}] - data object or data objects array to insert and replace record(s).
|
||||
* @returns {FieldCommand}
|
||||
*/
|
||||
function insertAndReplace(data = {}) {
|
||||
return new FieldCommand('insert-and-replace', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a insert-and-unlink command to give to the model manager at create/update.
|
||||
* `insertAndUnlink` command can be used for relation fields.
|
||||
@@ -179,7 +165,6 @@ export {
|
||||
decrement,
|
||||
increment,
|
||||
insert,
|
||||
insertAndReplace,
|
||||
link,
|
||||
set,
|
||||
unlink,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { registry } from '@mail/model/model_core';
|
||||
import { IS_RECORD, registry } from '@mail/model/model_core';
|
||||
import { ModelField } from '@mail/model/model_field';
|
||||
import { ModelIndexAnd } from '@mail/model/model_index_and';
|
||||
import { ModelIndexXor } from '@mail/model/model_index_xor';
|
||||
@@ -642,6 +642,7 @@ export class ModelManager {
|
||||
__listeners: [],
|
||||
// Field values of record.
|
||||
__values: {},
|
||||
[IS_RECORD]: true,
|
||||
});
|
||||
const record = owl.markRaw(!this.isDebug ? nonProxyRecord : new Proxy(nonProxyRecord, {
|
||||
get: function getFromProxy(record, prop) {
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, many, one } from '@mail/model/model_field';
|
||||
import { insertAndReplace } from '@mail/model/model_field_command';
|
||||
|
||||
registerModel({
|
||||
name: 'ActivityBoxView',
|
||||
@@ -19,9 +18,9 @@ registerModel({
|
||||
* @returns {FieldCommand}
|
||||
*/
|
||||
_computeActivityViews() {
|
||||
return insertAndReplace(this.chatter.thread.activities.map(activity => {
|
||||
return this.chatter.thread.activities.map(activity => {
|
||||
return { activity };
|
||||
}));
|
||||
});
|
||||
},
|
||||
},
|
||||
fields: {
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, many, one } from '@mail/model/model_field';
|
||||
import { insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { OnChange } from '@mail/model/model_onchange';
|
||||
|
||||
registerModel({
|
||||
@@ -12,12 +11,12 @@ registerModel({
|
||||
return {
|
||||
actions: data.actions,
|
||||
domain: data.domain,
|
||||
irModel: insertAndReplace({
|
||||
irModel: {
|
||||
iconUrl: data.icon,
|
||||
id: data.id,
|
||||
model: data.model,
|
||||
name: data.name,
|
||||
}),
|
||||
},
|
||||
overdue_count: data.overdue_count,
|
||||
planned_count: data.planned_count,
|
||||
today_count: data.today_count,
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, many } from '@mail/model/model_field';
|
||||
import { insertAndReplace } from '@mail/model/model_field_command';
|
||||
|
||||
import session from 'web.session';
|
||||
|
||||
@@ -29,7 +28,7 @@ registerModel({
|
||||
kwargs: { context: session.user_context },
|
||||
});
|
||||
this.update({
|
||||
activityGroups: insertAndReplace(data.map(vals => this.messaging.models['ActivityGroup'].convertData(vals))),
|
||||
activityGroups: data.map(vals => this.messaging.models['ActivityGroup'].convertData(vals)),
|
||||
extraCount: 0,
|
||||
});
|
||||
},
|
||||
@@ -68,11 +67,11 @@ registerModel({
|
||||
* @returns {FieldCommand}
|
||||
*/
|
||||
_computeActivityGroupViews() {
|
||||
return insertAndReplace(this.activityGroups.map(activityGroup => {
|
||||
return this.activityGroups.map(activityGroup => {
|
||||
return {
|
||||
activityGroup,
|
||||
};
|
||||
}));
|
||||
});
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, many, one } from '@mail/model/model_field';
|
||||
import { clear, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear } from '@mail/model/model_field_command';
|
||||
|
||||
import { auto_str_to_date, getLangDateFormat, getLangDatetimeFormat } from 'web.time';
|
||||
import { sprintf } from '@web/core/utils/strings';
|
||||
@@ -57,7 +57,7 @@ registerModel({
|
||||
}
|
||||
},
|
||||
onClickMarkDoneButton() {
|
||||
this.update({ markDonePopoverView: this.markDonePopoverView ? clear() : insertAndReplace() });
|
||||
this.update({ markDonePopoverView: this.markDonePopoverView ? clear() : {} });
|
||||
},
|
||||
/**
|
||||
* Handles the click on the upload document button. This open the file
|
||||
@@ -108,7 +108,7 @@ registerModel({
|
||||
* @returns {FieldCommand}
|
||||
*/
|
||||
_computeFileUploader() {
|
||||
return this.activity.category === 'upload_file' ? insertAndReplace() : clear();
|
||||
return this.activity.category === 'upload_file' ? {} : clear();
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
@@ -139,14 +139,7 @@ registerModel({
|
||||
* @returns {FieldCommand}
|
||||
*/
|
||||
_computeMailTemplateViews() {
|
||||
if (this.activity.mailTemplates.length === 0) {
|
||||
return clear();
|
||||
}
|
||||
return insertAndReplace(
|
||||
this.activity.mailTemplates.map(
|
||||
mailTemplate => ({ mailTemplate })
|
||||
),
|
||||
);
|
||||
return this.activity.mailTemplates.map(mailTemplate => ({ mailTemplate }));
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
@@ -188,11 +181,11 @@ registerModel({
|
||||
compute: '_computeAssignedUserText',
|
||||
}),
|
||||
clockWatcher: one('ClockWatcher', {
|
||||
default: insertAndReplace({
|
||||
clock: insertAndReplace({
|
||||
default: {
|
||||
clock: {
|
||||
frequency: 60 * 1000,
|
||||
}),
|
||||
}),
|
||||
},
|
||||
},
|
||||
inverse: 'activityViewOwner',
|
||||
isCausal: true,
|
||||
}),
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, one } from '@mail/model/model_field';
|
||||
import { clear, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear } from '@mail/model/model_field_command';
|
||||
|
||||
registerModel({
|
||||
name: 'AttachmentBoxView',
|
||||
@@ -19,7 +19,7 @@ registerModel({
|
||||
*/
|
||||
_computeAttachmentList() {
|
||||
return (this.chatter.thread && this.chatter.thread.allAttachments.length > 0)
|
||||
? insertAndReplace()
|
||||
? {}
|
||||
: clear();
|
||||
},
|
||||
},
|
||||
@@ -42,7 +42,7 @@ registerModel({
|
||||
*/
|
||||
component: attr(),
|
||||
fileUploader: one('FileUploader', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
inverse: 'attachmentBoxView',
|
||||
isCausal: true,
|
||||
readonly: true,
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, one } from '@mail/model/model_field';
|
||||
import { insertAndReplace } from '@mail/model/model_field_command';
|
||||
|
||||
registerModel({
|
||||
name: 'AttachmentCard',
|
||||
@@ -15,7 +14,7 @@ registerModel({
|
||||
return;
|
||||
}
|
||||
this.attachmentList.update({
|
||||
attachmentListViewDialog: insertAndReplace(),
|
||||
attachmentListViewDialog: {},
|
||||
selectedAttachment: this.attachment,
|
||||
});
|
||||
},
|
||||
@@ -32,7 +31,7 @@ registerModel({
|
||||
if (this.attachmentList.composerViewOwner) {
|
||||
this.attachment.remove();
|
||||
} else {
|
||||
this.update({ attachmentDeleteConfirmDialog: insertAndReplace() });
|
||||
this.update({ attachmentDeleteConfirmDialog: {} });
|
||||
}
|
||||
},
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, one } from '@mail/model/model_field';
|
||||
import { clear, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear } from '@mail/model/model_field_command';
|
||||
import { isEventHandled, markEventHandled } from '@mail/utils/utils';
|
||||
|
||||
registerModel({
|
||||
@@ -36,7 +36,7 @@ registerModel({
|
||||
return;
|
||||
}
|
||||
this.attachmentList.update({
|
||||
attachmentListViewDialog: insertAndReplace(),
|
||||
attachmentListViewDialog: {},
|
||||
selectedAttachment: this.attachment,
|
||||
});
|
||||
},
|
||||
@@ -53,7 +53,7 @@ registerModel({
|
||||
if (this.attachmentList.composerViewOwner) {
|
||||
this.attachment.remove();
|
||||
} else {
|
||||
this.update({ attachmentDeleteConfirmDialog: insertAndReplace() });
|
||||
this.update({ attachmentDeleteConfirmDialog: {} });
|
||||
}
|
||||
},
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, many, one } from '@mail/model/model_field';
|
||||
import { clear, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear } from '@mail/model/model_field_command';
|
||||
|
||||
registerModel({
|
||||
name: 'AttachmentList',
|
||||
@@ -25,18 +25,10 @@ registerModel({
|
||||
this.update({ selectedAttachment: this.attachments[prevIndex] });
|
||||
},
|
||||
_computeAttachmentImages() {
|
||||
return insertAndReplace(this.imageAttachments.map(attachment => {
|
||||
return {
|
||||
attachment,
|
||||
};
|
||||
}));
|
||||
return this.imageAttachments.map(attachment => ({ attachment }));
|
||||
},
|
||||
_computeAttachmentCards() {
|
||||
return insertAndReplace(this.nonImageAttachments.map(attachment => {
|
||||
return {
|
||||
attachment,
|
||||
};
|
||||
}));
|
||||
return this.nonImageAttachments.map(attachment => ({ attachment }));
|
||||
},
|
||||
/**
|
||||
* @returns {FieldCommand}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, many, one } from '@mail/model/model_field';
|
||||
import { clear, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear } from '@mail/model/model_field_command';
|
||||
|
||||
registerModel({
|
||||
name: 'AttachmentViewer',
|
||||
@@ -184,9 +184,9 @@ registerModel({
|
||||
*/
|
||||
_computeAttachmentViewerViewable() {
|
||||
if (this.attachmentList) {
|
||||
return insertAndReplace({
|
||||
return {
|
||||
attachmentOwner: this.attachmentList.selectedAttachment,
|
||||
});
|
||||
};
|
||||
}
|
||||
return clear();
|
||||
},
|
||||
@@ -195,11 +195,9 @@ registerModel({
|
||||
*/
|
||||
_computeAttachmentViewerViewables() {
|
||||
if (this.attachmentList) {
|
||||
return insertAndReplace(
|
||||
this.attachmentList.viewableAttachments.map((attachment) => {
|
||||
return { attachmentOwner: attachment };
|
||||
})
|
||||
);
|
||||
return this.attachmentList.viewableAttachments.map(attachment => {
|
||||
return { attachmentOwner: attachment };
|
||||
});
|
||||
}
|
||||
return clear();
|
||||
},
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, one } from '@mail/model/model_field';
|
||||
import { clear, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear } from '@mail/model/model_field_command';
|
||||
|
||||
registerModel({
|
||||
name: 'CallActionListView',
|
||||
@@ -175,7 +175,7 @@ registerModel({
|
||||
compute: '_computeMicrophoneButtonTitle',
|
||||
}),
|
||||
callOptionMenu: one('CallOptionMenu', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
inverse: 'callActionListView',
|
||||
isCausal: true,
|
||||
}),
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, many, one } from '@mail/model/model_field';
|
||||
import { clear, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear } from '@mail/model/model_field_command';
|
||||
|
||||
import { isEventHandled, markEventHandled } from '@mail/utils/utils';
|
||||
|
||||
@@ -109,7 +109,10 @@ registerModel({
|
||||
});
|
||||
},
|
||||
onShowOverlayTimeout() {
|
||||
this.update({ showOverlay: false });
|
||||
this.update({
|
||||
showOverlay: false,
|
||||
showOverlayTimer: clear(),
|
||||
});
|
||||
},
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
@@ -135,9 +138,9 @@ registerModel({
|
||||
*/
|
||||
_computeMainTiles() {
|
||||
if (this.callView.activeRtcSession) {
|
||||
return insertAndReplace([{ channelMember: this.callView.activeRtcSession.channelMember }]);
|
||||
return [{ channelMember: this.callView.activeRtcSession.channelMember }];
|
||||
}
|
||||
return insertAndReplace(this.callView.filteredChannelMembers.map(channelMember => ({ channelMember })));
|
||||
return this.callView.filteredChannelMembers.map(channelMember => ({ channelMember }));
|
||||
},
|
||||
/**
|
||||
* Shows the overlay (buttons) for a set a mount of time.
|
||||
@@ -147,7 +150,7 @@ registerModel({
|
||||
_showOverlay() {
|
||||
this.update({
|
||||
showOverlay: true,
|
||||
showOverlayTimer: [clear(), insertAndReplace()],
|
||||
showOverlayTimer: { doReset: this.showOverlayTimer ? true : undefined },
|
||||
});
|
||||
},
|
||||
},
|
||||
@@ -156,7 +159,7 @@ registerModel({
|
||||
* The model for the controller (buttons).
|
||||
*/
|
||||
callActionListView: one('CallActionListView', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
inverse: 'callMainView',
|
||||
isCausal: true,
|
||||
readonly: true,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { one } from '@mail/model/model_field';
|
||||
|
||||
registerModel({
|
||||
@@ -15,7 +14,7 @@ registerModel({
|
||||
identifying: true,
|
||||
}),
|
||||
participantCard: one('CallParticipantCard', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
inverse: 'mainViewTileOwner',
|
||||
isCausal: true,
|
||||
}),
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, one } from '@mail/model/model_field';
|
||||
import { clear, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear } from '@mail/model/model_field_command';
|
||||
import { isEventHandled, markEventHandled } from '@mail/utils/utils';
|
||||
|
||||
import { sprintf } from '@web/core/utils/strings';
|
||||
@@ -145,7 +145,7 @@ registerModel({
|
||||
*/
|
||||
_computeCallParticipantVideoView() {
|
||||
if (this.rtcSession && this.rtcSession.videoStream) {
|
||||
return insertAndReplace();
|
||||
return {};
|
||||
}
|
||||
return clear();
|
||||
},
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { many, one } from '@mail/model/model_field';
|
||||
import { insertAndReplace } from '@mail/model/model_field_command';
|
||||
|
||||
registerModel({
|
||||
name: 'CallSidebarView',
|
||||
@@ -12,7 +11,7 @@ registerModel({
|
||||
* @returns {FieldCommand}
|
||||
*/
|
||||
_computeSidebarTiles() {
|
||||
return insertAndReplace(this.callView.filteredChannelMembers.map(channelMember => ({ channelMember })));
|
||||
return this.callView.filteredChannelMembers.map(channelMember => ({ channelMember }));
|
||||
},
|
||||
},
|
||||
fields: {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { one } from '@mail/model/model_field';
|
||||
|
||||
registerModel({
|
||||
@@ -15,7 +14,7 @@ registerModel({
|
||||
identifying: true,
|
||||
}),
|
||||
participantCard: one('CallParticipantCard', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
inverse: 'sidebarViewTileOwner',
|
||||
isCausal: true,
|
||||
}),
|
||||
|
||||
@@ -5,7 +5,7 @@ import { browser } from "@web/core/browser/browser";
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, many, one } from '@mail/model/model_field';
|
||||
import { OnChange } from '@mail/model/model_onchange';
|
||||
import { clear, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear } from '@mail/model/model_field_command';
|
||||
|
||||
registerModel({
|
||||
name: 'CallView',
|
||||
@@ -80,7 +80,7 @@ registerModel({
|
||||
*/
|
||||
_computeCallSideBarView() {
|
||||
if (this.activeRtcSession && this.isSidebarOpen && !this.threadView.compact) {
|
||||
return insertAndReplace();
|
||||
return {};
|
||||
}
|
||||
return clear();
|
||||
},
|
||||
@@ -163,7 +163,7 @@ registerModel({
|
||||
compute: '_computeAspectRatio',
|
||||
}),
|
||||
callMainView: one('CallMainView', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
inverse: 'callView',
|
||||
isCausal: true,
|
||||
readonly: true,
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, one } from '@mail/model/model_field';
|
||||
import { insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { cleanSearchTerm } from '@mail/utils/utils';
|
||||
|
||||
registerModel({
|
||||
@@ -82,7 +81,7 @@ registerModel({
|
||||
*/
|
||||
substitution: attr(),
|
||||
suggestable: one('ComposerSuggestable', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
inverse: 'cannedResponse',
|
||||
isCausal: true,
|
||||
readonly: true,
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, one, many } from '@mail/model/model_field';
|
||||
import { insertAndReplace } from '@mail/model/model_field_command';
|
||||
|
||||
registerModel({
|
||||
name: 'Channel',
|
||||
@@ -44,10 +43,10 @@ registerModel({
|
||||
* @returns {FieldCommand}
|
||||
*/
|
||||
_computeThread() {
|
||||
return insertAndReplace({
|
||||
return {
|
||||
id: this.id,
|
||||
model: 'mail.channel',
|
||||
});
|
||||
};
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, one } from '@mail/model/model_field';
|
||||
import { insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { cleanSearchTerm } from '@mail/utils/utils';
|
||||
|
||||
registerModel({
|
||||
@@ -130,7 +129,7 @@ registerModel({
|
||||
identifying: true,
|
||||
}),
|
||||
suggestable: one('ComposerSuggestable', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
inverse: 'channelCommand',
|
||||
isCausal: true,
|
||||
readonly: true,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, many, one } from '@mail/model/model_field';
|
||||
import { clear, insertAndReplace, link, unlink } from '@mail/model/model_field_command';
|
||||
import { clear, link, unlink } from '@mail/model/model_field_command';
|
||||
import { cleanSearchTerm } from '@mail/utils/utils';
|
||||
|
||||
import { sprintf } from '@web/core/utils/strings';
|
||||
@@ -147,7 +147,7 @@ registerModel({
|
||||
}
|
||||
this.update({
|
||||
searchResultCount: count,
|
||||
selectablePartners: insertAndReplace(partnersData.map(partnerData => this.messaging.models['Partner'].convertData(partnerData))),
|
||||
selectablePartners: partnersData.map(partnerData => this.messaging.models['Partner'].convertData(partnerData)),
|
||||
});
|
||||
} finally {
|
||||
if (this.exists()) {
|
||||
@@ -201,7 +201,7 @@ registerModel({
|
||||
if (this.selectablePartners.length === 0) {
|
||||
return clear();
|
||||
}
|
||||
return insertAndReplace(this.selectablePartners.map(partner => ({ partner })));
|
||||
return this.selectablePartners.map(partner => ({ partner }));
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
@@ -211,7 +211,7 @@ registerModel({
|
||||
if (this.selectedPartners.length === 0) {
|
||||
return clear();
|
||||
}
|
||||
return insertAndReplace(this.selectedPartners.map(partner => ({ partner })));
|
||||
return this.selectedPartners.map(partner => ({ partner }));
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { one } from '@mail/model/model_field';
|
||||
import { clear, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear } from '@mail/model/model_field_command';
|
||||
|
||||
registerModel({
|
||||
name: 'ChannelInvitationFormSelectablePartnerView',
|
||||
@@ -12,7 +12,7 @@ registerModel({
|
||||
* @returns {FieldCommand}
|
||||
*/
|
||||
_computePersonaImStatusIconView() {
|
||||
return this.partner.isImStatusSet ? insertAndReplace() : clear();
|
||||
return this.partner.isImStatusSet ? {} : clear();
|
||||
},
|
||||
},
|
||||
fields: {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, many, one } from '@mail/model/model_field';
|
||||
import { clear, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear } from '@mail/model/model_field_command';
|
||||
|
||||
import { sprintf } from '@web/core/utils/strings';
|
||||
|
||||
@@ -30,9 +30,7 @@ registerModel({
|
||||
if (this.members.length === 0) {
|
||||
return clear();
|
||||
}
|
||||
return insertAndReplace(
|
||||
this.members.map(channelMember => ({ channelMember })),
|
||||
);
|
||||
return this.members.map(channelMember => ({ channelMember }));
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { one } from '@mail/model/model_field';
|
||||
import { clear, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear } from '@mail/model/model_field_command';
|
||||
|
||||
registerModel({
|
||||
name: 'ChannelMemberListView',
|
||||
@@ -38,7 +38,7 @@ registerModel({
|
||||
*/
|
||||
_computeOfflineCategoryView() {
|
||||
if (this.channel && this.channel.orderedOfflineMembers.length > 0) {
|
||||
return insertAndReplace();
|
||||
return {};
|
||||
}
|
||||
return clear();
|
||||
},
|
||||
@@ -48,7 +48,7 @@ registerModel({
|
||||
*/
|
||||
_computeOnlineCategoryView() {
|
||||
if (this.channel && this.channel.orderedOnlineMembers.length > 0) {
|
||||
return insertAndReplace();
|
||||
return {};
|
||||
}
|
||||
return clear();
|
||||
},
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, one } from '@mail/model/model_field';
|
||||
import { clear, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear } from '@mail/model/model_field_command';
|
||||
import { isEventHandled } from '@mail/utils/utils';
|
||||
|
||||
registerModel({
|
||||
@@ -39,9 +39,9 @@ registerModel({
|
||||
*/
|
||||
_computePersonaImStatusIconView() {
|
||||
if (this.channelMember.persona.guest && this.channelMember.persona.guest.im_status) {
|
||||
return insertAndReplace();
|
||||
return {};
|
||||
}
|
||||
return this.channelMember.persona.partner && this.channelMember.persona.partner.isImStatusSet ? insertAndReplace() : clear();
|
||||
return this.channelMember.persona.partner && this.channelMember.persona.partner.isImStatusSet ? {} : clear();
|
||||
},
|
||||
},
|
||||
fields: {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, one } from '@mail/model/model_field';
|
||||
import { clear, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear } from '@mail/model/model_field_command';
|
||||
import { isEventHandled, markEventHandled } from '@mail/utils/utils';
|
||||
|
||||
registerModel({
|
||||
@@ -231,9 +231,9 @@ registerModel({
|
||||
onClickShowInviteForm(ev) {
|
||||
markEventHandled(ev, 'ChatWindow.onClickCommand');
|
||||
this.update({
|
||||
channelInvitationForm: insertAndReplace({
|
||||
channelInvitationForm: {
|
||||
doFocusOnSearchInput: true,
|
||||
}),
|
||||
},
|
||||
isMemberListOpened: false,
|
||||
});
|
||||
if (!this.messaging.isCurrentUserGuest) {
|
||||
@@ -348,7 +348,7 @@ registerModel({
|
||||
*/
|
||||
_computeChannelMemberListView() {
|
||||
if (this.thread && this.thread.hasMemberListFeature && this.isMemberListOpened) {
|
||||
return insertAndReplace();
|
||||
return {};
|
||||
}
|
||||
return clear();
|
||||
},
|
||||
@@ -463,7 +463,7 @@ registerModel({
|
||||
*/
|
||||
_computeNewMessageAutocompleteInputView() {
|
||||
if (this.hasNewMessageForm) {
|
||||
return insertAndReplace();
|
||||
return {};
|
||||
}
|
||||
return clear();
|
||||
},
|
||||
@@ -479,11 +479,11 @@ registerModel({
|
||||
* @returns {ThreadViewer}
|
||||
*/
|
||||
_computeThreadViewer() {
|
||||
return insertAndReplace({
|
||||
return {
|
||||
compact: true,
|
||||
hasThreadView: this.hasThreadView,
|
||||
thread: this.thread ? this.thread : clear(),
|
||||
});
|
||||
};
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
@@ -573,7 +573,7 @@ registerModel({
|
||||
isCausal: true,
|
||||
}),
|
||||
chatWindowHeaderView: one('ChatWindowHeaderView', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
inverse: 'chatWindowOwner',
|
||||
isCausal: true,
|
||||
}),
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, many, one } from '@mail/model/model_field';
|
||||
import { clear, insertAndReplace, link } from '@mail/model/model_field_command';
|
||||
import { clear, link } from '@mail/model/model_field_command';
|
||||
|
||||
const BASE_VISUAL = {
|
||||
/**
|
||||
@@ -86,7 +86,7 @@ registerModel({
|
||||
},
|
||||
openNewMessage() {
|
||||
if (!this.newMessageChatWindow) {
|
||||
this.update({ newMessageChatWindow: insertAndReplace({ manager: this }) });
|
||||
this.update({ newMessageChatWindow: { manager: this } });
|
||||
}
|
||||
this.newMessageChatWindow.makeActive();
|
||||
},
|
||||
@@ -207,7 +207,7 @@ registerModel({
|
||||
*/
|
||||
_computeHiddenChatWindowHeaderViews() {
|
||||
if (this.allOrderedHidden.length > 0) {
|
||||
return insertAndReplace(this.allOrderedHidden.map(chatWindow => ({ chatWindowOwner: chatWindow })));
|
||||
return this.allOrderedHidden.map(chatWindow => ({ chatWindowOwner: chatWindow }));
|
||||
}
|
||||
return clear();
|
||||
},
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, one } from '@mail/model/model_field';
|
||||
import { clear, insert, insertAndReplace, link } from '@mail/model/model_field_command';
|
||||
import { clear, insert, link } from '@mail/model/model_field_command';
|
||||
import { OnChange } from '@mail/model/model_onchange';
|
||||
|
||||
const getThreadNextTemporaryId = (function () {
|
||||
@@ -30,7 +30,10 @@ registerModel({
|
||||
}
|
||||
},
|
||||
onAttachmentsLoadingTimeout() {
|
||||
this.update({ isShowingAttachmentsLoading: true });
|
||||
this.update({
|
||||
attachmentsLoaderTimer: clear(),
|
||||
isShowingAttachmentsLoading: true,
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Handles click on the attach button.
|
||||
@@ -42,7 +45,7 @@ registerModel({
|
||||
* Handles click on the attachments button.
|
||||
*/
|
||||
onClickButtonToggleAttachments() {
|
||||
this.update({ attachmentBoxView: this.attachmentBoxView ? clear() : insertAndReplace() });
|
||||
this.update({ attachmentBoxView: this.attachmentBoxView ? clear() : {} });
|
||||
},
|
||||
/**
|
||||
* Handles click on top bar close button.
|
||||
@@ -114,7 +117,7 @@ registerModel({
|
||||
this.threadView.messageListView.component.onScroll(ev);
|
||||
},
|
||||
openAttachmentBoxView() {
|
||||
this.update({ attachmentBoxView: insertAndReplace() });
|
||||
this.update({ attachmentBoxView: {} });
|
||||
},
|
||||
/**
|
||||
* Open a dialog to add partners as followers.
|
||||
@@ -172,12 +175,12 @@ registerModel({
|
||||
}
|
||||
},
|
||||
showLogNote() {
|
||||
this.update({ composerView: insertAndReplace() });
|
||||
this.update({ composerView: {} });
|
||||
this.composerView.composer.update({ isLog: true });
|
||||
this.focus();
|
||||
},
|
||||
showSendMessage() {
|
||||
this.update({ composerView: insertAndReplace() });
|
||||
this.update({ composerView: {} });
|
||||
this.composerView.composer.update({ isLog: false });
|
||||
this.focus();
|
||||
},
|
||||
@@ -187,7 +190,7 @@ registerModel({
|
||||
*/
|
||||
_computeActivityBoxView() {
|
||||
if (this.thread && this.thread.hasActivities && this.thread.activities.length > 0) {
|
||||
return insertAndReplace();
|
||||
return {};
|
||||
}
|
||||
return clear();
|
||||
},
|
||||
@@ -197,7 +200,7 @@ registerModel({
|
||||
*/
|
||||
_computeDropZoneView() {
|
||||
if (this.useDragVisibleDropZone.isVisible) {
|
||||
return insertAndReplace();
|
||||
return {};
|
||||
}
|
||||
return clear();
|
||||
},
|
||||
@@ -206,7 +209,7 @@ registerModel({
|
||||
* @returns {FieldCommand}
|
||||
*/
|
||||
_computeFileUploader() {
|
||||
return this.thread ? insertAndReplace() : clear();
|
||||
return this.thread ? {} : clear();
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
@@ -214,7 +217,7 @@ registerModel({
|
||||
*/
|
||||
_computeFollowButtonView() {
|
||||
if (this.hasFollowers && this.thread && (!this.thread.channel || this.thread.channel.channel_type !== 'chat')) {
|
||||
return insertAndReplace();
|
||||
return {};
|
||||
}
|
||||
return clear();
|
||||
},
|
||||
@@ -224,7 +227,7 @@ registerModel({
|
||||
*/
|
||||
_computeFollowerListMenuView() {
|
||||
if (this.hasFollowers && this.thread) {
|
||||
return insertAndReplace();
|
||||
return {};
|
||||
}
|
||||
return clear();
|
||||
},
|
||||
@@ -261,11 +264,11 @@ registerModel({
|
||||
* @returns {ThreadViewer}
|
||||
*/
|
||||
_computeThreadViewer() {
|
||||
return insertAndReplace({
|
||||
return {
|
||||
hasThreadView: this.hasThreadView,
|
||||
order: 'desc',
|
||||
thread: this.thread ? this.thread : clear(),
|
||||
});
|
||||
};
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
@@ -276,7 +279,7 @@ registerModel({
|
||||
this.thread.delete();
|
||||
}
|
||||
this.update({
|
||||
attachmentBoxView: this.isAttachmentBoxVisibleInitially ? insertAndReplace() : clear(),
|
||||
attachmentBoxView: this.isAttachmentBoxVisibleInitially ? {} : clear(),
|
||||
thread: insert({
|
||||
// If the thread was considered to have the activity
|
||||
// mixin once, it will have it forever.
|
||||
@@ -326,7 +329,7 @@ registerModel({
|
||||
* @private
|
||||
*/
|
||||
_prepareAttachmentsLoading() {
|
||||
this.update({ attachmentsLoaderTimer: insertAndReplace() });
|
||||
this.update({ attachmentsLoaderTimer: {} });
|
||||
},
|
||||
},
|
||||
fields: {
|
||||
@@ -486,12 +489,12 @@ registerModel({
|
||||
required: true,
|
||||
}),
|
||||
topbar: one('ChatterTopbar', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
inverse: 'chatter',
|
||||
isCausal: true,
|
||||
}),
|
||||
useDragVisibleDropZone: one('UseDragVisibleDropZone', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
inverse: 'chatterOwner',
|
||||
isCausal: true,
|
||||
readonly: true,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, many, one } from '@mail/model/model_field';
|
||||
import { clear, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear } from '@mail/model/model_field_command';
|
||||
|
||||
registerModel({
|
||||
name: 'ComposerSuggestedRecipientListView',
|
||||
@@ -34,17 +34,9 @@ registerModel({
|
||||
return clear();
|
||||
}
|
||||
if (this.hasShowMoreButton) {
|
||||
return insertAndReplace(
|
||||
this.thread.suggestedRecipientInfoList.map(
|
||||
suggestedRecipientInfo => ({ suggestedRecipientInfo })
|
||||
),
|
||||
);
|
||||
return this.thread.suggestedRecipientInfoList.map(suggestedRecipientInfo => ({ suggestedRecipientInfo }));
|
||||
} else {
|
||||
return insertAndReplace(
|
||||
this.thread.suggestedRecipientInfoList.slice(0, 3).map(
|
||||
suggestedRecipientInfo => ({ suggestedRecipientInfo })
|
||||
),
|
||||
);
|
||||
return this.thread.suggestedRecipientInfoList.slice(0, 3).map(suggestedRecipientInfo => ({ suggestedRecipientInfo }));
|
||||
}
|
||||
},
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, many, one } from '@mail/model/model_field';
|
||||
import { insertAndReplace } from '@mail/model/model_field_command';
|
||||
|
||||
registerModel({
|
||||
name: 'ComposerSuggestionListView',
|
||||
@@ -73,21 +72,13 @@ registerModel({
|
||||
* @returns {FieldCommand}
|
||||
*/
|
||||
_computeComposerSuggestionListViewExtraComposerSuggestionViewItems() {
|
||||
return insertAndReplace(this.composerViewOwner.extraSuggestions.map(suggestable => {
|
||||
return {
|
||||
suggestable,
|
||||
};
|
||||
}));
|
||||
return this.composerViewOwner.extraSuggestions.map(suggestable => ({ suggestable }));
|
||||
},
|
||||
/**
|
||||
* @returns {FieldCommand}
|
||||
*/
|
||||
_computeComposerSuggestionListViewMainComposerSuggestionViewItems() {
|
||||
return insertAndReplace(this.composerViewOwner.mainSuggestions.map(suggestable => {
|
||||
return {
|
||||
suggestable,
|
||||
};
|
||||
}));
|
||||
return this.composerViewOwner.mainSuggestions.map(suggestable => ({ suggestable }));
|
||||
},
|
||||
/**
|
||||
* @returns {FieldCommand}
|
||||
|
||||
+1
-2
@@ -2,7 +2,6 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { one } from '@mail/model/model_field';
|
||||
import { insertAndReplace } from '@mail/model/model_field_command';
|
||||
|
||||
/**
|
||||
* Models a relation between a ComposerSuggestionListView and a
|
||||
@@ -17,7 +16,7 @@ registerModel({
|
||||
inverse: 'composerSuggestionListViewExtraComposerSuggestionViewItems',
|
||||
}),
|
||||
composerSuggestionView: one('ComposerSuggestionView', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
inverse: 'composerSuggestionListViewExtraComposerSuggestionViewItemOwner',
|
||||
isCausal: true,
|
||||
readonly: true,
|
||||
|
||||
+1
-2
@@ -2,7 +2,6 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { one } from '@mail/model/model_field';
|
||||
import { insertAndReplace } from '@mail/model/model_field_command';
|
||||
|
||||
/**
|
||||
* Models a relation between a ComposerSuggestionListView and a
|
||||
@@ -17,7 +16,7 @@ registerModel({
|
||||
inverse: 'composerSuggestionListViewMainComposerSuggestionViewItems',
|
||||
}),
|
||||
composerSuggestionView: one('ComposerSuggestionView', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
inverse: 'composerSuggestionListViewMainComposerSuggestionViewItemOwner',
|
||||
isCausal: true,
|
||||
readonly: true,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, one } from '@mail/model/model_field';
|
||||
import { clear, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear } from '@mail/model/model_field_command';
|
||||
import { sprintf } from '@web/core/utils/strings';
|
||||
|
||||
/**
|
||||
@@ -65,7 +65,7 @@ registerModel({
|
||||
* @returns {FieldCommand}
|
||||
*/
|
||||
_computePersonaImStatusIconView() {
|
||||
return this.suggestable && this.suggestable.partner && this.suggestable.partner.isImStatusSet ? insertAndReplace() : clear();
|
||||
return this.suggestable && this.suggestable.partner && this.suggestable.partner.isImStatusSet ? {} : clear();
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, many, one } from '@mail/model/model_field';
|
||||
import { clear, insertAndReplace, link, unlink } from '@mail/model/model_field_command';
|
||||
import { clear, link, unlink } from '@mail/model/model_field_command';
|
||||
import { OnChange } from '@mail/model/model_onchange';
|
||||
import { addLink, escapeAndCompactTextContent, parseAndTransform } from '@mail/js/utils';
|
||||
import { isEventHandled, markEventHandled } from '@mail/utils/utils';
|
||||
@@ -169,7 +169,7 @@ registerModel({
|
||||
*/
|
||||
onClickButtonEmojis() {
|
||||
if (!this.emojisPopoverView) {
|
||||
this.update({ emojisPopoverView: insertAndReplace() });
|
||||
this.update({ emojisPopoverView: {} });
|
||||
} else {
|
||||
this.update({ emojisPopoverView: clear() });
|
||||
}
|
||||
@@ -689,7 +689,7 @@ registerModel({
|
||||
async updateMessage() {
|
||||
const composer = this.composer;
|
||||
if (!composer.textInputContent) {
|
||||
this.messageViewInEditing.messageActionList.update({ deleteConfirmDialog: insertAndReplace() });
|
||||
this.messageViewInEditing.messageActionList.update({ deleteConfirmDialog: {} });
|
||||
return;
|
||||
}
|
||||
const escapedAndCompactContent = escapeAndCompactTextContent(composer.textInputContent);
|
||||
@@ -720,7 +720,7 @@ registerModel({
|
||||
*/
|
||||
_computeAttachmentList() {
|
||||
return (this.composer && this.composer.attachments.length > 0)
|
||||
? insertAndReplace()
|
||||
? {}
|
||||
: clear();
|
||||
},
|
||||
/**
|
||||
@@ -729,7 +729,7 @@ registerModel({
|
||||
*/
|
||||
_computeComposerSuggestedRecipientListView() {
|
||||
if (this.hasHeader && this.hasFollowers && !this.composer.isLog) {
|
||||
return insertAndReplace();
|
||||
return {};
|
||||
}
|
||||
return clear();
|
||||
},
|
||||
@@ -775,7 +775,7 @@ registerModel({
|
||||
*/
|
||||
_computeDropZoneView() {
|
||||
if (this.useDragVisibleDropZone.isVisible) {
|
||||
return insertAndReplace();
|
||||
return {};
|
||||
}
|
||||
return clear();
|
||||
},
|
||||
@@ -1354,7 +1354,7 @@ registerModel({
|
||||
*/
|
||||
_computeComposerSuggestionListView() {
|
||||
if (this.hasSuggestions) {
|
||||
return insertAndReplace();
|
||||
return {};
|
||||
}
|
||||
return clear();
|
||||
}
|
||||
@@ -1428,7 +1428,7 @@ registerModel({
|
||||
compute: '_computeExtraSuggestions',
|
||||
}),
|
||||
fileUploader: one('FileUploader', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
inverse: 'composerView',
|
||||
isCausal: true,
|
||||
readonly: true,
|
||||
@@ -1613,7 +1613,7 @@ registerModel({
|
||||
inverse: 'composerView',
|
||||
}),
|
||||
useDragVisibleDropZone: one('UseDragVisibleDropZone', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
inverse: 'composerViewOwner',
|
||||
isCausal: true,
|
||||
readonly: true,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, one } from '@mail/model/model_field';
|
||||
import { clear, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear } from '@mail/model/model_field_command';
|
||||
|
||||
registerModel({
|
||||
name: 'DeleteMessageConfirmView',
|
||||
@@ -37,7 +37,7 @@ registerModel({
|
||||
* @returns {MessageView}
|
||||
*/
|
||||
_computeMessageView() {
|
||||
return this.message ? insertAndReplace({ message: this.message }) : clear();
|
||||
return this.message ? { message: this.message } : clear();
|
||||
},
|
||||
},
|
||||
fields: {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, one } from '@mail/model/model_field';
|
||||
import { clear, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear } from '@mail/model/model_field_command';
|
||||
|
||||
registerModel({
|
||||
name: 'Dialog',
|
||||
@@ -31,10 +31,10 @@ registerModel({
|
||||
*/
|
||||
_computeAttachmentDeleteConfirmView() {
|
||||
if (this.attachmentCardOwnerAsAttachmentDeleteConfirm) {
|
||||
return insertAndReplace();
|
||||
return {};
|
||||
}
|
||||
if (this.attachmentImageOwnerAsAttachmentDeleteConfirm) {
|
||||
return insertAndReplace();
|
||||
return {};
|
||||
}
|
||||
return clear();
|
||||
},
|
||||
@@ -44,7 +44,7 @@ registerModel({
|
||||
*/
|
||||
_computeAttachmentViewer() {
|
||||
if (this.attachmentListOwnerAsAttachmentView) {
|
||||
return insertAndReplace();
|
||||
return {};
|
||||
}
|
||||
return clear();
|
||||
},
|
||||
@@ -95,14 +95,14 @@ registerModel({
|
||||
* @returns {FieldCommand}
|
||||
*/
|
||||
_computeDeleteMessageConfirmView() {
|
||||
return this.messageActionListOwnerAsDeleteConfirm ? insertAndReplace() : clear();
|
||||
return this.messageActionListOwnerAsDeleteConfirm ? {} : clear();
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @returns {FieldCommand}
|
||||
*/
|
||||
_computeFollowerSubtypeList() {
|
||||
return this.followerOwnerAsSubtypeList ? insertAndReplace() : clear();
|
||||
return this.followerOwnerAsSubtypeList ? {} : clear();
|
||||
},
|
||||
/**
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, one } from '@mail/model/model_field';
|
||||
import { clear, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear } from '@mail/model/model_field_command';
|
||||
import { escape, sprintf } from '@web/core/utils/strings';
|
||||
|
||||
registerModel({
|
||||
@@ -125,7 +125,7 @@ registerModel({
|
||||
});
|
||||
},
|
||||
open() {
|
||||
this.update({ discussView: insertAndReplace() });
|
||||
this.update({ discussView: {} });
|
||||
},
|
||||
/**
|
||||
* Opens thread from init active id if the thread exists.
|
||||
@@ -270,7 +270,7 @@ registerModel({
|
||||
this.messaging.device.isSmall &&
|
||||
!(this.threadView && this.threadView.replyingToMessageView)
|
||||
) {
|
||||
return insertAndReplace();
|
||||
return {};
|
||||
}
|
||||
return clear();
|
||||
},
|
||||
@@ -279,7 +279,7 @@ registerModel({
|
||||
* @returns {FieldCommand}
|
||||
*/
|
||||
_computeNotificationListView() {
|
||||
return (this.messaging.device.isSmall && this.activeMobileNavbarTabId !== 'mailbox') ? insertAndReplace() : clear();
|
||||
return (this.messaging.device.isSmall && this.activeMobileNavbarTabId !== 'mailbox') ? {} : clear();
|
||||
},
|
||||
/**
|
||||
* Only mailboxes and pinned channels are allowed in Discuss.
|
||||
@@ -304,12 +304,12 @@ registerModel({
|
||||
* @returns {ThreadViewer}
|
||||
*/
|
||||
_computeThreadViewer() {
|
||||
return insertAndReplace({
|
||||
return {
|
||||
hasMemberList: true,
|
||||
hasThreadView: this.hasThreadView,
|
||||
hasTopbar: true,
|
||||
thread: this.thread ? this.thread : clear(),
|
||||
});
|
||||
};
|
||||
},
|
||||
},
|
||||
fields: {
|
||||
@@ -339,7 +339,7 @@ registerModel({
|
||||
* Discuss sidebar category for `channel` type channel threads.
|
||||
*/
|
||||
categoryChannel: one('DiscussSidebarCategory', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
inverse: 'discussAsChannel',
|
||||
isCausal: true,
|
||||
}),
|
||||
@@ -347,7 +347,7 @@ registerModel({
|
||||
* Discuss sidebar category for `chat` type channel threads.
|
||||
*/
|
||||
categoryChat: one('DiscussSidebarCategory', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
inverse: 'discussAsChat',
|
||||
isCausal: true,
|
||||
}),
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { attr, one } from '@mail/model/model_field';
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { clear, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear } from '@mail/model/model_field_command';
|
||||
|
||||
registerModel({
|
||||
name: 'DiscussPublicView',
|
||||
@@ -12,13 +12,13 @@ registerModel({
|
||||
*/
|
||||
async switchToThreadView() {
|
||||
this.update({
|
||||
threadViewer: insertAndReplace({
|
||||
threadViewer: {
|
||||
extraClass: 'flex-grow-1',
|
||||
hasMemberList: true,
|
||||
hasThreadView: true,
|
||||
hasTopbar: true,
|
||||
thread: this.channel,
|
||||
}),
|
||||
},
|
||||
welcomeView: clear(),
|
||||
});
|
||||
if (this.isChannelTokenSecret) {
|
||||
@@ -36,12 +36,12 @@ registerModel({
|
||||
switchToWelcomeView() {
|
||||
this.update({
|
||||
threadViewer: clear(),
|
||||
welcomeView: insertAndReplace({
|
||||
welcomeView: {
|
||||
channel: this.channel,
|
||||
isDoFocusGuestNameInput: true,
|
||||
originalGuestName: this.messaging.currentGuest && this.messaging.currentGuest.name,
|
||||
pendingGuestName: this.messaging.currentGuest && this.messaging.currentGuest.name,
|
||||
}),
|
||||
},
|
||||
});
|
||||
if (this.welcomeView.callDemoView) {
|
||||
this.welcomeView.callDemoView.enableMicrophone();
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, many, one } from '@mail/model/model_field';
|
||||
import { clear, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear } from '@mail/model/model_field_command';
|
||||
import { OnChange } from '@mail/model/model_onchange';
|
||||
|
||||
registerModel({
|
||||
@@ -56,10 +56,10 @@ registerModel({
|
||||
_computeActiveItem() {
|
||||
const channel = this.messaging.discuss.thread && this.messaging.discuss.thread.channel;
|
||||
if (channel && this.supportedChannelTypes.includes(channel.channel_type)) {
|
||||
return insertAndReplace({
|
||||
return {
|
||||
thread: channel.thread,
|
||||
category: this,
|
||||
});
|
||||
};
|
||||
}
|
||||
return clear();
|
||||
},
|
||||
@@ -69,7 +69,7 @@ registerModel({
|
||||
*/
|
||||
_computeAddingItemAutocompleteInputView() {
|
||||
if (this.isOpen && this.isAddingItem) {
|
||||
return insertAndReplace();
|
||||
return {};
|
||||
}
|
||||
return clear();
|
||||
},
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, many, one } from '@mail/model/model_field';
|
||||
import { clear, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear } from '@mail/model/model_field_command';
|
||||
import { OnChange } from '@mail/model/model_onchange';
|
||||
|
||||
registerModel({
|
||||
@@ -105,7 +105,7 @@ registerModel({
|
||||
this.messaging.device.isSmall &&
|
||||
(this.discuss.isAddingChannel || this.discuss.isAddingChat)
|
||||
) {
|
||||
return insertAndReplace();
|
||||
return {};
|
||||
}
|
||||
return clear();
|
||||
},
|
||||
@@ -139,12 +139,12 @@ registerModel({
|
||||
inverse: 'discussView',
|
||||
}),
|
||||
historyView: one('DiscussSidebarMailboxView', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
inverse: 'discussViewOwnerAsHistory',
|
||||
isCausal: true,
|
||||
}),
|
||||
inboxView: one('DiscussSidebarMailboxView', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
inverse: 'discussViewOwnerAsInbox',
|
||||
isCausal: true,
|
||||
}),
|
||||
@@ -163,7 +163,7 @@ registerModel({
|
||||
*/
|
||||
quickSearchInputRef: attr(),
|
||||
starredView: one('DiscussSidebarMailboxView', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
inverse: 'discussViewOwnerAsStarred',
|
||||
isCausal: true,
|
||||
}),
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { many, one } from '@mail/model/model_field';
|
||||
import { insertAndReplace } from '@mail/model/model_field_command';
|
||||
|
||||
registerModel({
|
||||
name: 'EmojiCategoryBarView',
|
||||
@@ -22,21 +21,17 @@ registerModel({
|
||||
* @returns {FieldCommand}
|
||||
*/
|
||||
_computeDefaultActiveCategoryView() {
|
||||
return insertAndReplace({
|
||||
emojiCategory: insertAndReplace({ categoryName: "all" }),
|
||||
return {
|
||||
emojiCategory: { categoryName: "all" },
|
||||
emojiCategoryBarViewOwner: this,
|
||||
});
|
||||
};
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @returns {FieldCommand}
|
||||
*/
|
||||
_computeEmojiCategoryViews() {
|
||||
return insertAndReplace(
|
||||
this.messaging.emojiRegistry.allCategories.map(emojiCategory => {
|
||||
return { emojiCategory };
|
||||
})
|
||||
);
|
||||
return this.messaging.emojiRegistry.allCategories.map(emojiCategory => ({ emojiCategory }));
|
||||
},
|
||||
},
|
||||
fields: {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { many, one } from '@mail/model/model_field';
|
||||
import { clear, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear } from '@mail/model/model_field_command';
|
||||
|
||||
registerModel({
|
||||
name: 'EmojiGridView',
|
||||
@@ -15,11 +15,7 @@ registerModel({
|
||||
if (!this.emojiPickerViewOwner.emojiCategoryBarView.activeCategoryView) {
|
||||
return clear();
|
||||
}
|
||||
return insertAndReplace(
|
||||
this.emojiPickerViewOwner.emojiCategoryBarView.activeCategoryView.emojiCategory.allEmojis.map(emoji => {
|
||||
return { emoji };
|
||||
})
|
||||
);
|
||||
return this.emojiPickerViewOwner.emojiCategoryBarView.activeCategoryView.emojiCategory.allEmojis.map(emoji => ({ emoji }));
|
||||
},
|
||||
},
|
||||
fields: {
|
||||
|
||||
@@ -2,20 +2,19 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { one } from '@mail/model/model_field';
|
||||
import { insertAndReplace } from '@mail/model/model_field_command';
|
||||
|
||||
registerModel({
|
||||
name: 'EmojiPickerView',
|
||||
fields: {
|
||||
emojiCategoryBarView: one('EmojiCategoryBarView', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
inverse: 'emojiPickerViewOwner',
|
||||
readonly: true,
|
||||
required: true,
|
||||
isCausal: true,
|
||||
}),
|
||||
emojiGridView: one('EmojiGridView', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
inverse: 'emojiPickerViewOwner',
|
||||
readonly: true,
|
||||
required: true,
|
||||
|
||||
@@ -2,13 +2,12 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { many } from '@mail/model/model_field';
|
||||
import { insertAndReplace } from '@mail/model/model_field_command';
|
||||
|
||||
registerModel({
|
||||
name: 'EmojiRegistry',
|
||||
fields: {
|
||||
allEmojis: many('Emoji', {
|
||||
default: insertAndReplace([
|
||||
default: [
|
||||
{ unicode: "😊", sources: [":)", ":-)", "=)", ":]"], description: ":)" },
|
||||
{ unicode: "😃", sources: [":D", ":-D", "=D"], description: ":D" },
|
||||
{ unicode: "😆", sources: ["xD", "XD"], description: "xD" },
|
||||
@@ -90,20 +89,19 @@ registerModel({
|
||||
{ unicode: "🎬", sources: [":clapper"], description: ":clapper" },
|
||||
{ unicode: "🎤", sources: [":microphone"], description: ":microphone" },
|
||||
{ unicode: "🧀", sources: [":cheese"], description: ":cheese" },
|
||||
]),
|
||||
],
|
||||
inverse: 'emojiRegistry',
|
||||
}),
|
||||
allCategories: many('EmojiCategory', {
|
||||
default: insertAndReplace([
|
||||
{ categoryName: "all", allEmojis: insertAndReplace(["😊", "😃", "😆", "😂", "😉", "😎", "😜", "😋", "😝", "😳", "😐", "😕", "😞", "😱", "😲", "😨", "😠", "😈", "😘", "😇", "😢", "😭", "❤️", "💔", "😍", "👳", "👍", "👎", "👌", "💩", "🙈", "🙉", "🙊", "🐞", "😺", "🐻", "🐌", "🐗", "🍀", "🌹", "🔥", "☀️", "⛅️", "🌈", "☁️", "⚡️", "⭐️", "🍪", "🍕", "🍔", "🍟", "🎂", "🍰", "☕️", "🍌", "🍣", "🍙", "🍺", "🍷", "🍸", "🍹", "🍻", "🧀", "👻", "💀", "👽", "🎉", "🏆", "🔑", "📌", "📯", "🎵", "🎺", "🎸", "🏃", "🚲", "⚽️", "🏈", "🎱", "🎬", "🎤"].map(unicode => ({ unicode }))) },
|
||||
{ categoryName: "🤠", allEmojis: insertAndReplace(["😊", "😃", "😆", "😂", "😉", "😎", "😜", "😋", "😝", "😳", "😐", "😕", "😞", "😱", "😲", "😨", "😠", "😈", "😘", "😇", "😢", "😭", "❤️", "💔", "😍", "👳", "👍", "👎", "👌", "💩"].map(unicode => ({ unicode }))) },
|
||||
{ categoryName: "🐿", allEmojis: insertAndReplace(["🙈", "🙉", "🙊", "🐞", "😺", "🐻", "🐌", "🐗"].map(unicode => ({ unicode }))) },
|
||||
{ categoryName: "🌿", allEmojis: insertAndReplace(["🍀", "🌹", "🔥", "☀️", "⛅️", "🌈", "☁️", "⚡️", "⭐️"].map(unicode => ({ unicode }))) },
|
||||
{ categoryName: "🍽", allEmojis: insertAndReplace(["🍪", "🍕", "🍔", "🍟", "🎂", "🍰", "☕️", "🍌", "🍣", "🍙", "🍺", "🍷", "🍸", "🍹", "🍻", "🧀"].map(unicode => ({ unicode }))) },
|
||||
{ categoryName: "📦", allEmojis: insertAndReplace(["👻", "💀", "👽", "🎉", "🏆", "🔑", "📌", "📯", "🎵", "🎺", "🎸"].map(unicode => ({ unicode }))) },
|
||||
{ categoryName: "⚽️", allEmojis: insertAndReplace(["🏃", "🚲", "⚽️", "🏈", "🎱", "🎬", "🎤"].map(unicode => ({ unicode }))) },
|
||||
|
||||
]),
|
||||
default: [
|
||||
{ categoryName: "all", allEmojis: ["😊", "😃", "😆", "😂", "😉", "😎", "😜", "😋", "😝", "😳", "😐", "😕", "😞", "😱", "😲", "😨", "😠", "😈", "😘", "😇", "😢", "😭", "❤️", "💔", "😍", "👳", "👍", "👎", "👌", "💩", "🙈", "🙉", "🙊", "🐞", "😺", "🐻", "🐌", "🐗", "🍀", "🌹", "🔥", "☀️", "⛅️", "🌈", "☁️", "⚡️", "⭐️", "🍪", "🍕", "🍔", "🍟", "🎂", "🍰", "☕️", "🍌", "🍣", "🍙", "🍺", "🍷", "🍸", "🍹", "🍻", "🧀", "👻", "💀", "👽", "🎉", "🏆", "🔑", "📌", "📯", "🎵", "🎺", "🎸", "🏃", "🚲", "⚽️", "🏈", "🎱", "🎬", "🎤"].map(unicode => ({ unicode })) },
|
||||
{ categoryName: "🤠", allEmojis: ["😊", "😃", "😆", "😂", "😉", "😎", "😜", "😋", "😝", "😳", "😐", "😕", "😞", "😱", "😲", "😨", "😠", "😈", "😘", "😇", "😢", "😭", "❤️", "💔", "😍", "👳", "👍", "👎", "👌", "💩"].map(unicode => ({ unicode })) },
|
||||
{ categoryName: "🐿", allEmojis: ["🙈", "🙉", "🙊", "🐞", "😺", "🐻", "🐌", "🐗"].map(unicode => ({ unicode })) },
|
||||
{ categoryName: "🌿", allEmojis: ["🍀", "🌹", "🔥", "☀️", "⛅️", "🌈", "☁️", "⚡️", "⭐️"].map(unicode => ({ unicode })) },
|
||||
{ categoryName: "🍽", allEmojis: ["🍪", "🍕", "🍔", "🍟", "🎂", "🍰", "☕️", "🍌", "🍣", "🍙", "🍺", "🍷", "🍸", "🍹", "🍻", "🧀"].map(unicode => ({ unicode })) },
|
||||
{ categoryName: "📦", allEmojis: ["👻", "💀", "👽", "🎉", "🏆", "🔑", "📌", "📯", "🎵", "🎺", "🎸"].map(unicode => ({ unicode })) },
|
||||
{ categoryName: "⚽️", allEmojis: ["🏃", "🚲", "⚽️", "🏈", "🎱", "🎬", "🎤"].map(unicode => ({ unicode })) },
|
||||
],
|
||||
}),
|
||||
},
|
||||
});
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, many, one } from '@mail/model/model_field';
|
||||
import { clear, insert, insertAndReplace, link, unlink } from '@mail/model/model_field_command';
|
||||
import { clear, insert, link, unlink } from '@mail/model/model_field_command';
|
||||
|
||||
registerModel({
|
||||
name: 'Follower',
|
||||
@@ -33,7 +33,7 @@ registerModel({
|
||||
}
|
||||
}
|
||||
if (data.partner) {
|
||||
data2.partner = insertAndReplace(this.models['Partner'].convertData(data.partner));
|
||||
data2.partner = this.models['Partner'].convertData(data.partner);
|
||||
}
|
||||
return data2;
|
||||
},
|
||||
@@ -102,7 +102,7 @@ registerModel({
|
||||
this.update({ selectedSubtypes: unlink(subtype) });
|
||||
}
|
||||
}
|
||||
this.update({ followerSubtypeListDialog: insertAndReplace() });
|
||||
this.update({ followerSubtypeListDialog: {} });
|
||||
},
|
||||
/**
|
||||
* @param {FollowerSubtype} subtype
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, many, one } from '@mail/model/model_field';
|
||||
import { insertAndReplace } from '@mail/model/model_field_command';
|
||||
|
||||
registerModel({
|
||||
name: 'FollowerListMenuView',
|
||||
@@ -33,9 +32,7 @@ registerModel({
|
||||
* @returns {FieldCommand}
|
||||
*/
|
||||
_computeFollowerViews() {
|
||||
return insertAndReplace(this.chatterOwner.thread.followers.map(follower => {
|
||||
return { follower };
|
||||
}));
|
||||
return this.chatterOwner.thread.followers.map(follower => ({ follower }));
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, many, one } from '@mail/model/model_field';
|
||||
import { clear, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear } from '@mail/model/model_field_command';
|
||||
|
||||
registerModel({
|
||||
name: 'FollowerSubtypeList',
|
||||
@@ -40,7 +40,7 @@ registerModel({
|
||||
if (this.follower.subtypes.length === 0) {
|
||||
return clear();
|
||||
}
|
||||
return insertAndReplace(this.follower.subtypes.map(subtype => ({ subtype })));
|
||||
return this.follower.subtypes.map(subtype => ({ subtype }));
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
import { attr, many, one } from '@mail/model/model_field';
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { insertAndReplace } from '@mail/model/model_field_command';
|
||||
|
||||
registerModel({
|
||||
name: 'Guest',
|
||||
@@ -54,7 +53,7 @@ registerModel({
|
||||
}),
|
||||
name: attr(),
|
||||
persona: one('Persona', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
inverse: 'guest',
|
||||
isCausal: true,
|
||||
readonly: true,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, one } from '@mail/model/model_field';
|
||||
import { clear, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear } from '@mail/model/model_field_command';
|
||||
import { OnChange } from '@mail/model/model_onchange';
|
||||
|
||||
registerModel({
|
||||
@@ -80,10 +80,10 @@ registerModel({
|
||||
if (!threadId) {
|
||||
return clear();
|
||||
}
|
||||
return insertAndReplace({
|
||||
return {
|
||||
id: threadId,
|
||||
model: 'mail.box',
|
||||
});
|
||||
};
|
||||
},
|
||||
_onChangeCounter() {
|
||||
if (this !== this.messaging.inbox) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, many, one } from '@mail/model/model_field';
|
||||
import { clear, insert, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear, insert } from '@mail/model/model_field_command';
|
||||
import { addLink, htmlToTextContentInline, parseAndTransform } from '@mail/js/utils';
|
||||
|
||||
import { session } from '@web/session';
|
||||
@@ -81,7 +81,7 @@ registerModel({
|
||||
if ('module_icon' in data) {
|
||||
originThreadData.moduleIcon = data.module_icon;
|
||||
}
|
||||
data2.originThread = insertAndReplace(originThreadData);
|
||||
data2.originThread = originThreadData;
|
||||
}
|
||||
if ('needaction_partner_ids' in data && this.messaging.currentPartner) {
|
||||
data2.isNeedaction = data.needaction_partner_ids.includes(this.messaging.currentPartner.id);
|
||||
@@ -95,11 +95,11 @@ registerModel({
|
||||
if (!data.parentMessage) {
|
||||
data2.parentMessage = clear();
|
||||
} else {
|
||||
data2.parentMessage = insertAndReplace(this.convertData(data.parentMessage));
|
||||
data2.parentMessage = this.convertData(data.parentMessage);
|
||||
}
|
||||
}
|
||||
if ('recipients' in data) {
|
||||
data2.recipients = insertAndReplace(data.recipients);
|
||||
data2.recipients = data.recipients;
|
||||
}
|
||||
if ('starred_partner_ids' in data && this.messaging.currentPartner) {
|
||||
data2.isStarred = data.starred_partner_ids.includes(this.messaging.currentPartner.id);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, one } from '@mail/model/model_field';
|
||||
import { clear, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear } from '@mail/model/model_field_command';
|
||||
import { markEventHandled } from '@mail/utils/utils';
|
||||
|
||||
registerModel({
|
||||
@@ -20,7 +20,7 @@ registerModel({
|
||||
* @param {MouseEvent} ev
|
||||
*/
|
||||
onClickDelete(ev) {
|
||||
this.update({ deleteConfirmDialog: insertAndReplace() });
|
||||
this.update({ deleteConfirmDialog: {} });
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
@@ -41,7 +41,7 @@ registerModel({
|
||||
*/
|
||||
onClickActionReaction() {
|
||||
if (!this.reactionPopoverView) {
|
||||
this.update({ reactionPopoverView: insertAndReplace() });
|
||||
this.update({ reactionPopoverView: {} });
|
||||
} else {
|
||||
this.update({ reactionPopoverView: clear() });
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, many, one } from '@mail/model/model_field';
|
||||
import { clear, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear } from '@mail/model/model_field_command';
|
||||
|
||||
registerModel({
|
||||
name: 'MessageListView',
|
||||
@@ -79,7 +79,7 @@ registerModel({
|
||||
});
|
||||
prevMessage = message;
|
||||
}
|
||||
return insertAndReplace(messageViewsData);
|
||||
return messageViewsData;
|
||||
},
|
||||
},
|
||||
fields: {
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, one } from '@mail/model/model_field';
|
||||
import { insertAndReplace } from '@mail/model/model_field_command';
|
||||
|
||||
/**
|
||||
* Models a relation between a message list view and a message view where
|
||||
@@ -23,7 +22,7 @@ registerModel({
|
||||
inverse: 'messageListViewMessageViewItems',
|
||||
}),
|
||||
messageView: one('MessageView', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
inverse: 'messageListViewMessageViewItemOwner',
|
||||
isCausal: true,
|
||||
readonly: true,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { one } from '@mail/model/model_field';
|
||||
import { clear, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear } from '@mail/model/model_field_command';
|
||||
|
||||
registerModel({
|
||||
name: 'MessageSeenIndicatorView',
|
||||
@@ -13,10 +13,10 @@ registerModel({
|
||||
*/
|
||||
_computeMessageSeenIndicator() {
|
||||
if (this.messageViewOwner.messageListViewMessageViewItemOwner && this.messageViewOwner.messageListViewMessageViewItemOwner.messageListViewOwner.threadViewOwner.thread) {
|
||||
return insertAndReplace({
|
||||
return {
|
||||
message: this.messageViewOwner.message,
|
||||
thread: this.messageViewOwner.messageListViewMessageViewItemOwner.messageListViewOwner.threadViewOwner.thread,
|
||||
});
|
||||
};
|
||||
}
|
||||
return clear();
|
||||
},
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, one } from '@mail/model/model_field';
|
||||
import { clear, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear } from '@mail/model/model_field_command';
|
||||
import { isEventHandled, markEventHandled } from '@mail/utils/utils';
|
||||
|
||||
registerModel({
|
||||
@@ -14,7 +14,7 @@ registerModel({
|
||||
*/
|
||||
highlight() {
|
||||
this.update({
|
||||
highlightTimer: [clear(), insertAndReplace()],
|
||||
highlightTimer: { doReset: this.highlightTimer ? true : undefined },
|
||||
isHighlighted: true,
|
||||
});
|
||||
},
|
||||
@@ -117,7 +117,10 @@ registerModel({
|
||||
}
|
||||
},
|
||||
onHighlightTimerTimeout() {
|
||||
this.update({ isHighlighted: false });
|
||||
this.update({
|
||||
highlightTimer: clear(),
|
||||
isHighlighted: false,
|
||||
});
|
||||
},
|
||||
onMouseenter() {
|
||||
this.update({ isHovered: true });
|
||||
@@ -138,15 +141,15 @@ registerModel({
|
||||
return;
|
||||
}
|
||||
this.message.originThread.update({
|
||||
composer: insertAndReplace({
|
||||
composer: {
|
||||
isLog: !this.message.is_discussion && !this.message.is_notification,
|
||||
}),
|
||||
},
|
||||
});
|
||||
this.messageListViewMessageViewItemOwner.messageListViewOwner.threadViewOwner.update({
|
||||
replyingToMessageView: this,
|
||||
composerView: insertAndReplace({
|
||||
composerView: {
|
||||
doFocus: true,
|
||||
}),
|
||||
},
|
||||
});
|
||||
},
|
||||
/**
|
||||
@@ -157,17 +160,17 @@ registerModel({
|
||||
const htmlDoc = parser.parseFromString(this.message.body.replaceAll('<br>', '\n').replaceAll('</br>', '\n'), "text/html");
|
||||
const textInputContent = htmlDoc.body.textContent;
|
||||
this.update({
|
||||
composerForEditing: insertAndReplace({
|
||||
composerForEditing: {
|
||||
mentionedPartners: this.message.recipients,
|
||||
textInputContent,
|
||||
textInputCursorEnd: textInputContent.length,
|
||||
textInputCursorStart: textInputContent.length,
|
||||
textInputSelectionDirection: 'none',
|
||||
}),
|
||||
composerViewInEditing: insertAndReplace({
|
||||
},
|
||||
composerViewInEditing: {
|
||||
doFocus: true,
|
||||
hasToRestoreContent: true,
|
||||
}),
|
||||
},
|
||||
});
|
||||
},
|
||||
/**
|
||||
@@ -188,7 +191,7 @@ registerModel({
|
||||
*/
|
||||
_computeAttachmentList() {
|
||||
return (this.message && this.message.attachments.length > 0)
|
||||
? insertAndReplace()
|
||||
? {}
|
||||
: clear();
|
||||
},
|
||||
/**
|
||||
@@ -382,7 +385,7 @@ registerModel({
|
||||
* @returns {FieldCommand}
|
||||
*/
|
||||
_computeMessageActionList() {
|
||||
return this.deleteMessageConfirmViewOwner ? clear() : insertAndReplace();
|
||||
return this.deleteMessageConfirmViewOwner ? clear() : {};
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
@@ -394,7 +397,7 @@ registerModel({
|
||||
this.message.originThread &&
|
||||
this.message.originThread.model === 'mail.channel' &&
|
||||
this.message.parentMessage
|
||||
) ? insertAndReplace() : clear();
|
||||
) ? {} : clear();
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
@@ -407,7 +410,7 @@ registerModel({
|
||||
this.messageListViewMessageViewItemOwner.messageListViewOwner.threadViewOwner.thread &&
|
||||
this.messageListViewMessageViewItemOwner.messageListViewOwner.threadViewOwner.thread.hasSeenIndicators
|
||||
) {
|
||||
return insertAndReplace();
|
||||
return {};
|
||||
}
|
||||
return clear();
|
||||
},
|
||||
@@ -417,9 +420,9 @@ registerModel({
|
||||
*/
|
||||
_computePersonaImStatusIconView() {
|
||||
if (this.message.guestAuthor && this.message.guestAuthor.im_status) {
|
||||
return insertAndReplace();
|
||||
return {};
|
||||
}
|
||||
return this.message.author && this.message.author.isImStatusSet ? insertAndReplace() : clear();
|
||||
return this.message.author && this.message.author.isImStatusSet ? {} : clear();
|
||||
},
|
||||
},
|
||||
fields: {
|
||||
@@ -437,11 +440,11 @@ registerModel({
|
||||
compute: '_computeAuthorTitleText',
|
||||
}),
|
||||
clockWatcher: one('ClockWatcher', {
|
||||
default: insertAndReplace({
|
||||
clock: insertAndReplace({
|
||||
default: {
|
||||
clock: {
|
||||
frequency: 60 * 1000,
|
||||
}),
|
||||
}),
|
||||
},
|
||||
},
|
||||
inverse: 'messageViewOwner',
|
||||
isCausal: true,
|
||||
}),
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, many, one } from '@mail/model/model_field';
|
||||
import { OnChange } from '@mail/model/model_onchange';
|
||||
import { clear, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear } from '@mail/model/model_field_command';
|
||||
import { makeDeferred } from '@mail/utils/deferred';
|
||||
|
||||
import { browser } from '@web/core/browser/browser';
|
||||
@@ -204,7 +204,9 @@ registerModel({
|
||||
this.update({ isNotificationPermissionDefault: this._computeIsNotificationPermissionDefault() });
|
||||
},
|
||||
async startFetchImStatus() {
|
||||
this.update({ fetchImStatusTimer: [clear(), insertAndReplace()] });
|
||||
this.update({
|
||||
fetchImStatusTimer: { doReset: this.fetchImStatusTimer ? true : undefined },
|
||||
});
|
||||
const partnerIds = [];
|
||||
for (const partner of this.models['Partner'].all()) {
|
||||
if (partner.im_status !== 'im_partner' && partner.id > 0) {
|
||||
@@ -307,7 +309,7 @@ registerModel({
|
||||
* @returns {FieldCommand}
|
||||
*/
|
||||
_computeNotificationHandler() {
|
||||
return insertAndReplace();
|
||||
return {};
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
@@ -337,7 +339,7 @@ registerModel({
|
||||
}),
|
||||
cannedResponses: many('CannedResponse'),
|
||||
chatWindowManager: one('ChatWindowManager', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
isCausal: true,
|
||||
readonly: true,
|
||||
}),
|
||||
@@ -353,12 +355,12 @@ registerModel({
|
||||
currentPartner: one('Partner'),
|
||||
currentUser: one('User'),
|
||||
device: one('Device', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
isCausal: true,
|
||||
readonly: true,
|
||||
}),
|
||||
dialogManager: one('DialogManager', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
isCausal: true,
|
||||
readonly: true,
|
||||
}),
|
||||
@@ -369,12 +371,12 @@ registerModel({
|
||||
default: false,
|
||||
}),
|
||||
discuss: one('Discuss', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
isCausal: true,
|
||||
readonly: true,
|
||||
}),
|
||||
emojiRegistry: one('EmojiRegistry', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
isCausal: true,
|
||||
readonly: true,
|
||||
}),
|
||||
@@ -386,12 +388,12 @@ registerModel({
|
||||
default: 50 * 1000,
|
||||
}),
|
||||
history: one('Mailbox', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
inverse: 'messagingAsHistory',
|
||||
isCausal: true,
|
||||
}),
|
||||
inbox: one('Mailbox', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
inverse: 'messagingAsInbox',
|
||||
isCausal: true,
|
||||
}),
|
||||
@@ -404,7 +406,7 @@ registerModel({
|
||||
readonly: true,
|
||||
}),
|
||||
initializer: one('MessagingInitializer', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
isCausal: true,
|
||||
readonly: true,
|
||||
}),
|
||||
@@ -429,7 +431,7 @@ registerModel({
|
||||
compute: '_computeIsNotificationPermissionDefault',
|
||||
}),
|
||||
locale: one('Locale', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
isCausal: true,
|
||||
readonly: true,
|
||||
}),
|
||||
@@ -449,7 +451,7 @@ registerModel({
|
||||
required: true,
|
||||
}),
|
||||
messagingMenu: one('MessagingMenu', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
isCausal: true,
|
||||
}),
|
||||
notificationHandler: one('MessagingNotificationHandler', {
|
||||
@@ -462,7 +464,7 @@ registerModel({
|
||||
}),
|
||||
partnerRoot: one('Partner'),
|
||||
popoverManager: one('PopoverManager', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
isCausal: true,
|
||||
readonly: true,
|
||||
}),
|
||||
@@ -479,7 +481,7 @@ registerModel({
|
||||
inverse: 'messagingAsRingingThread',
|
||||
}),
|
||||
rtc: one('Rtc', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
isCausal: true,
|
||||
readonly: true,
|
||||
}),
|
||||
@@ -488,22 +490,22 @@ registerModel({
|
||||
isCausal: true,
|
||||
}),
|
||||
soundEffects: one('SoundEffects', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
isCausal: true,
|
||||
readonly: true,
|
||||
}),
|
||||
starred: one('Mailbox', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
inverse: 'messagingAsStarred',
|
||||
isCausal: true,
|
||||
}),
|
||||
userNotificationManager: one('UserNotificationManager', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
isCausal: true,
|
||||
readonly: true,
|
||||
}),
|
||||
userSetting: one('UserSetting', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
isCausal: true,
|
||||
}),
|
||||
},
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, many, one } from '@mail/model/model_field';
|
||||
import { clear, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear } from '@mail/model/model_field_command';
|
||||
|
||||
registerModel({
|
||||
name: 'MessagingMenu',
|
||||
@@ -125,7 +125,7 @@ registerModel({
|
||||
*/
|
||||
_computeMobileMessagingNavbarView() {
|
||||
if (this.messaging.device && this.messaging.device.isSmall) {
|
||||
return insertAndReplace();
|
||||
return {};
|
||||
}
|
||||
return clear();
|
||||
},
|
||||
@@ -135,7 +135,7 @@ registerModel({
|
||||
*/
|
||||
_computeMobileNewMessageAutocompleteInputView() {
|
||||
if (this.isOpen && this.messaging.isInitialized && this.messaging.device.isSmall && this.isMobileNewMessageToggled) {
|
||||
return insertAndReplace();
|
||||
return {};
|
||||
}
|
||||
return clear();
|
||||
},
|
||||
@@ -150,7 +150,7 @@ registerModel({
|
||||
* @returns {FieldCommand}
|
||||
*/
|
||||
_computeNotificationListView() {
|
||||
return this.isOpen ? insertAndReplace() : clear();
|
||||
return this.isOpen ? {} : clear();
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { decrement, increment, insert, insertAndReplace, unlink } from '@mail/model/model_field_command';
|
||||
import { decrement, increment, insert, unlink } from '@mail/model/model_field_command';
|
||||
import { htmlToTextContentInline } from '@mail/js/utils';
|
||||
|
||||
import { escape, sprintf } from '@web/core/utils/strings';
|
||||
@@ -175,11 +175,11 @@ registerModel({
|
||||
}
|
||||
this.messaging.models['ThreadPartnerSeenInfo'].insert({
|
||||
lastFetchedMessage: insert({ id: last_message_id }),
|
||||
partner: insertAndReplace({ id: partner_id }),
|
||||
partner: { id: partner_id },
|
||||
thread: channel.thread,
|
||||
});
|
||||
this.messaging.models['MessageSeenIndicator'].insert({
|
||||
message: insertAndReplace({ id: last_message_id }),
|
||||
message: { id: last_message_id },
|
||||
thread: channel.thread,
|
||||
});
|
||||
},
|
||||
@@ -318,7 +318,7 @@ registerModel({
|
||||
if (shouldComputeSeenIndicators) {
|
||||
this.messaging.models['ThreadPartnerSeenInfo'].insert({
|
||||
lastSeenMessage: lastMessage,
|
||||
partner: insertAndReplace({ id: partner_id }),
|
||||
partner: { id: partner_id },
|
||||
thread: channel.thread,
|
||||
});
|
||||
this.messaging.models['MessageSeenIndicator'].insert({
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, one } from '@mail/model/model_field';
|
||||
import { clear, insert, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear, insert } from '@mail/model/model_field_command';
|
||||
|
||||
registerModel({
|
||||
name: 'Notification',
|
||||
@@ -107,12 +107,12 @@ registerModel({
|
||||
// Except for channel where they are also grouped by id because
|
||||
// we want to open the actual channel in discuss or chat window
|
||||
// and not its kanban/list/form view.
|
||||
return insertAndReplace({
|
||||
return {
|
||||
notification_type: this.notification_type,
|
||||
res_id: thread.model === 'mail.channel' ? thread.id : null,
|
||||
res_model: thread.model,
|
||||
res_model_name: thread.model_name,
|
||||
});
|
||||
};
|
||||
},
|
||||
},
|
||||
fields: {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, many, one } from '@mail/model/model_field';
|
||||
import { clear, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear } from '@mail/model/model_field_command';
|
||||
|
||||
registerModel({
|
||||
name: 'NotificationListView',
|
||||
@@ -67,21 +67,17 @@ registerModel({
|
||||
if (this.filter !== 'all') {
|
||||
return clear();
|
||||
}
|
||||
return insertAndReplace(
|
||||
this.models['NotificationGroup']
|
||||
.all()
|
||||
.sort((group1, group2) => group1.sequence - group2.sequence)
|
||||
.map(notificationGroup => {
|
||||
return { notificationGroup };
|
||||
})
|
||||
);
|
||||
return this.models['NotificationGroup']
|
||||
.all()
|
||||
.sort((group1, group2) => group1.sequence - group2.sequence)
|
||||
.map(notificationGroup => ({ notificationGroup }));
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @returns {FieldCommand}
|
||||
*/
|
||||
_computeNotificationRequestView() {
|
||||
return (this.filter === 'all' && this.messaging.isNotificationPermissionDefault) ? insertAndReplace() : clear();
|
||||
return (this.filter === 'all' && this.messaging.isNotificationPermissionDefault) ? {} : clear();
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
@@ -105,63 +101,53 @@ registerModel({
|
||||
if (this.filter !== 'all') {
|
||||
return clear();
|
||||
}
|
||||
return insertAndReplace(
|
||||
this.messaging.models['Thread']
|
||||
.all(t => !t.mailbox && t.needactionMessagesAsOriginThread.length > 0)
|
||||
.sort((t1, t2) => {
|
||||
if (t1.needactionMessagesAsOriginThread.length > 0 && t2.needactionMessagesAsOriginThread.length === 0) {
|
||||
return -1;
|
||||
}
|
||||
if (t1.needactionMessagesAsOriginThread.length === 0 && t2.needactionMessagesAsOriginThread.length > 0) {
|
||||
return 1;
|
||||
}
|
||||
if (t1.lastNeedactionMessageAsOriginThread && t2.lastNeedactionMessageAsOriginThread) {
|
||||
return t1.lastNeedactionMessageAsOriginThread.id < t2.lastNeedactionMessageAsOriginThread.id ? 1 : -1;
|
||||
}
|
||||
if (t1.lastNeedactionMessageAsOriginThread) {
|
||||
return -1;
|
||||
}
|
||||
if (t2.lastNeedactionMessageAsOriginThread) {
|
||||
return 1;
|
||||
}
|
||||
return t1.id < t2.id ? -1 : 1;
|
||||
})
|
||||
.map(thread => {
|
||||
return { thread };
|
||||
})
|
||||
);
|
||||
return this.messaging.models['Thread']
|
||||
.all(t => !t.mailbox && t.needactionMessagesAsOriginThread.length > 0)
|
||||
.sort((t1, t2) => {
|
||||
if (t1.needactionMessagesAsOriginThread.length > 0 && t2.needactionMessagesAsOriginThread.length === 0) {
|
||||
return -1;
|
||||
}
|
||||
if (t1.needactionMessagesAsOriginThread.length === 0 && t2.needactionMessagesAsOriginThread.length > 0) {
|
||||
return 1;
|
||||
}
|
||||
if (t1.lastNeedactionMessageAsOriginThread && t2.lastNeedactionMessageAsOriginThread) {
|
||||
return t1.lastNeedactionMessageAsOriginThread.id < t2.lastNeedactionMessageAsOriginThread.id ? 1 : -1;
|
||||
}
|
||||
if (t1.lastNeedactionMessageAsOriginThread) {
|
||||
return -1;
|
||||
}
|
||||
if (t2.lastNeedactionMessageAsOriginThread) {
|
||||
return 1;
|
||||
}
|
||||
return t1.id < t2.id ? -1 : 1;
|
||||
})
|
||||
.map(thread => ({ thread }));
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
* @returns {FieldCommand}
|
||||
*/
|
||||
_computeThreadPreviewViews() {
|
||||
return insertAndReplace(
|
||||
this.filteredThreads
|
||||
.sort((t1, t2) => {
|
||||
if (t1.localMessageUnreadCounter > 0 && t2.localMessageUnreadCounter === 0) {
|
||||
return -1;
|
||||
}
|
||||
if (t1.localMessageUnreadCounter === 0 && t2.localMessageUnreadCounter > 0) {
|
||||
return 1;
|
||||
}
|
||||
if (t1.lastMessage && t2.lastMessage) {
|
||||
return t1.lastMessage.id < t2.lastMessage.id ? 1 : -1;
|
||||
}
|
||||
if (t1.lastMessage) {
|
||||
return -1;
|
||||
}
|
||||
if (t2.lastMessage) {
|
||||
return 1;
|
||||
}
|
||||
return t1.id < t2.id ? -1 : 1;
|
||||
})
|
||||
.map(thread => {
|
||||
return {
|
||||
thread,
|
||||
};
|
||||
})
|
||||
);
|
||||
return this.filteredThreads
|
||||
.sort((t1, t2) => {
|
||||
if (t1.localMessageUnreadCounter > 0 && t2.localMessageUnreadCounter === 0) {
|
||||
return -1;
|
||||
}
|
||||
if (t1.localMessageUnreadCounter === 0 && t2.localMessageUnreadCounter > 0) {
|
||||
return 1;
|
||||
}
|
||||
if (t1.lastMessage && t2.lastMessage) {
|
||||
return t1.lastMessage.id < t2.lastMessage.id ? 1 : -1;
|
||||
}
|
||||
if (t1.lastMessage) {
|
||||
return -1;
|
||||
}
|
||||
if (t2.lastMessage) {
|
||||
return 1;
|
||||
}
|
||||
return t1.id < t2.id ? -1 : 1;
|
||||
})
|
||||
.map(thread => ({ thread }));
|
||||
},
|
||||
/**
|
||||
* Load previews of given thread. Basically consists of fetching all missing
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, one } from '@mail/model/model_field';
|
||||
import { clear, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear } from '@mail/model/model_field_command';
|
||||
|
||||
import { sprintf } from '@web/core/utils/strings';
|
||||
|
||||
@@ -27,7 +27,7 @@ registerModel({
|
||||
* @returns {FieldCommand}
|
||||
*/
|
||||
_computePersonaImStatusIconView() {
|
||||
return this.messaging.partnerRoot && this.messaging.partnerRoot.isImStatusSet ? insertAndReplace() : clear();
|
||||
return this.messaging.partnerRoot && this.messaging.partnerRoot.isImStatusSet ? {} : clear();
|
||||
},
|
||||
},
|
||||
fields: {
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { one } from '@mail/model/model_field';
|
||||
import { insertAndReplace } from '@mail/model/model_field_command';
|
||||
|
||||
registerModel({
|
||||
name: 'OtherMemberLongTypingInThreadTimer',
|
||||
@@ -21,7 +20,7 @@ registerModel({
|
||||
inverse: 'otherMembersLongTypingTimers',
|
||||
}),
|
||||
timer: one('Timer', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
inverse: 'otherMemberLongTypingInThreadTimerOwner',
|
||||
isCausal: true,
|
||||
required: true,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, many, one } from '@mail/model/model_field';
|
||||
import { clear, insert, insertAndReplace, link } from '@mail/model/model_field_command';
|
||||
import { clear, insert, link } from '@mail/model/model_field_command';
|
||||
import { cleanSearchTerm } from '@mail/utils/utils';
|
||||
|
||||
registerModel({
|
||||
@@ -433,14 +433,14 @@ registerModel({
|
||||
isCausal: true,
|
||||
}),
|
||||
persona: one('Persona', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
inverse: 'partner',
|
||||
isCausal: true,
|
||||
readonly: true,
|
||||
required: true,
|
||||
}),
|
||||
suggestable: one('ComposerSuggestable', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
inverse: 'partner',
|
||||
isCausal: true,
|
||||
readonly: true,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, one } from '@mail/model/model_field';
|
||||
import { clear, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear } from '@mail/model/model_field_command';
|
||||
|
||||
registerModel({
|
||||
name: 'PopoverView',
|
||||
@@ -32,7 +32,7 @@ registerModel({
|
||||
*/
|
||||
_computeActivityMarkDonePopoverContentView() {
|
||||
if (this.activityViewOwnerAsMarkDone) {
|
||||
return insertAndReplace();
|
||||
return {};
|
||||
}
|
||||
return clear();
|
||||
},
|
||||
@@ -61,7 +61,7 @@ registerModel({
|
||||
*/
|
||||
_computeChannelInvitationForm() {
|
||||
if (this.threadViewTopbarOwnerAsInvite) {
|
||||
return insertAndReplace();
|
||||
return {};
|
||||
}
|
||||
return clear();
|
||||
},
|
||||
@@ -116,10 +116,10 @@ registerModel({
|
||||
*/
|
||||
_computeEmojiPickerView() {
|
||||
if (this.composerViewOwnerAsEmoji) {
|
||||
return insertAndReplace();
|
||||
return {};
|
||||
}
|
||||
if (this.messageActionListOwnerAsReaction) {
|
||||
return insertAndReplace();
|
||||
return {};
|
||||
}
|
||||
return clear();
|
||||
},
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { one } from '@mail/model/model_field';
|
||||
import { insertAndReplace } from '@mail/model/model_field_command';
|
||||
|
||||
/**
|
||||
* The object below defines a model. Instances of such model (or inherited
|
||||
@@ -181,7 +180,7 @@ registerModel({
|
||||
* manager at creation.
|
||||
*/
|
||||
messaging: one('Messaging', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
inverse: 'allRecords',
|
||||
readonly: true,
|
||||
required: true,
|
||||
|
||||
@@ -4,7 +4,7 @@ import { browser } from "@web/core/browser/browser";
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, many, one } from '@mail/model/model_field';
|
||||
import { clear, insert, insertAndReplace, unlink } from '@mail/model/model_field_command';
|
||||
import { clear, insert, unlink } from '@mail/model/model_field_command';
|
||||
import { monitorAudio } from '@mail/utils/media_monitoring';
|
||||
import { sprintf } from '@web/core/utils/strings';
|
||||
|
||||
@@ -490,7 +490,7 @@ registerModel({
|
||||
this._addLogEntry(rtcSession.id, `failed to send on datachannel; dataChannelInfo: ${this._serializeRTCDataChannel(dataChannel)}`, { error: e });
|
||||
}
|
||||
};
|
||||
rtcSession.update({ rtcPeerConnection: insertAndReplace({ peerConnection }) });
|
||||
rtcSession.update({ rtcPeerConnection: { peerConnection } });
|
||||
this.messaging.models['RtcDataChannel'].insert({
|
||||
dataChannel,
|
||||
rtcSession,
|
||||
@@ -1211,7 +1211,7 @@ registerModel({
|
||||
default: 3000,
|
||||
}),
|
||||
callSystrayMenu: one('CallSystrayMenu', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
inverse: 'rtc',
|
||||
isCausal: true,
|
||||
}),
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, many, one } from '@mail/model/model_field';
|
||||
import { clear, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear } from '@mail/model/model_field_command';
|
||||
|
||||
registerModel({
|
||||
name: 'RtcSession',
|
||||
@@ -13,6 +13,7 @@ registerModel({
|
||||
},
|
||||
recordMethods: {
|
||||
onBroadcastTimeout() {
|
||||
this.update({ broadcastTimer: clear() });
|
||||
this.messaging.rpc(
|
||||
{
|
||||
route: '/mail/rtc/session/update_and_broadcast',
|
||||
@@ -111,8 +112,10 @@ registerModel({
|
||||
if (!this.rtcAsCurrentSession) {
|
||||
return;
|
||||
}
|
||||
const data2 = Object.assign({}, data, { broadcastTimer: [clear(), insertAndReplace()] });
|
||||
this.update(data2);
|
||||
this.update({
|
||||
...data,
|
||||
broadcastTimer: { doReset: this.broadcastTimer ? true : undefined },
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Updates the rtcSession with information on the type of candidate used
|
||||
|
||||
@@ -2,57 +2,56 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { one } from '@mail/model/model_field';
|
||||
import { insertAndReplace } from '@mail/model/model_field_command';
|
||||
|
||||
registerModel({
|
||||
name: 'SoundEffects',
|
||||
fields: {
|
||||
channelJoin: one('SoundEffect', {
|
||||
default: insertAndReplace({ defaultVolume: 0.3, filename: 'channel_01_in' }),
|
||||
default: { defaultVolume: 0.3, filename: 'channel_01_in' },
|
||||
isCausal: true,
|
||||
}),
|
||||
channelLeave: one('SoundEffect', {
|
||||
default: insertAndReplace({ filename: 'channel_04_out' }),
|
||||
default: { filename: 'channel_04_out' },
|
||||
isCausal: true,
|
||||
}),
|
||||
deafen: one('SoundEffect', {
|
||||
default: insertAndReplace({ defaultVolume: 0.15, filename: 'deafen_new_01' }),
|
||||
default: { defaultVolume: 0.15, filename: 'deafen_new_01' },
|
||||
isCausal: true,
|
||||
}),
|
||||
incomingCall: one('SoundEffect', {
|
||||
default: insertAndReplace({ defaultVolume: 0.15, filename: 'call_02_in_' }),
|
||||
default: { defaultVolume: 0.15, filename: 'call_02_in_' },
|
||||
isCausal: true,
|
||||
}),
|
||||
memberLeave: one('SoundEffect', {
|
||||
default: insertAndReplace({ defaultVolume: 0.5, filename: 'channel_01_out' }),
|
||||
default: { defaultVolume: 0.5, filename: 'channel_01_out' },
|
||||
isCausal: true,
|
||||
}),
|
||||
mute: one('SoundEffect', {
|
||||
default: insertAndReplace({ defaultVolume: 0.2, filename: 'mute_1' }),
|
||||
default: { defaultVolume: 0.2, filename: 'mute_1' },
|
||||
isCausal: true,
|
||||
}),
|
||||
newMessage: one('SoundEffect', {
|
||||
default: insertAndReplace({ filename: 'dm_02' }),
|
||||
default: { filename: 'dm_02' },
|
||||
isCausal: true,
|
||||
}),
|
||||
pushToTalkOn: one('SoundEffect', {
|
||||
default: insertAndReplace({ defaultVolume: 0.05, filename: 'ptt_push_1' }),
|
||||
default: { defaultVolume: 0.05, filename: 'ptt_push_1' },
|
||||
isCausal: true,
|
||||
}),
|
||||
pushToTalkOff: one('SoundEffect', {
|
||||
default: insertAndReplace({ defaultVolume: 0.05, filename: 'ptt_release_1' }),
|
||||
default: { defaultVolume: 0.05, filename: 'ptt_release_1' },
|
||||
isCausal: true,
|
||||
}),
|
||||
screenSharing: one('SoundEffect', {
|
||||
default: insertAndReplace({ defaultVolume: 0.5, filename: 'share_02' }),
|
||||
default: { defaultVolume: 0.5, filename: 'share_02' },
|
||||
isCausal: true,
|
||||
}),
|
||||
undeafen: one('SoundEffect', {
|
||||
default: insertAndReplace({ defaultVolume: 0.15, filename: 'undeafen_new_01' }),
|
||||
default: { defaultVolume: 0.15, filename: 'undeafen_new_01' },
|
||||
isCausal: true,
|
||||
}),
|
||||
unmute: one('SoundEffect', {
|
||||
default: insertAndReplace({ defaultVolume: 0.2, filename: 'unmute_1' }),
|
||||
default: { defaultVolume: 0.2, filename: 'unmute_1' },
|
||||
isCausal: true,
|
||||
}),
|
||||
},
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, many, one } from '@mail/model/model_field';
|
||||
import { clear, insert, insertAndReplace, insertAndUnlink, link, unlink } from '@mail/model/model_field_command';
|
||||
import { clear, insert, insertAndUnlink, link, unlink } from '@mail/model/model_field_command';
|
||||
import { OnChange } from '@mail/model/model_onchange';
|
||||
import { cleanSearchTerm } from '@mail/utils/utils';
|
||||
import * as mailUtils from '@mail/js/utils';
|
||||
@@ -124,13 +124,12 @@ registerModel({
|
||||
|
||||
// relations
|
||||
if ('members' in data) {
|
||||
// The list syntax is kept here because it is used in livechat override
|
||||
if (!data.members) {
|
||||
data2.members = [clear()];
|
||||
data2.members = [];
|
||||
} else {
|
||||
data2.members = [insertAndReplace(data.members.map(memberData =>
|
||||
data2.members = data.members.map(memberData =>
|
||||
this.messaging.models['Partner'].convertData(memberData)
|
||||
))];
|
||||
);
|
||||
}
|
||||
}
|
||||
if ('rtc_inviting_session' in data) {
|
||||
@@ -143,16 +142,14 @@ registerModel({
|
||||
if (!data.seen_partners_info) {
|
||||
data2.partnerSeenInfos = clear();
|
||||
} else {
|
||||
data2.partnerSeenInfos = insertAndReplace(
|
||||
data.seen_partners_info.map(
|
||||
({ fetched_message_id, partner_id, seen_message_id }) => {
|
||||
return {
|
||||
lastFetchedMessage: fetched_message_id ? insert({ id: fetched_message_id }) : clear(),
|
||||
lastSeenMessage: seen_message_id ? insert({ id: seen_message_id }) : clear(),
|
||||
partner: insertAndReplace({ id: partner_id }),
|
||||
};
|
||||
})
|
||||
);
|
||||
data2.partnerSeenInfos = data.seen_partners_info.map(
|
||||
({ fetched_message_id, partner_id, seen_message_id }) => {
|
||||
return {
|
||||
lastFetchedMessage: fetched_message_id ? insert({ id: fetched_message_id }) : clear(),
|
||||
lastSeenMessage: seen_message_id ? insert({ id: seen_message_id }) : clear(),
|
||||
partner: { id: partner_id },
|
||||
};
|
||||
});
|
||||
if (data.id || this.id) {
|
||||
const messageIds = data.seen_partners_info.reduce((currentSet, { fetched_message_id, seen_message_id }) => {
|
||||
if (fetched_message_id) {
|
||||
@@ -164,11 +161,11 @@ registerModel({
|
||||
return currentSet;
|
||||
}, new Set());
|
||||
if (messageIds.size > 0) {
|
||||
data2.messageSeenIndicators = insertAndReplace([...messageIds].map(messageId => {
|
||||
data2.messageSeenIndicators = [...messageIds].map(messageId => {
|
||||
return {
|
||||
message: insertAndReplace({ id: messageId }),
|
||||
message: { id: messageId },
|
||||
};
|
||||
}));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -432,10 +429,10 @@ registerModel({
|
||||
});
|
||||
return this.insert(channelsData.map(channelData =>
|
||||
this.messaging.models['Thread'].convertData({
|
||||
channel: insertAndReplace({
|
||||
channel: {
|
||||
channel_type: channelData.channel_type,
|
||||
id: channelData.id,
|
||||
}),
|
||||
},
|
||||
id: channelData.id,
|
||||
name: channelData.name,
|
||||
})
|
||||
@@ -545,23 +542,23 @@ registerModel({
|
||||
const values = { hasWriteAccess, mainAttachment, hasReadAccess };
|
||||
if (activitiesData) {
|
||||
Object.assign(values, {
|
||||
activities: insertAndReplace(activitiesData.map(activityData =>
|
||||
activities: activitiesData.map(activityData =>
|
||||
this.messaging.models['Activity'].convertData(activityData)
|
||||
)),
|
||||
),
|
||||
});
|
||||
}
|
||||
if (attachmentsData) {
|
||||
Object.assign(values, {
|
||||
areAttachmentsLoaded: true,
|
||||
isLoadingAttachments: false,
|
||||
originThreadAttachments: insertAndReplace(attachmentsData),
|
||||
originThreadAttachments: attachmentsData,
|
||||
});
|
||||
}
|
||||
if (followersData) {
|
||||
Object.assign(values, {
|
||||
followers: insertAndReplace(followersData.map(followerData =>
|
||||
followers: followersData.map(followerData =>
|
||||
this.messaging.models['Follower'].convertData(followerData)
|
||||
)),
|
||||
),
|
||||
});
|
||||
}
|
||||
if (suggestedRecipientsData) {
|
||||
@@ -578,7 +575,7 @@ registerModel({
|
||||
};
|
||||
});
|
||||
Object.assign(values, {
|
||||
suggestedRecipientInfoList: insertAndReplace(recipientInfoList),
|
||||
suggestedRecipientInfoList: recipientInfoList,
|
||||
});
|
||||
}
|
||||
this.update(values);
|
||||
@@ -864,7 +861,9 @@ registerModel({
|
||||
* Refresh the typing status of the current partner.
|
||||
*/
|
||||
refreshCurrentPartnerIsTyping() {
|
||||
this.update({ currentPartnerInactiveTypingTimer: [clear(), insertAndReplace()] });
|
||||
this.update({
|
||||
currentPartnerInactiveTypingTimer: { doReset: this.currentPartnerInactiveTypingTimer ? true : undefined },
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Called to refresh a registered other member partner that is typing
|
||||
@@ -888,8 +887,8 @@ registerModel({
|
||||
async registerCurrentPartnerIsTyping() {
|
||||
// Handling of typing timers.
|
||||
this.update({
|
||||
currentPartnerInactiveTypingTimer: insertAndReplace(),
|
||||
currentPartnerLongTypingTimer: insertAndReplace(),
|
||||
currentPartnerInactiveTypingTimer: {},
|
||||
currentPartnerLongTypingTimer: {},
|
||||
});
|
||||
// Manage typing member relation.
|
||||
const currentPartner = this.messaging.currentPartner;
|
||||
@@ -1063,7 +1062,7 @@ registerModel({
|
||||
if (this.mailbox) {
|
||||
return clear();
|
||||
}
|
||||
return insertAndReplace();
|
||||
return {};
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
@@ -1122,7 +1121,7 @@ registerModel({
|
||||
if (!discussSidebarCategory) {
|
||||
return clear();
|
||||
}
|
||||
return insertAndReplace({ category: discussSidebarCategory });
|
||||
return { category: discussSidebarCategory };
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
@@ -1221,6 +1220,7 @@ registerModel({
|
||||
*/
|
||||
_computeIsDescriptionEditableByCurrentUser() {
|
||||
return Boolean(
|
||||
this.messaging &&
|
||||
this.messaging.currentUser &&
|
||||
this.messaging.currentUser.isInternalUser &&
|
||||
this.isChannelDescriptionChangeable
|
||||
@@ -1449,7 +1449,7 @@ registerModel({
|
||||
* @returns {FieldCommand}
|
||||
*/
|
||||
_computeMessagingMenuAsPinnedAndUnreadChannel() {
|
||||
if (!this.messaging.messagingMenu) {
|
||||
if (!this.messaging || !this.messaging.messagingMenu) {
|
||||
return clear();
|
||||
}
|
||||
return (this.model === 'mail.channel' && this.isPinned && this.localMessageUnreadCounter > 0)
|
||||
@@ -1522,7 +1522,7 @@ registerModel({
|
||||
*/
|
||||
_computeCallInviteRequestPopup() {
|
||||
if (this.rtcInvitingSession) {
|
||||
return insertAndReplace();
|
||||
return {};
|
||||
}
|
||||
return clear();
|
||||
},
|
||||
@@ -1531,9 +1531,9 @@ registerModel({
|
||||
* @returns {Throttle}
|
||||
*/
|
||||
_computeThrottleNotifyCurrentPartnerTypingStatus() {
|
||||
return insertAndReplace({
|
||||
return {
|
||||
func: () => this._notifyCurrentPartnerTypingStatus(),
|
||||
});
|
||||
};
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
@@ -1625,7 +1625,7 @@ registerModel({
|
||||
}
|
||||
}
|
||||
if (this.isCurrentPartnerTyping && this.currentPartnerLongTypingTimer) {
|
||||
this.update({ currentPartnerLongTypingTimer: [clear(), insertAndReplace()] });
|
||||
this.currentPartnerLongTypingTimer.update({ doReset: true });
|
||||
}
|
||||
}
|
||||
this.update({
|
||||
@@ -1722,8 +1722,9 @@ registerModel({
|
||||
*/
|
||||
async onCurrentPartnerLongTypingTimeout() {
|
||||
this.update({
|
||||
isCurrentPartnerTyping: true,
|
||||
currentPartnerLongTypingTimer: clear(),
|
||||
forceNotifyNextCurrentPartnerTypingStatus: true,
|
||||
isCurrentPartnerTyping: true,
|
||||
});
|
||||
this.throttleNotifyCurrentPartnerTypingStatus.clear();
|
||||
await this.throttleNotifyCurrentPartnerTypingStatus.do();
|
||||
@@ -1759,7 +1760,7 @@ registerModel({
|
||||
*/
|
||||
avatarCacheKey: attr(),
|
||||
cache: one('ThreadCache', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
inverse: 'thread',
|
||||
isCausal: true,
|
||||
readonly: true,
|
||||
@@ -2274,7 +2275,7 @@ registerModel({
|
||||
default: 0,
|
||||
}),
|
||||
suggestable: one('ComposerSuggestable', {
|
||||
default: insertAndReplace(),
|
||||
default: {},
|
||||
inverse: 'thread',
|
||||
isCausal: true,
|
||||
readonly: true,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, one } from '@mail/model/model_field';
|
||||
import { clear, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear } from '@mail/model/model_field_command';
|
||||
import { htmlToTextContentInline } from '@mail/js/utils';
|
||||
|
||||
registerModel({
|
||||
@@ -71,7 +71,7 @@ registerModel({
|
||||
this.thread.lastNeedactionMessageAsOriginThread &&
|
||||
this.thread.lastNeedactionMessageAsOriginThread.author
|
||||
) {
|
||||
return insertAndReplace();
|
||||
return {};
|
||||
}
|
||||
return clear();
|
||||
},
|
||||
@@ -80,7 +80,7 @@ registerModel({
|
||||
* @returns {FieldCommand}
|
||||
*/
|
||||
_computePersonaImStatusIconView() {
|
||||
return this.thread.correspondent && this.thread.correspondent.isImStatusSet ? insertAndReplace() : clear();
|
||||
return this.thread.correspondent && this.thread.correspondent.isImStatusSet ? {} : clear();
|
||||
},
|
||||
},
|
||||
fields: {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, one } from '@mail/model/model_field';
|
||||
import { clear, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear } from '@mail/model/model_field_command';
|
||||
import { htmlToTextContentInline } from '@mail/js/utils';
|
||||
|
||||
registerModel({
|
||||
@@ -69,7 +69,7 @@ registerModel({
|
||||
this.thread.lastMessage &&
|
||||
this.thread.lastMessage.author
|
||||
) {
|
||||
return insertAndReplace();
|
||||
return {};
|
||||
}
|
||||
return clear();
|
||||
},
|
||||
@@ -78,7 +78,7 @@ registerModel({
|
||||
* @returns {FieldCommand}
|
||||
*/
|
||||
_computePersonaImStatusIconView() {
|
||||
return this.thread.correspondent && this.thread.correspondent.isImStatusSet ? insertAndReplace() : clear();
|
||||
return this.thread.correspondent && this.thread.correspondent.isImStatusSet ? {} : clear();
|
||||
},
|
||||
},
|
||||
fields: {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, many, one } from '@mail/model/model_field';
|
||||
import { clear, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear } from '@mail/model/model_field_command';
|
||||
import { OnChange } from '@mail/model/model_onchange';
|
||||
|
||||
registerModel({
|
||||
@@ -88,7 +88,7 @@ registerModel({
|
||||
*/
|
||||
_computeCallView() {
|
||||
return (this.thread && this.thread.model === 'mail.channel' && this.thread.rtcSessions.length > 0)
|
||||
? insertAndReplace()
|
||||
? {}
|
||||
: clear();
|
||||
},
|
||||
/**
|
||||
@@ -97,7 +97,7 @@ registerModel({
|
||||
*/
|
||||
_computeChannelMemberListView() {
|
||||
if (this.thread && this.thread.hasMemberListFeature && this.hasMemberList && this.isMemberListOpened) {
|
||||
return insertAndReplace();
|
||||
return {};
|
||||
}
|
||||
return clear();
|
||||
},
|
||||
@@ -112,7 +112,7 @@ registerModel({
|
||||
if (this.threadViewer && this.threadViewer.chatter) {
|
||||
return clear();
|
||||
}
|
||||
return insertAndReplace();
|
||||
return {};
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
@@ -160,7 +160,7 @@ registerModel({
|
||||
return (
|
||||
(this.thread && this.thread.isTemporary) ||
|
||||
(this.threadCache && this.threadCache.isLoaded)
|
||||
) ? insertAndReplace() : clear();
|
||||
) ? {} : clear();
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
@@ -224,7 +224,7 @@ registerModel({
|
||||
* @private
|
||||
*/
|
||||
_computeTopbar() {
|
||||
return this.hasTopbar ? insertAndReplace() : clear();
|
||||
return this.hasTopbar ? {} : clear();
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, one } from '@mail/model/model_field';
|
||||
import { clear, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear } from '@mail/model/model_field_command';
|
||||
|
||||
registerModel({
|
||||
name: 'ThreadViewTopbar',
|
||||
@@ -336,7 +336,7 @@ registerModel({
|
||||
* Open the invite popover view in this thread view topbar.
|
||||
*/
|
||||
openInvitePopoverView() {
|
||||
this.update({ invitePopoverView: insertAndReplace() });
|
||||
this.update({ invitePopoverView: {} });
|
||||
if (this.messaging.isCurrentUserGuest) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, one } from '@mail/model/model_field';
|
||||
import { clear, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear } from '@mail/model/model_field_command';
|
||||
|
||||
registerModel({
|
||||
name: 'ThreadViewer',
|
||||
@@ -55,7 +55,7 @@ registerModel({
|
||||
* @returns {ThreadViewer|undefined}
|
||||
*/
|
||||
_computeThreadView() {
|
||||
return this.hasThreadView ? insertAndReplace() : clear();
|
||||
return this.hasThreadView ? {} : clear();
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import { registerModel } from '@mail/model/model_core';
|
||||
import { attr, one } from '@mail/model/model_field';
|
||||
import { clear, insertAndReplace } from '@mail/model/model_field_command';
|
||||
import { clear } from '@mail/model/model_field_command';
|
||||
|
||||
/**
|
||||
* This model defines a "Throttle", which is an abstraction to throttle calls on a
|
||||
@@ -28,7 +28,7 @@ registerModel({
|
||||
async do() {
|
||||
if (!this.cooldownTimer) {
|
||||
this.func();
|
||||
this.update({ cooldownTimer: insertAndReplace() });
|
||||
this.update({ cooldownTimer: {} });
|
||||
} else {
|
||||
this.update({ shouldInvoke: true });
|
||||
}
|
||||
@@ -37,7 +37,10 @@ registerModel({
|
||||
if (this.shouldInvoke) {
|
||||
this.func();
|
||||
}
|
||||
this.update({ shouldInvoke: false });
|
||||
this.update({
|
||||
cooldownTimer: clear(),
|
||||
shouldInvoke: false,
|
||||
});
|
||||
},
|
||||
/**
|
||||
* @private
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user