Skip to content

Commit

Permalink
Merge pull request #2644 from kristijanribaric/correctly-save-essenti…
Browse files Browse the repository at this point in the history
…als-in-db

Ensure that when adding an essential it is saved correctly in the database.
  • Loading branch information
mauro-balades authored Nov 5, 2024
2 parents 093722c + bf0342e commit 44e5a98
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/browser/base/zen-components/ZenPinnedTabManager.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@
newTab.setAttribute("zen-workspace-id", pin.workspaceUuid);
}

if (pin.isEssential) {
newTab.setAttribute("zen-essential", "true");
}

gBrowser.pinTab(newTab);
}

Expand All @@ -178,19 +182,18 @@
delete tab._zenClickEventListener;
}
break;
// TODO: Do this in a better way. Closing a second window could trigger remove tab and delete it from db
// case "TabClose":
// this._removePinnedAttributes(tab);
// break;
case "TabClose":
this._removePinnedAttributes(tab);
break;
default:
console.warn('ZenPinnedTabManager: Unhandled tab event', action);
break;
}
}

_onTabClick(e) {
const tab = e.target;
if (e.button === 1) {
const tab = e.target?.closest("tab");
if (e.button === 1 && tab) {
this._onCloseTabShortcut(e, tab);
}
}
Expand Down Expand Up @@ -246,7 +249,8 @@
title: tab.label || browser.contentTitle,
url: browser.currentURI.spec,
containerTabId: tab.getAttribute("userContextId"),
workspaceUuid: tab.getAttribute("zen-workspace-id")
workspaceUuid: tab.getAttribute("zen-workspace-id"),
isEssential: tab.getAttribute("zen-essential") === "true"
});

tab.setAttribute("zen-pin-id", uuid);
Expand Down

0 comments on commit 44e5a98

Please sign in to comment.