@@ -218,16 +218,11 @@ public function writeDocumentState(int $documentId, string $content): void {
218218 */
219219 public function addStep (Document $ document , Session $ session , array $ steps , int $ version , ?int $ recoveryAttempt , ?string $ shareToken ): array {
220220 $ documentId = $ session ->getDocumentId ();
221- $ file = $ this ->getFileForSession ($ session , $ shareToken );
222- $ readOnly = $ this ->isReadOnly ($ file , $ shareToken );
223221 $ stepsToInsert = [];
224222 $ stepsIncludeQuery = false ;
225223 $ documentState = null ;
226224 foreach ($ steps as $ step ) {
227225 $ message = YjsMessage::fromBase64 ($ step );
228- if ($ readOnly && $ message ->isUpdate ()) {
229- continue ;
230- }
231226 // Only accept sync protocol
232227 if ($ message ->getYjsMessageType () !== YjsMessage::YJS_MESSAGE_SYNC ) {
233228 continue ;
@@ -240,10 +235,10 @@ public function addStep(Document $document, Session $session, array $steps, int
240235 }
241236 }
242237 if (count ($ stepsToInsert ) > 0 ) {
243- if ($ readOnly ) {
244- throw new NotPermittedException ('Read-only client tries to push steps with changes ' );
238+ $ file = $ this ->getFileForSession ($ session , $ shareToken );
239+ if (!$ this ->isReadOnly ($ file , $ shareToken )) {
240+ $ this ->insertSteps ($ document , $ session , $ stepsToInsert );
245241 }
246- $ this ->insertSteps ($ document , $ session , $ stepsToInsert );
247242 }
248243
249244 // By default, send all steps the user has not received yet.
0 commit comments