From 882172b298a1e11768772b95031968d75a19af94 Mon Sep 17 00:00:00 2001 From: Saturnino Abril Date: Tue, 9 May 2017 21:53:59 +0900 Subject: [UI-AUTO] add IDs to last 10 posts' text (#6257) --- webapp/components/post_view/components/post.jsx | 8 ++++++-- webapp/components/post_view/components/post_body.jsx | 8 ++++++-- webapp/components/post_view/components/post_list.jsx | 2 +- .../post_view/components/post_message_container.jsx | 4 ++-- .../components/post_view/components/post_message_view.jsx | 13 +++++++++++-- 5 files changed, 26 insertions(+), 9 deletions(-) (limited to 'webapp/components/post_view') diff --git a/webapp/components/post_view/components/post.jsx b/webapp/components/post_view/components/post.jsx index 8ca84aa20..1959d5cad 100644 --- a/webapp/components/post_view/components/post.jsx +++ b/webapp/components/post_view/components/post.jsx @@ -22,7 +22,7 @@ export default class Post extends Component { sameUser: PropTypes.bool, sameRoot: PropTypes.bool, hideProfilePic: PropTypes.bool, - isLastPost: PropTypes.bool, + lastPostCount: PropTypes.number, isLastComment: PropTypes.bool, shouldHighlight: PropTypes.bool, displayNameType: PropTypes.string, @@ -137,6 +137,10 @@ export default class Post extends Component { return true; } + if (nextProps.lastPostCount !== this.props.lastPostCount) { + return true; + } + return false; } @@ -306,7 +310,7 @@ export default class Post extends Component { post={post} currentUser={this.props.currentUser} sameRoot={this.props.sameRoot} - isLastPost={this.props.isLastPost} + lastPostCount={this.props.lastPostCount} parentPost={parentPost} handleCommentClick={this.handleCommentClick} compactDisplay={this.props.compactDisplay} diff --git a/webapp/components/post_view/components/post_body.jsx b/webapp/components/post_view/components/post_body.jsx index 108605eea..2ad9f96d1 100644 --- a/webapp/components/post_view/components/post_body.jsx +++ b/webapp/components/post_view/components/post_body.jsx @@ -51,6 +51,10 @@ export default class PostBody extends React.Component { return true; } + if (nextProps.lastPostCount !== this.props.lastPostCount) { + return true; + } + return false; } @@ -164,7 +168,7 @@ export default class PostBody extends React.Component { > {loading} @@ -208,7 +212,7 @@ PostBody.propTypes = { currentUser: React.PropTypes.object.isRequired, parentPost: React.PropTypes.object, retryPost: React.PropTypes.func, - isLastPost: React.PropTypes.bool, + lastPostCount: React.PropTypes.number, handleCommentClick: React.PropTypes.func.isRequired, compactDisplay: React.PropTypes.bool, previewCollapsed: React.PropTypes.string, diff --git a/webapp/components/post_view/components/post_list.jsx b/webapp/components/post_view/components/post_list.jsx index 483ff78c8..f233884ac 100644 --- a/webapp/components/post_view/components/post_list.jsx +++ b/webapp/components/post_view/components/post_list.jsx @@ -339,7 +339,7 @@ export default class PostList extends React.Component { = 0 && i < Constants.TEST_ID_COUNT) ? i : -1} sameUser={sameUser} sameRoot={sameRoot} post={post} diff --git a/webapp/components/post_view/components/post_message_container.jsx b/webapp/components/post_view/components/post_message_container.jsx index 5d324ba46..4cb3cb76c 100644 --- a/webapp/components/post_view/components/post_message_container.jsx +++ b/webapp/components/post_view/components/post_message_container.jsx @@ -16,7 +16,7 @@ export default class PostMessageContainer extends React.Component { static propTypes = { post: React.PropTypes.object.isRequired, options: React.PropTypes.object, - isLastPost: React.PropTypes.bool + lastPostCount: React.PropTypes.number }; static defaultProps = { @@ -91,7 +91,7 @@ export default class PostMessageContainer extends React.Component { {renderedSystemMessage}; } + let postId = null; + if (this.props.lastPostCount >= 0) { + postId = Utils.createSafeId('lastPostMessageText' + this.props.lastPostCount); + } + return (