Browse Source

fix comment

Shun Miyazawa 1 year ago
parent
commit
2e64108bed

+ 1 - 1
apps/app/src/server/routes/apiv3/page/get-yjs-data.ts

@@ -23,7 +23,7 @@ export const getYjsDataHandlerFactory: GetYjsDataHandlerFactory = (crowi) => {
   const accessTokenParser = require('../../../middlewares/access-token-parser')(crowi);
   const loginRequiredStrictly = require('../../../middlewares/login-required')(crowi);
 
-  // define validators for req.body
+  // define validators for req.params
   const validator: ValidationChain[] = [
     param('pageId').isMongoId().withMessage('The param "pageId" must be specified'),
   ];

+ 2 - 1
apps/app/src/server/service/socket-io.js

@@ -175,11 +175,12 @@ class SocketIoService {
         const pageId = extractPageIdFromYdocId(update.name);
         const awarenessStateSize = update.awareness.states.size;
 
+        // Triggered when awareness changes
         this.io
           .in(getRoomNameWithId(RoomPrefix.PAGE, pageId))
           .emit(SocketEventName.YjsAwarenessStateUpdated, awarenessStateSize);
 
-        // Executed when the last user leaves the Editor
+        // Triggered when the last user leaves the editor
         if (awarenessStateSize === 0) {
           const currentYdoc = yjsConnectionManager.getCurrentYdoc(pageId);
           const yjsDraft = currentYdoc?.getText('codemirror').toString();