@@ -188,7 +189,7 @@ 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}"
+ profile_link = "/#{baseURL(@props.project)}/#{@props.project.slug}#{profile_link}"
{if @state.replies.length
@@ -266,7 +267,7 @@ module.exports = createReactClass
{switch @state.showing
- when 'link' then
+ when 'link' then
when 'report' then }
diff --git a/app/talk/discussion-preview.cjsx b/app/talk/discussion-preview.cjsx
index a7a8231563..a360fa651b 100644
--- a/app/talk/discussion-preview.cjsx
+++ b/app/talk/discussion-preview.cjsx
@@ -4,6 +4,7 @@ createReactClass = require 'create-react-class'
{Link} = require 'react-router'
resourceCount = require './lib/resource-count'
LatestCommentLink = require './latest-comment-link'
+baseURL = require('./lib/base-url').default
getSubjectLocation = require('../lib/getSubjectLocation').default
# `import Thumbnail from '../components/thumbnail';`
@@ -19,15 +20,14 @@ module.exports = createReactClass
project: {}
discussionLink: ->
- {discussion} = @props
+ {discussion, project} = @props
- if (@props.params?.owner and @props.params?.name) # get from url if possible
+ if (project && @props.params?.owner and @props.params?.name) # get from url if possible
{owner, name} = @props.params
- "/projects/#{owner}/#{name}/talk/#{discussion.board_id}/#{discussion.id}"
+ "/#{baseURL(project)}/#{owner}/#{name}/talk/#{discussion.board_id}/#{discussion.id}"
- else if @props.project.slug # otherwise fetch from project
- [owner, name] = @props.project.slug.split('/')
- "/projects/#{owner}/#{name}/talk/#{discussion.board_id}/#{discussion.id}"
+ else if (project && project.slug) # otherwise fetch from project
+ "/#{baseURL(project)}/#{project.slug}/talk/#{discussion.board_id}/#{discussion.id}"
else # link to zooniverse main talk
"/talk/#{discussion.board_id}/#{discussion.id}"
diff --git a/app/talk/discussion-preview.spec.js b/app/talk/discussion-preview.spec.js
index bab0b318ba..927bca0b87 100644
--- a/app/talk/discussion-preview.spec.js
+++ b/app/talk/discussion-preview.spec.js
@@ -5,6 +5,9 @@ import { shallow } from 'enzyme';
import DiscussionPreview from './discussion-preview';
const validProject = {
+ _type: {
+ _name: 'projects'
+ },
id: 34,
slug: 'test/project'
};
diff --git a/app/talk/init.cjsx b/app/talk/init.cjsx
index bab452857c..711cbb9d17 100644
--- a/app/talk/init.cjsx
+++ b/app/talk/init.cjsx
@@ -14,6 +14,7 @@ Loading = require('../components/loading-indicator').default
SingleSubmitButton = require '../components/single-submit-button'
ZooniverseTeam = require './lib/zoo-team.cjsx'
alert = require('../lib/alert').default
+baseURL = require('./lib/base-url').default
AddZooTeamForm = require './add-zoo-team-form'
DragReorderable = require 'drag-reorderable'
Paginator = require './lib/paginator'
@@ -164,7 +165,7 @@ module.exports = createReactClass
{if @props.section isnt 'zooniverse'
-
+
View Reported Comments
else
@@ -200,7 +201,7 @@ module.exports = createReactClass
{if @props.section is 'zooniverse'
Recent Comments
else
-
Recent Comments
+
Recent Comments
}
diff --git a/app/talk/latest-comment-link.cjsx b/app/talk/latest-comment-link.cjsx
index fa155ddb4b..bd4c281612 100644
--- a/app/talk/latest-comment-link.cjsx
+++ b/app/talk/latest-comment-link.cjsx
@@ -3,6 +3,7 @@ PropTypes = require 'prop-types'
createReactClass = require 'create-react-class'
talkClient = require 'panoptes-client/lib/talk-client'
{timeAgo} = require './lib/time'
+baseURL = require('./lib/base-url').default
DisplayRoles = require './lib/display-roles'
Avatar = require '../partials/avatar'
{Link} = require 'react-router'
@@ -54,9 +55,9 @@ module.exports = createReactClass
locationObject =
pathname: "/talk/#{@props.discussion.board_id}/#{@props.discussion.id}"
query: query
- if @props.params?.owner and @props.params?.name
+ if @props.project and @props.params?.owner and @props.params?.name
{owner, name} = @props.params
- locationObject.pathname = "/projects/#{owner}/#{name}" + locationObject.pathname
+ locationObject.pathname = "/#{baseURL(@props.project)}/#{owner}/#{name}" + locationObject.pathname
{childtext}
@@ -74,7 +75,7 @@ module.exports = createReactClass
baseLink = "/"
if @props.project? and @props.project.slug?
- baseLink += "projects/#{@props.project.slug}/"
+ baseLink += "#{baseURL(@props.project)}/#{@props.project.slug}/"
diff --git a/app/talk/lib/base-url.js b/app/talk/lib/base-url.js
new file mode 100644
index 0000000000..085d2f4ffe
--- /dev/null
+++ b/app/talk/lib/base-url.js
@@ -0,0 +1 @@
+export default resource => resource && resource._type._name
\ No newline at end of file
diff --git a/app/talk/lib/project-section.coffee b/app/talk/lib/project-section.coffee
index 1fa254a298..37bef71b0f 100644
--- a/app/talk/lib/project-section.coffee
+++ b/app/talk/lib/project-section.coffee
@@ -1,3 +1,7 @@
# takes in a project id and returns a correctly formatted talk section for that project
-module.exports = (project) -> "project-#{project.id}"
+module.exports = (project) ->
+ type = project._type._name
+ switch type
+ when 'organizations' then "org-#{project.id}"
+ when 'projects' then "project-#{project.id}"
diff --git a/app/talk/popular-tags.jsx b/app/talk/popular-tags.jsx
index 1ee21f5ff4..118937c367 100644
--- a/app/talk/popular-tags.jsx
+++ b/app/talk/popular-tags.jsx
@@ -6,9 +6,10 @@ import { Link } from 'react-router';
const ProjectTag = (props) => {
const tag = props.tag.name;
+ const baseURL = props.project._type._name;
return (
-
+
{tag}
{' '}
diff --git a/app/talk/recents.cjsx b/app/talk/recents.cjsx
index 5bd79ea844..e42270adc0 100644
--- a/app/talk/recents.cjsx
+++ b/app/talk/recents.cjsx
@@ -6,8 +6,10 @@ Comment = require './comment'
apiClient = require 'panoptes-client/lib/api-client'
talkClient = require 'panoptes-client/lib/talk-client'
Paginator = require './lib/paginator'
+projectSection = require './lib/project-section'
updateQueryParams = require './lib/update-query-params'
Loading = require('../components/loading-indicator').default
+baseURL = require('./lib/base-url').default
talkConfig = require './config'
module.exports = createReactClass
@@ -52,7 +54,7 @@ module.exports = createReactClass
if @props.params.board
params.board_id = @props.params.board if @props.params.board
else if @props.project
- params.section = "project-#{ @props.project.id }"
+ params.section = projectSection(@props.project)
else
params.section = 'zooniverse'
params
@@ -114,7 +116,7 @@ module.exports = createReactClass
{if @props.params.owner and @props.params.name
{owner, name} = @props.params
-
+
{comment.discussion_title} on {comment.board_title}
else