Skip to content

fix(sync): restore congregation field service reports for elders and overseers - #5382

Open
ux-git wants to merge 1 commit into
sws2apps:mainfrom
ux-git:fix/sync-field-service-reports-restore
Open

fix(sync): restore congregation field service reports for elders and overseers#5382
ux-git wants to merge 1 commit into
sws2apps:mainfrom
ux-git:fix/sync-field-service-reports-restore

Conversation

@ux-git

@ux-git ux-git commented Aug 31, 2026

Copy link
Copy Markdown
Member

Description

Elders, group overseers and language group overseers never receive congregation field service reports through sync, and can silently overwrite the reports of other users.

dbExportDataBackup lets those roles upload cong_field_service_reports, and the API sends the table to them (reportEditorRole). But dbRestoreCongReports gated the restore on adminRole || publisherRole, where publisher is a pocket-only role that VIP accounts usually do not carry. So those users:

  • received the reports and dropped them without any error,
  • still advanced the cong_field_service_reports metadata version, so the data was never requested again,
  • pushed their own stale table back, and since the API replaces the stored file as a whole, reports another user had just synced were removed.

This is the mismatch behind #5055: the second user keeps syncing and never sees the reports.

The restore gate lost its group overseer branch in f200e6b when the dedicated group_overseers role was introduced, and was never given the new role.

What this changes:

  • resolve the report editor roles in one helper and use it for the restore gate, the export gate and the metadata sent to the API, so the three can no longer drift apart
  • send the cong_field_service_reports version for those roles again, which also re-arms the API check that rejects outdated backups
  • clear that version once on database upgrade, so clients that dropped reports pull them on the next sync instead of trusting a version they never applied

Fixes #5055

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings

…overseers

The backup worker granted elders, group overseers and language group
overseers the right to upload cong_field_service_reports, but the restore
gate only accepted admins, secretaries, coordinators and holders of the
pocket-only `publisher` role. Those users received the reports from the API
and silently dropped them, while the metadata version still advanced, so the
data was never requested again — and their stale local table was then pushed
back, overwriting reports other users had just synced.

Resolve the report editor roles once and use that helper for the restore
gate, the export gate and the metadata sent to the API. Sending the
cong_field_service_reports version again also re-arms the API check that
rejects outdated backups for these roles.

Clear that version once on upgrade so clients that dropped reports pull them
on the next sync instead of trusting a version they never applied.
@vercel

vercel Bot commented Aug 31, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
staging-organized-app Ready Ready Preview Aug 31, 2026 10:05pm
test-organized-app Ready Ready Preview Aug 31, 2026 10:05pm

@ux-git

ux-git commented Aug 31, 2026

Copy link
Copy Markdown
Member Author

@rhahao can you please take a deeper look and verify if the fix is valid?

@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FIX] Sync

1 participant