fix: purge stale 1-tap mobile pins, make remove pin button bold and prominent, and bust service worker cache

This commit is contained in:
2026-09-12 09:18:33 -07:00
parent 872be94476
commit 2bd6ebe302
4 changed files with 69 additions and 25 deletions
+14 -2
View File
@@ -124,7 +124,13 @@
communityReports = JSON.parse(stored);
// Automatically prune any unverified test marks or pins without photo proof
const beforeCount = communityReports.length;
communityReports = communityReports.filter(r => r && r.photoUrl && !r.id.startsWith('usr-pin-'));
communityReports = communityReports.filter(r =>
r &&
r.photoUrl &&
!r.id.startsWith('usr-pin-') &&
r.notes !== '1-Tap Mobile Driver Pin' &&
r.type !== 'Fixed ALPR Camera'
);
if (communityReports.length !== beforeCount) {
localStorage.setItem(STORAGE_KEY_REPORTS, JSON.stringify(communityReports));
}
@@ -138,7 +144,13 @@
function clearUnverifiedReports() {
try {
communityReports = communityReports.filter(r => r && r.photoUrl && !r.id.startsWith('usr-pin-'));
communityReports = communityReports.filter(r =>
r &&
r.photoUrl &&
!r.id.startsWith('usr-pin-') &&
r.notes !== '1-Tap Mobile Driver Pin' &&
r.type !== 'Fixed ALPR Camera'
);
localStorage.setItem(STORAGE_KEY_REPORTS, JSON.stringify(communityReports));
Object.keys(cameraMetadata).forEach(id => {
if (id.startsWith('usr-pin-') || !cameraMetadata[id].photoUrl) {
+10 -5
View File
@@ -301,8 +301,12 @@
window.FlockAuth.clearUnverifiedReports();
}
// Filter out any unverified user pins
allCameras = [...DEFAULT_CAMERAS].filter(c => !c.id.startsWith('usr-pin-'));
// Filter out any unverified user pins or accidental test marks
allCameras = [...DEFAULT_CAMERAS].filter(c =>
!c.id.startsWith('usr-pin-') &&
c.notes !== '1-Tap Mobile Driver Pin' &&
c.name !== 'Community Report: Fixed ALPR Camera'
);
// Load crowdsourced reports from auth store (ONLY if photo verified!)
if (window.FlockAuth) {
@@ -418,9 +422,10 @@
Inspect Agency Records & Sharing ↗
</button>
` : ''}
${(cam.isCommunity || cam.id.startsWith('rpt-') || cam.id.startsWith('usr-pin-') || cam.id.startsWith('test-') || cam.id.startsWith('cam-test-')) ? `
<button class="popup-inspect-btn" style="background: rgba(239, 68, 68, 0.18); border: 1px solid #ef4444; color: #f87171;" onclick="window.adminDeleteCamera('${escapeHtml(cam.id)}')">
🗑️ Admin: Delete Placed Pin
${(!cam.id.startsWith('portal-') && (cam.isCommunity || cam.id.startsWith('rpt-') || cam.id.startsWith('usr-pin-') || cam.id.startsWith('test-') || cam.id.startsWith('cam-test-') || cam.notes === '1-Tap Mobile Driver Pin' || cam.agency === 'Crowdsourced Report' || cam.name.includes('Community Report'))) ? `
<button class="popup-inspect-btn popup-delete-btn" style="background: #dc2626 !important; color: #ffffff !important; font-weight: 800 !important; font-size: 0.88rem !important; padding: 10px 14px !important; border-radius: 6px !important; margin-top: 6px !important; display: flex !important; align-items: center !important; justify-content: center !important; gap: 8px !important; border: none !important; cursor: pointer !important; box-shadow: 0 3px 10px rgba(220, 38, 38, 0.45) !important;" onclick="window.adminDeleteCamera('${escapeHtml(cam.id)}')">
<span style="font-size: 1rem;">🗑️</span>
<span>REMOVE THIS PIN (ADMIN)</span>
</button>
` : ''}
</div>