Remove or Replace an Attachment on a Submitted Activity
Mistakes happen during upload — the wrong screenshot is selected, a blurry photo is submitted, or a file is attached to the wrong activity. Peer mentors must be able to remove attachments from their own submitted activities within a reasonable editing window (e.g., before the activity is locked by coordinator review). Deletion should trigger a confirmation dialog to prevent accidental removal, remove the file from Supabase Storage, and update the activity attachment repository. After deletion the thumbnail grid should update immediately. Replacing a file is accomplished by deleting the incorrect attachment and then adding a new one via the same attachment picker flow.
User Story
Acceptance Criteria
- Given I am viewing the thumbnail grid for an activity I submitted, when I long-press a thumbnail, then a context menu appears with a 'Remove Attachment' option
- Given I select 'Remove Attachment', when the confirmation dialog appears, then I can confirm or cancel without accidental deletion
- Given I confirm deletion, when the operation completes, then the thumbnail is removed from the grid and the file is deleted from Supabase Storage
- Given I confirm deletion, when the operation fails due to a network error, then an accessible error message is shown and the thumbnail remains in the grid
- Given the activity has been locked for coordinator review, when I attempt to delete an attachment, then a plain-language message explains editing is no longer available
- Given I delete all attachments from an activity, when the last thumbnail is removed, then the attachment section disappears from the activity detail screen
Business Value
Allowing peer mentors to self-correct uploaded attachments reduces the volume of support requests escalated to coordinators and avoids delays in activity approval. Clean, accurate attachments improve the overall quality of Bufdir reporting data, reducing the risk of audit findings related to incomplete or incorrect documentation.
Components
- Attachment Thumbnail Grid ui
- Attachment Upload Service service
- Activity Attachment Repository data
- Supabase Storage Adapter infrastructure
- Plain Language Error Display ui
- Confirm Before Submit Screen ui