Register
Submit a solution
The challenge is finished.

Challenge Overview

Topcoder Connect is our primary customer facing platform. Messaging is an important part of the application, and it supports two modes of messaging: Status updates and Discussions. 
We have identified a bug where users added to the project don't have access to topics/posts created earlier. Users removed from the project aren't revoked access to the topics and can post responses via email.
When a new topic is created, frontend app (connect-app) will make a post to our messaging service (tc-message-service) that uses Discourse internally for processing messages. Discourse in turn requires a list of users that are allowed to a topic, so tc-message-service fetches the list of project users from topcoder api and sets the allowedUsers list in Discourse.
The goal here is to update the allowedUsers list when project members are added/removed. To do that, we should add an update users service endpoint in tc-message-service that would have projectId as parameter. The service would do the following:
  • first fetch the project members list from tc api (same as when creating a topic),
  • fetch the list of topics from Discourse,
  • for each of the topics fetch the allowedUsers list from Discourse, compare it to users list from tc api and add or remove users to the topic as necessary.
Sadly, Discourse does not have an api to simply add a user to the allowedUsers list, but there is another 'Invite' API that would effectively add the user to the list. See the attached postman collection for API details. Removing the user from topic isn't quite as straightforward and you should research possible approaches to see what is working.
Note that all calls to the Discourse API's that you add in this challenge should support retrying the call if it fails (see create topic methods for example).
Connect app should be updated with calls to the new endpoint in tc-message-service whenever there is a change in project users. See src/api/projectMembers.js for calls that make changes to project users.

All frontend changes should be made in the connect-app repository, dev branch.

All backend changes should be made in the tc-message-service repository, dev branch.

When testing locally, start the message service with
TC_MESSAGE_SERVICE_AUTH_LOOSE=true npm run start:dev

and start connect app with
CONNECT_MESSAGE_API_URL=http://localhost:8001 npm start
 

Final Submission Guidelines

Submit a git patch containing your changes to the base code.
Submit a verification document with screenshots.

ELIGIBLE EVENTS:

2018 Topcoder(R) Open

Review style

Final Review

Community Review Board

Approval

User Sign-Off

ID: 30058812