fix(workspaces): Use active workspace context ID for external calls

This commit modifies the `getContextIdIfNeeded` method to automatically use the active workspace context ID for external calls.

Previously, external calls would use the provided `userContextId` if it was different from the active workspace context ID. Now, if `fromExternal` is true and there's an active workspace, the method will return the active workspace context ID, ensuring consistency with the active workspace.
This commit is contained in:
Kristijan Ribarić 2024-10-13 22:07:30 +02:00
parent 1bc2cf53c8
commit 893ebcd0f7

View file

@ -874,10 +874,19 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
});
}
getContextIdIfNeeded(userContextId) {
getContextIdIfNeeded(userContextId, fromExternal) {
if(!this.workspaceEnabled) {
return [userContextId, false];
}
const activeWorkspace = this.getActiveWorkspaceFromCache();
const activeWorkspaceUserContextId = activeWorkspace?.containerTabId;
if ((typeof userContextId !== 'undefined' && userContextId !== activeWorkspaceUserContextId) || !this.workspaceEnabled) {
if(fromExternal && !!activeWorkspaceUserContextId) {
return [activeWorkspaceUserContextId, true];
}
if (typeof userContextId !== 'undefined' && userContextId !== activeWorkspaceUserContextId) {
return [userContextId, false];
}
return [activeWorkspaceUserContextId, true];