Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
eatyourgreens committed Mar 23, 2020
1 parent 856969d commit fec5057
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/talk/discussion-preview.cjsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ module.exports = createReactClass
project: {}

discussionLink: ->
{discussion} = @props
baseURL = @props.project?._type._name
{discussion, project} = @props
baseURL = project?._type?._name

if (baseURL && @props.params?.owner and @props.params?.name) # get from url if possible
{owner, name} = @props.params
"/#{baseURL}/#{owner}/#{name}/talk/#{discussion.board_id}/#{discussion.id}"

else if (baseURL && @props.project.slug) # otherwise fetch from project
"/#{baseURL}/#{@props.project.slug}/talk/#{discussion.board_id}/#{discussion.id}"
else if (baseURL && project.slug) # otherwise fetch from project
"/#{baseURL}/#{project.slug}/talk/#{discussion.board_id}/#{discussion.id}"

else # link to zooniverse main talk
"/talk/#{discussion.board_id}/#{discussion.id}"
Expand Down
3 changes: 3 additions & 0 deletions app/talk/discussion-preview.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import { shallow } from 'enzyme';
import DiscussionPreview from './discussion-preview';

const validProject = {
_type: {
_name: 'projects'
},
id: 34,
slug: 'test/project'
};
Expand Down

0 comments on commit fec5057

Please sign in to comment.