Skip to content

Commit

Permalink
fix: project.slug is undefined in Talk comments (#7068)
Browse files Browse the repository at this point in the history
Fix an error where `project.slug` is undefined in Talk search results,
leading to raw markdown strings being passed to the HTML parser in
the `Markdown` component.
  • Loading branch information
eatyourgreens authored Mar 26, 2024
1 parent dd307b3 commit 42cd979
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/talk/search-result.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ export default class TalkSearchResult extends React.Component {
const comment = this.props.data;
const discussion = this.discussionFromComment(comment);
const [owner, name] = comment.project_slug ? comment.project_slug.split('/') : [];
const commentProject = {
slug: comment?.project_slug || ''
}

return (
<div className="talk-search-result talk-module">
Expand All @@ -67,7 +70,7 @@ export default class TalkSearchResult extends React.Component {
)}
<CommentContextIcon comment={comment} />
<CommentLink comment={comment} project={this.props.project}>{comment.discussion_title}</CommentLink>
<Markdown content={comment.body} project={this.props.project} />
<Markdown content={comment.body} project={commentProject}/>
<DiscussionPreview {...this.props} discussion={discussion} owner={owner} name={name} comment={comment} />
</div>
);
Expand Down

0 comments on commit 42cd979

Please sign in to comment.