fix: notification click uses current window ref, dismiss on settings auto-allow

- Click handler reads this.mainWindowRef instead of captured closure ref,
  so window recreation is handled correctly
- reEvaluatePendingApprovals now calls dismissApprovalNotification when
  auto-allowing via settings change (was missing — stale notification stayed)
This commit is contained in:
iliya 2026-03-21 13:40:02 +02:00
parent b3cc2f1421
commit 95b282577f

View file

@ -5407,9 +5407,11 @@ export class TeamProvisioningService {
notification.on('click', () => { notification.on('click', () => {
cleanup(); cleanup();
if (win && !win.isDestroyed()) { // Use current mainWindowRef (not captured `win`) in case window was recreated
win.show(); const currentWin = this.mainWindowRef;
win.focus(); if (currentWin && !currentWin.isDestroyed()) {
currentWin.show();
currentWin.focus();
} }
}); });
@ -5582,6 +5584,7 @@ export class TeamProvisioningService {
if (result.autoAllow) { if (result.autoAllow) {
this.clearApprovalTimeout(requestId); this.clearApprovalTimeout(requestId);
this.autoAllowControlRequest(run, requestId); this.autoAllowControlRequest(run, requestId);
this.dismissApprovalNotification(requestId);
toRemove.push(requestId); toRemove.push(requestId);
this.emitToolApprovalEvent({ this.emitToolApprovalEvent({
autoResolved: true, autoResolved: true,