Failed to write to document errors in readonly sessions
Describe the bug When opening Text documents in read-only mode (e.g. shared documents), Text regularly tries to send push messages to the backend that get declined:
POST https://nextcloud.local/index.php/apps/text/public/session/17142/push [HTTP/2 403 66ms]
[ERROR] text: failed to write to document - not allowed
[ERROR] text: Unexpected Error "Failed to apply steps. Retry!"
To Reproduce Steps to reproduce the behavior:
- Open Text document in read-only view (e.g. by sharing the document read-only)
- Open the developer console
- Maybe you have to click around in the document, not sure about that.
- See error
Screenshots
Server details:
- Nextcloud version: development branch (29.0.0 dev)
Not sure what is best but I think we have a few options:
- Do not send out awareness messages on the client side
- Accept read only users awareness messages on the push endpoint (even with read only)
- Either ignore any pushed messages
- Or filter out and only allow pushing awareness messages
I don't think we should send awareness messages on a connection that got initiated as read-only (e.g. due to missing write privileges).
My understanding is that we currently don't differentiate between "on purpose read-only" (e.g. when connecting to a document session without write privileges) and "temporary read-only" (e.g due to connectivity issues). In the former case I think we should stop the client from sending any awareness messages. In the latter case we should keep the current logic of throwing an error and retrying later.