Skip to content

Commit

Permalink
Render markdown on custom post types (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
larkox authored Jul 1, 2020
1 parent 9f95dfa commit bcb8a56
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions webapp/src/components/post_type_todo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';

import {remove, complete, accept} from '../../actions';
import {getSiteURL} from '../../selectors';

import PostTypeTodo from './post_type_todo';

function mapStateToProps(state, ownProps) {
return {
...ownProps,
siteURL: getSiteURL(),
pendingAnswer: state['plugins-com.mattermost.plugin-todo'].inIssues.some((issue) => issue.id === ownProps.post.props.issueId),
};
}
Expand Down
11 changes: 9 additions & 2 deletions webapp/src/components/post_type_todo/post_type_todo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ import RemoveButton from '../buttons/remove';
import CompleteButton from '../buttons/complete';
import AcceptButton from '../buttons/accept';

const PostUtils = window.PostUtils; // import the post utilities

export default class PostTypeTodo extends React.PureComponent {
static propTypes = {
post: PropTypes.object.isRequired,
pendingAnswer: PropTypes.bool.isRequired,
theme: PropTypes.object.isRequired,
siteURL: PropTypes.string.isRequired,
actions: PropTypes.shape({
complete: PropTypes.func.isRequired,
remove: PropTypes.func.isRequired,
Expand All @@ -31,8 +34,12 @@ export default class PostTypeTodo extends React.PureComponent {
const style = getStyle(this.props.theme);

const preText = 'Automated message';
const title = this.props.post.props.message;
const subtitle = this.props.post.props.todo;

const titleHTMLFormattedText = PostUtils.formatText(this.props.post.props.message, {siteURL: this.props.siteURL});
const title = PostUtils.messageHtmlToComponent(titleHTMLFormattedText);

const subtitleHTMLFormattedText = PostUtils.formatText(this.props.post.props.todo, {siteURL: this.props.siteURL});
const subtitle = PostUtils.messageHtmlToComponent(subtitleHTMLFormattedText);

const content = (
<div
Expand Down

0 comments on commit bcb8a56

Please sign in to comment.