Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add change manager #49

Closed
wants to merge 1 commit into from
Closed

Conversation

maurerle
Copy link
Contributor

This enables the Manager to track changes throughout projects.
It is a very helpful feature which is generally not enabled in the ce version.

This enables the Manager to track changes throughout projects.
It is a very helpful feature which is generally not enabled in the ce version.
@smhaller
Copy link
Owner

smhaller commented Mar 1, 2024

Hi,
thx for this. Track Changes seem to work but your PR also enables "Add Comment" and for me trying to add a comment fails. Could you check?

Thx
Simon

PS: It would be great to get this to work :D

@maurerle
Copy link
Contributor Author

maurerle commented Mar 1, 2024

True, it failes with "Sorry, there was a problem submitting your comment".

the https://$URL/event/rp-new-comment worked fine, but https://$URL/project/$projectid/thread/$threadid/messages was not found (404).

This is because settings.apis.chat.internal_url is not set to the correct https://$URL.
It is set to process.env.CHAT_HOST in settings.default.ts so we just need to add it to the env to point to our url.
But somehow this was not enough.

I also saw that /changes/users is requested but also receives a 404 so I don't think this works without setting up the backend endpoints too.
So I think there is a little more to do to have this persistent across more than one session :(

@smhaller
Copy link
Owner

smhaller commented Mar 6, 2024

I had a quick look:

I think one should not enable this at the moment. It does not even work in one session (or better if you enable just the TrackChanges I had following behaviour:

  • Enable TrackChanges
  • Do some work
  • Accepted Changes

now if one reloads the Project you get again the field/box where you can Accept or Reject the changes.
Only if you Reject you can get rid again of the field/box.

In general I think following has to be done if one wants to enable the Track Changes and Comments Feature:

First one has to add all route in route.js

For example:

webRouter.get(
   '/project/:project_id/threads',
   AuthorizationMiddleware.blockRestrictedUserFromProject,
   AuthorizationMiddleware.ensureUserCanReadProject,
   ChatController.getThreads
)
webRouter.post(
   '/project/:project_id/thread/:thread_id/messages',
   AuthorizationMiddleware.blockRestrictedUserFromProject,
   AuthorizationMiddleware.ensureUserCanReadProject,
   ChatController.sendComment
)
webRouter.post(
   '/project/:project_id/thread/:thread_id/resolve',
   AuthorizationMiddleware.blockRestrictedUserFromProject,
   AuthorizationMiddleware.ensureUserCanReadProject,
   ChatController.resolveThread
)

Missing routes I have seen so far:
/project/:project_id/changes/accept
/project/:project_id/threads
/project/:project_id/thread/:thread_id/messages
/project/:project_id/thread/:thread_id/resolve
/project/:project_id/doc/:thread_id/changes/accept
/project/:project_id/ranges
/project/:project_id/track_changes
/event/rp-comment-resolve

Second one has to adapt at least the ChatController.js

and add the missing code between the ChatController and the ChatApiHandler.js
Be aware the following Code is not working yet (the reason why I post it in a comment and not push it in some branch in the repo):

 sendComment(req, res, next) {
     const { project_id: projectId } = req.params
     const { thread_id: threadId } = req.params
     const { content, client_id: clientId } = req.body
     const userId = SessionManager.getLoggedInUserId(req.session)
     if (userId == null) {
       const err = new Error('no logged-in user')
       return next(err)
     }
     return ChatApiHandler.sendComment(
       projectId,
       threadId,
       userId,
       content,
       function (err, message) {
         if (err != null) {
           return next(err)
         }
         return UserInfoManager.getPersonalInfo(
           message.user_id,
           function (err, user) {
             if (err != null) {
               return next(err)
             }
             message.user = UserInfoController.formatPersonalInfo(user)
             message.clientId = clientId
             EditorRealTimeController.emitToRoom(
               projectId,
               'rp-new-comment',
               message
             )
             return res.sendStatus(204)
           }
        )
      }
   )
},

and maybe some more

Conclusion

It would be really cool if someone could have a look into this - but I also think this is a bit of work (but I think it is possible because the API/backend code seems to be there

@smhaller smhaller added enhancement New feature or request help wanted Extra attention is needed labels Mar 6, 2024
@maurerle maurerle marked this pull request as draft June 8, 2024 11:40
@smhaller
Copy link
Owner

see issue #53

@smhaller smhaller closed this Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants