From 856969da9cf8aa132b57ba3a4713b11cb657d915 Mon Sep 17 00:00:00 2001 From: Jim O'Donnell Date: Mon, 23 Mar 2020 13:23:29 +0000 Subject: [PATCH] Generalise comment links Add base URLs to comment links, based on the type of project resource. --- app/talk/comment-link.cjsx | 5 +++-- app/talk/comment.cjsx | 14 +++++++++----- app/talk/recents.cjsx | 3 ++- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/app/talk/comment-link.cjsx b/app/talk/comment-link.cjsx index 80f64571bb..d55c0b76ef 100644 --- a/app/talk/comment-link.cjsx +++ b/app/talk/comment-link.cjsx @@ -20,8 +20,9 @@ module.exports = createReactClass @props.comment.section isnt 'zooniverse' projectCommentUrl: -> - {comment} = @props - "/projects/#{comment.project_slug}/talk/#{comment.board_id}/#{comment.discussion_id}?comment=#{comment.id}" + baseURL = @props.project?._type._name + {comment, project} = @props + "/#{baseURL}/#{project.slug}/talk/#{comment.board_id}/#{comment.discussion_id}?comment=#{comment.id}" mainTalkCommentUrl: -> {comment} = @props diff --git a/app/talk/comment.cjsx b/app/talk/comment.cjsx index 25e8be4fb2..dd6acdf05c 100644 --- a/app/talk/comment.cjsx +++ b/app/talk/comment.cjsx @@ -107,8 +107,9 @@ module.exports = createReactClass commentSubjectTitle: (comment, subject) -> {owner, name} = @props.params + baseURL = @props.project?._type._name if (comment.focus_type is 'Subject') and (owner and name) - + Subject {subject.id} else @@ -130,7 +131,8 @@ module.exports = createReactClass replyLine: (comment) -> baseLink = "/" if @props.project? - baseLink += "projects/#{@props.project.slug}/" + baseURL = @props.project?._type._name + baseLink += "#{baseURL}/#{@props.project.slug}/"

{comment.user_display_name} @@ -168,7 +170,8 @@ module.exports = createReactClass isDeleted = if @props.data.is_deleted then 'deleted' else '' profile_link = "/users/#{@props.author?.login}" if @props.project? - profile_link = "/projects/#{@props.project.slug}#{profile_link}" + baseURL = @props.project._type._name + profile_link = "/#{baseURL}/#{@props.project.slug}#{profile_link}" author_login = if @props.author?.login then "@#{@props.author.login}" else ""

@@ -188,7 +191,8 @@ module.exports = createReactClass {if @props.data.reply_id profile_link = "/users/#{@props.data.reply_user_login}" if @props.project? - profile_link = "/projects/#{@props.project.slug}#{profile_link}" + baseURL = @props.project?._type._name + profile_link = "/#{baseURL}/#{@props.project.slug}#{profile_link}"
{if @state.replies.length
@@ -266,7 +270,7 @@ module.exports = createReactClass
{switch @state.showing - when 'link' then + when 'link' then when 'report' then }
diff --git a/app/talk/recents.cjsx b/app/talk/recents.cjsx index 0b89af2228..c4e2063bc6 100644 --- a/app/talk/recents.cjsx +++ b/app/talk/recents.cjsx @@ -114,8 +114,9 @@ module.exports = createReactClass commentTitle: (comment) -> {if @props.params.owner and @props.params.name + baseURL = @props.project?._type._name {owner, name} = @props.params - + {comment.discussion_title} on {comment.board_title} else