App in invalid state when current survey is deleted on remote
When we detect the deletion event, we shoud:
- Deactive the current survey
- Show the user a message
- Redirect to the survey list
@rawbzz PTAL?
so this is when a user is already in the survey collecting data, but the survey got deleted right? in that case, I think they should get a message that pops up, and it redirects them to the survey list
LGTM! @amegantz @rawbzz Let's just update the text to make it clear it wasn't the user who accidentally deleted the survey, but rather the survey organizers. Thanks!
Survey deleted
This survey has been deleted by the survey organizers. Select another survey.
[Go to surveys]
@amegantz LGTM!
@amegantz @rawbzz @gino-m If the user has collected the data and then the survey got deleted, then how are we telling user that all these collected data are going to be deleted now?
The current model is "send it and forget it" in the sense that users cannot access the data once they've shared it with organizers, so in general they have no visibility into the current remote state of data. The product WG may decide to change this is in the future, but as it stands now they wouldn't get notified.
After deleting the remote survey, the following sequence of events happen on the app:
- App receives a broadcast to sync survey from remote
- App initiates a request to sync survey
- The request attempts to fetch the survey for the given id from remote datastore.
- An exception is thrown:
com.google.firebase.firestore.FirebaseFirestoreException: PERMISSION_DENIED: Missing or insufficient permissions.
Maybe we first need to update the firebase function to return appropriate error code (NOT_FOUND). Another option is to send some metadata with the broadcast message specifying that the survey has been deleted instead of attempting to re-sync.
Maybe we first need to update the firebase function to return appropriate error code (NOT_FOUND). Another option is to send some metadata with the broadcast message specifying that the survey has been deleted instead of attempting to re-sync.
Perhaps it's the Firebase rule that need to be updated so that we receive NOT_FOUND when the document doesn't exist. What value does the rule receive for resource when the document is not found?
I've been low on bandwidth for the past few weeks. Will try to spend some time on it early next week.
@shobhitagarwal1612 Let's postpone for now and demote to P2.