diff options
| author | Sébastien Theys <seb@odoo.com> | 2020-08-03 10:55:05 +0000 |
|---|---|---|
| committer | Sébastien Theys <seb@odoo.com> | 2020-08-03 15:49:02 +0000 |
| commit | 24fba9fed710bcde9b15b5712d672f61e192b053 (patch) | |
| tree | 79f36ba43cd34fb4a287963c04e27a91f234ec71 /addons/mail/static/src/models/thread | |
| parent | 7f3a8d99287c835ee3ec703627c8ef906732c897 (diff) | |
[FIX] mail: speed up insert by using localId instead of find
Part of task-2308312
X-original-commit: 407dc9796543a27b6695c8d4da922c13dece5b38
Diffstat (limited to 'addons/mail/static/src/models/thread')
| -rw-r--r-- | addons/mail/static/src/models/thread/thread.js | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/addons/mail/static/src/models/thread/thread.js b/addons/mail/static/src/models/thread/thread.js index ceb4a366ec3..4459912d6f6 100644 --- a/addons/mail/static/src/models/thread/thread.js +++ b/addons/mail/static/src/models/thread/thread.js @@ -764,8 +764,13 @@ function factory(dependencies) { /** * @override */ - static _findFunctionFromData(data) { - return record => record.id === data.id && record.model === data.model; + static _createRecordLocalId(data) { + const { channel_type, id, model } = data; + let threadModel = model; + if (!threadModel && channel_type) { + threadModel = 'mail.channel'; + } + return `${this.modelName}_${threadModel}_${id}`; } /** @@ -1007,22 +1012,6 @@ function factory(dependencies) { } /** - * @override - */ - _createRecordLocalId(data) { - const { channel_type, id, isTemporary = false, model } = data; - let threadModel = model; - if (!threadModel && channel_type) { - threadModel = 'mail.channel'; - } - const Thread = this.env.models['mail.thread']; - if (isTemporary) { - return `${Thread.modelName}_${id}`; - } - return `${Thread.modelName}_${threadModel}_${id}`; - } - - /** * @private * @param {Object} param0 * @param {boolean} param0.isTyping |
