appirio-tech / connect-app

Build your next project on Connect with the power of crowdsourcing
https://connect.topcoder.com
44 stars 140 forks source link

[$150] Jump to post #2306

Closed gondzo closed 6 years ago

gondzo commented 6 years ago

We need a way to jump to specific topic or post based only on topic or post ID. This would require fetching the data backwards - fetch post and the topic from the api, figure out the reference codes and load the correct project and correct tab (plan or dashboard) with the referenced post displayed correctly (phase posts expanded and loaded to correct date/time). IMO this would best be achieved with a new route like connect.topcoder.com/posts/postId and connect.topcoder.com/topics/topicId. Loading these routes would redirect the user to the correct route (project dashboard, plan, etc). @vikasrohit any other ideas?

Aha! Link: https://topcoder.aha.io/features/TCCONNECT-428

vikasrohit commented 6 years ago

@gondzo we have this functionality built in, please refer this. I think what we need is to update the logic to handle the phase topics and add an anchor tag to the new Post card.

gondzo commented 6 years ago

Yup, we need to update RedirectToProject with new routes for phase topics (we don't have deep links for phases - it should switch to plan tab, expand the phase and load posts tab) and some logic to load the exact post in the topic if we want to link to exact postId

vikasrohit commented 6 years ago

Agreed. Marking this issue for next release as we can not get it done for this release.

narekcat commented 6 years ago

@gondzo I can't access Aha! Link. Can you give me access or send invitation email ?

narekcat commented 6 years ago

I have worked on this issue today, but it's late and I need to have a rest. I'll finish this issue tomorrow.

vikasrohit commented 6 years ago

@narekcat there is no need to access the aha because that does not have any additional details.

narekcat commented 6 years ago

@gondzo @vikasrohit I can get project's topic by it's id, but I can't get project's post or topic by post id and in messages api there aren't any endpoint for getting project's topic or post by post id. Are there any endpoint for getting that data by post id ? I examine discussions and found out that if we go /projects/:projectId/discussions/:discussionId, it doesn't shows discussion, it says "Invalid date". I think there are some bug or feature is incomplete.

narekcat commented 6 years ago

@gondzo @vikasrohit Can project's phase has more then one topics ? If it can't that I can redirect to /projects/:projectId/plan/phases/:phaseId/topics when user goes to /projects/:projectId/topics/:topics and /projects/:projectId/plan/phases/:phaseId/posts/postId when user goes to /projects/:projectId/posts/:postId

gondzo commented 6 years ago

Phase will always have just one topic. When user goes to /discussions/topicId this should be the logic to get the relevant topic call messages_api/topics/topicId and check the tag field in the response:

Same thing should be done for navigating to /discussions/posts/postId except that first we need to get the topic id by calling messages_api/posts/postId

narekcat commented 6 years ago

@gondzo Ok, thank you very much.

narekcat commented 6 years ago

@gondzo @vikasrohit Can you give me exact endpoint for getting post by it's id ? Like in case of topic is "/topics/${topicId}/read/db". I tried "/posts/${postId}", but it returns status code 404.

vikasrohit commented 6 years ago

It should be /v5/topics/{topicId}/posts/{postId}/read/db.

narekcat commented 6 years ago

@vikasrohit Ok, but then it can't jump to post having only postId, in case of connect.topcoder.com/posts/postId.

vikasrohit commented 6 years ago

I don't think we need to handle connect.topcoder.com/posts/postId. For every notification (which is the originator for the user to navigate to the specific topic or post) we should have both topicId and postId so we should be able to navigate to a particular post by constructing url with both params and I think we are already doing something similar to load the specific topic or post on dashboard via /projects/7210#feed-27775 for loading topic and /projects/7210#comment-80286 for loading particular post. So, in summary, you should expect both topicId and postId in URL and postId can be present in # of the URL to navigate to the specific post.

narekcat commented 6 years ago

@vikasrohit For this issue we need new functionality to jump to topic from /topics/topicId or jump to post from /topics/topicId/posts/postId. Am I right ? If you copy past /projects/7210#feed-27775 or /projects/7210#comment-80286 in browser address line, you will not see topic or feed. It working only when all content is loaded and you clicking on post date. And gonzo said https://github.com/appirio-tech/connect-app/issues/2306#issuecomment-410986418.

narekcat commented 6 years ago

@gondzo @vikasrohit I have fixed this issue. If user goes to /topics/:topicId then it will redirect to /projects/:projectId/plan/phases/:phaseId/topics, opens Project Plan tab, opens project phase in the middle of screen, opens topics tab and loads posts. Same will happen when user goes to /topics/:topicId/posts/:postId, but it loads all posts and shows post with postId in the middle of screen. If there are some misunderstandings let me know.

vikasrohit commented 6 years ago

If you copy past /projects/7210#feed-27775 or /projects/7210#comment-80286 in browser address line, you will not see topic or feed

It only works for the dashboard topics/posts. I have tested this recently and it is working as expected. purpose of this issue is to apply the same logic for phase topics now.

If there are some misunderstandings let me know.

Seems like you are now on correct track. One thing that I want to improve is the original URL which we are using load the specific phase topics/post because /projects/:projectId/plan/phases/:phaseId/topics and /projects/:projectId/plan/phases/:phaseId/topics/:topicId/posts/:postId requires new routes to be created and we have seen some issues in past because of new specific routes for phases, e.g. it makes the UI very jumpy when user clicks on a particular phase card. So, to avoid that I was thinking of using only # based approach as we are using for loading non phase topics and posts. May be something like projects/:projectId/plan#feed-<feedId> and projects/:projectId/plan#comment-<feedId>-<commentId> for loading specific topic and post for a phase. Once we have feedId, we can fetch the topic, and every topic is associated with a phase via tag field being phase#<phaseId>. So, now we have the phase id as well to open the the phase card.

narekcat commented 6 years ago

@vikasrohit Ok, I understand. Thank you.

narekcat commented 6 years ago

@vikasrohit @gondzo I have finished issue. You can use projects/:projectId/plan#feed-<feedId> and projects/:projectId/plan#comment-<commentId>, without feedId, for loading specific topic and post for a phase.

gondzo commented 6 years ago

@vikasrohit once minor issues are fixed, we'll have the two above routes for accessing the messages via direct link. What is left is updating /discussions route to redirect properly. Can we do that in the next release?

vikasrohit commented 6 years ago

What is left is updating /discussions route to redirect properly. Can we do that in the next release?

Yes, no problem. Please create a separate issue to track that. Do you remember from where we are generating the /discussions link now?

gondzo commented 6 years ago

I don't think we're using /discussions link anywhere, it was in discourse emails only afaik. It will be useful to link to posts in email templates though

vikasrohit commented 6 years ago

Ohk. I think we are already using the same # based deep links to the messages in email templates.

narekcat commented 6 years ago

@gondzo @vikasrohit Are there any work to do with this issue ?

gondzo commented 6 years ago

@narekcat no, it's all done, we'll handle the remaining task in #2464

narekcat commented 6 years ago

@gondzo Ok, thank you.

narekcat commented 6 years ago

@gondzo @vikasrohit Sorry, but you forget to accepts this issue, and I don't see any payment for this issue in my profile.

gondzo commented 6 years ago

Payment has been processed - it takes a few hours for it to show up in your account

narekcat commented 6 years ago

@gondzo Ok, sorry, thank you very much.