fix: make log button directly open camera for photo proof and remove unverified test marks
This commit is contained in:
+31
@@ -122,6 +122,12 @@
|
||||
const stored = localStorage.getItem(STORAGE_KEY_REPORTS);
|
||||
if (stored) {
|
||||
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-'));
|
||||
if (communityReports.length !== beforeCount) {
|
||||
localStorage.setItem(STORAGE_KEY_REPORTS, JSON.stringify(communityReports));
|
||||
}
|
||||
} else {
|
||||
communityReports = [];
|
||||
}
|
||||
@@ -130,6 +136,29 @@
|
||||
}
|
||||
}
|
||||
|
||||
function clearUnverifiedReports() {
|
||||
try {
|
||||
communityReports = communityReports.filter(r => r && r.photoUrl && !r.id.startsWith('usr-pin-'));
|
||||
localStorage.setItem(STORAGE_KEY_REPORTS, JSON.stringify(communityReports));
|
||||
Object.keys(cameraMetadata).forEach(id => {
|
||||
if (id.startsWith('usr-pin-') || !cameraMetadata[id].photoUrl) {
|
||||
delete cameraMetadata[id];
|
||||
}
|
||||
});
|
||||
localStorage.setItem(STORAGE_KEY_METADATA, JSON.stringify(cameraMetadata));
|
||||
window.dispatchEvent(new CustomEvent('flock_reports_updated', { detail: communityReports }));
|
||||
} catch (e) {
|
||||
console.warn('Could not clear unverified reports', e);
|
||||
}
|
||||
}
|
||||
|
||||
function removeReport(reportId) {
|
||||
communityReports = communityReports.filter(r => r.id !== reportId);
|
||||
if (cameraMetadata[reportId]) delete cameraMetadata[reportId];
|
||||
saveReports();
|
||||
saveMetadata();
|
||||
}
|
||||
|
||||
function saveReports() {
|
||||
try {
|
||||
localStorage.setItem(STORAGE_KEY_REPORTS, JSON.stringify(communityReports));
|
||||
@@ -339,6 +368,8 @@
|
||||
saveUser,
|
||||
getReports,
|
||||
addReport,
|
||||
removeReport,
|
||||
clearUnverifiedReports,
|
||||
getCameraMeta,
|
||||
confirmCamera,
|
||||
addPhotoProof,
|
||||
|
||||
Reference in New Issue
Block a user