Remove use of getView() and replace with getViewByURL() where necessary. (#2544)

* WIP

* Replace getView with getViewByURL
This commit is contained in:
Devin Binnie
2023-02-07 08:59:35 -05:00
committed by GitHub
parent 8babd52b81
commit 07e41ec678
14 changed files with 254 additions and 350 deletions

View File

@@ -752,7 +752,7 @@ export class WindowManager {
const currentView = this.viewManager?.views.get(viewName);
const cleanedPathName = urlUtils.cleanPathName(currentView?.tab.server.url.pathname || '', pathName);
const redirectedViewName = urlUtils.getView(`${currentView?.tab.server.url}${cleanedPathName}`, Config.teams)?.name || viewName;
const redirectedViewName = this.viewManager?.getViewByURL(`${currentView?.tab.server.url.toString().replace(/\/$/, '')}${cleanedPathName}`)?.name || viewName;
if (this.viewManager?.closedViews.has(redirectedViewName)) {
// If it's a closed view, just open it and stop
this.viewManager.openClosedTab(redirectedViewName, `${currentView?.tab.server.url}${cleanedPathName}`);
@@ -857,6 +857,14 @@ export class WindowManager {
view?.reload();
this.viewManager?.showByName(view?.name);
}
getServerURLFromWebContentsId = (id: number) => {
const viewName = this.getViewNameByWebContentsId(id);
if (!viewName) {
return undefined;
}
return this.viewManager?.views.get(viewName)?.tab.server.url;
}
}
const windowManager = new WindowManager();