[FIX] mail: fix back button issue to close channel
Before this commit: When switching to mobile view and refreshing the channel in discuss than back arrow button is not working After this commit: Back arrow button will close the channel Task-2685187 closes odoo/odoo#85034 X-original-commit: ebe56aac6d11e967d3b2fc8b57031e1b0e8ea726 Signed-off-by: Sébastien Theys (seb) <seb@odoo.com> Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
committed by
Louis Wicket (wil)
parent
8640044fb7
commit
6fb5c3d82d
@@ -25,8 +25,6 @@ export class Discuss extends Component {
|
||||
}
|
||||
if (this.discussView.discuss.thread) {
|
||||
this.trigger('o-push-state-action-manager');
|
||||
} else if (!this._activeThreadCache) {
|
||||
this.discussView.discuss.openInitThread();
|
||||
}
|
||||
if (
|
||||
this.discussView.discuss.thread &&
|
||||
@@ -37,7 +35,6 @@ export class Discuss extends Component {
|
||||
) {
|
||||
this.trigger('o-show-rainbow-man');
|
||||
}
|
||||
this._activeThreadCache = this.discussView.discuss.threadView && this.discussView.discuss.threadView.threadCache;
|
||||
this._updateLocalStoreProps();
|
||||
}
|
||||
|
||||
|
||||
@@ -161,9 +161,7 @@ registerModel({
|
||||
this.update({ discussView: insertAndReplace() });
|
||||
},
|
||||
/**
|
||||
* Open thread from init active id. `initActiveId` is used to refer to
|
||||
* a thread that we may not have full data yet, such as when messaging
|
||||
* is not yet initialized.
|
||||
* Opens thread from init active id if the thread exists.
|
||||
*/
|
||||
openInitThread() {
|
||||
const [model, id] = typeof this.initActiveId === 'number'
|
||||
@@ -396,6 +394,14 @@ registerModel({
|
||||
compute: '_computeIsAddingChat',
|
||||
default: false,
|
||||
}),
|
||||
/**
|
||||
* Determines if the logic for opening a thread via the `initActiveId`
|
||||
* has been processed. This is necessary to ensure that this only
|
||||
* happens once.
|
||||
*/
|
||||
isInitThreadHandled: attr({
|
||||
default: false,
|
||||
}),
|
||||
/**
|
||||
* The menu_id of discuss app, received on mail/init_messaging and
|
||||
* used to open discuss from elsewhere.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { DiscussContainer } from "@mail/components/discuss_container/discuss_container";
|
||||
import { insertAndReplace } from '@mail/model/model_field_command';
|
||||
|
||||
import AbstractAction from 'web.AbstractAction';
|
||||
|
||||
@@ -31,14 +32,23 @@ export const DiscussWidget = AbstractAction.extend({
|
||||
|
||||
this._lastPushStateActiveThread = null;
|
||||
this.env = Component.env;
|
||||
Component.env.services.messaging.modelManager.messagingCreatedPromise.then(() => {
|
||||
Component.env.services.messaging.modelManager.messagingCreatedPromise.then(async () => {
|
||||
const messaging = Component.env.services.messaging.modelManager.messaging;
|
||||
const initActiveId = this.options.active_id ||
|
||||
(this.action.context && this.action.context.active_id) ||
|
||||
(this.action.params && this.action.params.default_active_id) ||
|
||||
'mail.box_inbox';
|
||||
this.discuss = messaging.discuss;
|
||||
this.discuss.update({ initActiveId });
|
||||
this.discuss.update({ discussView: insertAndReplace(), initActiveId });
|
||||
// Wait for messaging to be initialized to make sure the system
|
||||
// knows of the "init thread" if it exists.
|
||||
await messaging.initializedPromise;
|
||||
if (!this.discuss.isInitThreadHandled) {
|
||||
this.discuss.update({ isInitThreadHandled: true });
|
||||
if (!this.discuss.thread) {
|
||||
this.discuss.openInitThread();
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user