In the Admin panel, the sidebar shows a red badge next to Sponsorship indicating the number of pending profile approvals. After approving all pending sponsorship profiles (the "Pending Approval" tab shows "No Pending Profiles — All sponsorship profiles have been reviewed"), the badge count in the sidebar does not decrement or disappear. It still shows the stale count (e.g. 1) making it look like there are still profiles waiting for review when there aren't.
Expected behavior
After approving (or rejecting) a pending sponsorship profile, the Sponsorship badge count in the admin sidebar should immediately update to reflect the new pending count. When all pending profiles have been reviewed, the badge should disappear entirely (or show 0 and hide).
Steps to reproduce
Navigate to Admin > Sponsorship (badge shows a count, e.g. 1).
Go to the "Pending Approval" tab.
Approve the pending profile(s).
Observe the tab now says "No Pending Profiles".
Look at the sidebar — the Sponsorship badge still shows the old count.
Likely cause
The sidebar badge count is fetched on page load (or admin shell init) but is not re-fetched or decremented in response to the approve/reject action. The approval handler needs to either:
Emit an event / update a signal that the sidebar subscribes to, OR
Re-query the pending count after a successful approval and push the new value into the badge signal.
## Problem
In the Admin panel, the sidebar shows a red badge next to **Sponsorship** indicating the number of pending profile approvals. After approving all pending sponsorship profiles (the "Pending Approval" tab shows "No Pending Profiles — All sponsorship profiles have been reviewed"), the badge count in the sidebar does **not** decrement or disappear. It still shows the stale count (e.g. `1`) making it look like there are still profiles waiting for review when there aren't.
## Expected behavior
After approving (or rejecting) a pending sponsorship profile, the Sponsorship badge count in the admin sidebar should immediately update to reflect the new pending count. When all pending profiles have been reviewed, the badge should disappear entirely (or show `0` and hide).
## Steps to reproduce
1. Navigate to Admin > Sponsorship (badge shows a count, e.g. `1`).
2. Go to the "Pending Approval" tab.
3. Approve the pending profile(s).
4. Observe the tab now says "No Pending Profiles".
5. Look at the sidebar — the Sponsorship badge still shows the old count.
## Likely cause
The sidebar badge count is fetched on page load (or admin shell init) but is not re-fetched or decremented in response to the approve/reject action. The approval handler needs to either:
- Emit an event / update a signal that the sidebar subscribes to, OR
- Re-query the pending count after a successful approval and push the new value into the badge signal.
Root cause confirmed: no SignalR event was being pushed to the client after approving/revoking a sponsorship profile, so the badge count in the menu bar stayed stale.
Changes (3 files)
Backend — SponsorController.cs
Injected INotificationService into the controller
After ApproveSponsorProfile completes, sends a sponsor.pending_approval notification via SendToAllAsync to the system-notifications SignalR group
After RevokeSponsorApproval completes, does the same
In the ReceiveNotification handler, increments the signal when notification.type === "sponsor.pending_approval"
Frontend — menu-bar.component.ts
Added _sponsorApprovalEffect that watches pendingSponsorApprovalChanged() and calls sponsorService.refreshPendingSponsorCount() for staff/admin users
This follows the exact same pattern already established for book approval badge updates (pendingBookApprovalChanged → _bookApprovalEffect → bookService.refreshPendingApprovalCount()). All admin/staff users with the app open will get real-time badge updates when any admin approves or revokes a profile.
## Fix Implemented
Root cause confirmed: no SignalR event was being pushed to the client after approving/revoking a sponsorship profile, so the badge count in the menu bar stayed stale.
### Changes (3 files)
**Backend — `SponsorController.cs`**
- Injected `INotificationService` into the controller
- After `ApproveSponsorProfile` completes, sends a `sponsor.pending_approval` notification via `SendToAllAsync` to the `system-notifications` SignalR group
- After `RevokeSponsorApproval` completes, does the same
- Added `NotifySponsorPendingCountChangedAsync()` helper (mirrors `BookController.NotifyPendingApprovalCountChangedAsync`)
**Frontend — `system-notification.service.ts`**
- Added `pendingSponsorApprovalChanged` signal
- In the `ReceiveNotification` handler, increments the signal when `notification.type === "sponsor.pending_approval"`
**Frontend — `menu-bar.component.ts`**
- Added `_sponsorApprovalEffect` that watches `pendingSponsorApprovalChanged()` and calls `sponsorService.refreshPendingSponsorCount()` for staff/admin users
This follows the exact same pattern already established for book approval badge updates (`pendingBookApprovalChanged` → `_bookApprovalEffect` → `bookService.refreshPendingApprovalCount()`). All admin/staff users with the app open will get real-time badge updates when any admin approves or revokes a profile.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Problem
In the Admin panel, the sidebar shows a red badge next to Sponsorship indicating the number of pending profile approvals. After approving all pending sponsorship profiles (the "Pending Approval" tab shows "No Pending Profiles — All sponsorship profiles have been reviewed"), the badge count in the sidebar does not decrement or disappear. It still shows the stale count (e.g.
1) making it look like there are still profiles waiting for review when there aren't.Expected behavior
After approving (or rejecting) a pending sponsorship profile, the Sponsorship badge count in the admin sidebar should immediately update to reflect the new pending count. When all pending profiles have been reviewed, the badge should disappear entirely (or show
0and hide).Steps to reproduce
1).Likely cause
The sidebar badge count is fetched on page load (or admin shell init) but is not re-fetched or decremented in response to the approve/reject action. The approval handler needs to either:
Fix Implemented
Root cause confirmed: no SignalR event was being pushed to the client after approving/revoking a sponsorship profile, so the badge count in the menu bar stayed stale.
Changes (3 files)
Backend —
SponsorController.csINotificationServiceinto the controllerApproveSponsorProfilecompletes, sends asponsor.pending_approvalnotification viaSendToAllAsyncto thesystem-notificationsSignalR groupRevokeSponsorApprovalcompletes, does the sameNotifySponsorPendingCountChangedAsync()helper (mirrorsBookController.NotifyPendingApprovalCountChangedAsync)Frontend —
system-notification.service.tspendingSponsorApprovalChangedsignalReceiveNotificationhandler, increments the signal whennotification.type === "sponsor.pending_approval"Frontend —
menu-bar.component.ts_sponsorApprovalEffectthat watchespendingSponsorApprovalChanged()and callssponsorService.refreshPendingSponsorCount()for staff/admin usersThis follows the exact same pattern already established for book approval badge updates (
pendingBookApprovalChanged→_bookApprovalEffect→bookService.refreshPendingApprovalCount()). All admin/staff users with the app open will get real-time badge updates when any admin approves or revokes a profile.