summaryrefslogtreecommitdiffstats
path: root/webapp/components/rhs_thread.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/components/rhs_thread.jsx')
-rw-r--r--webapp/components/rhs_thread.jsx15
1 files changed, 8 insertions, 7 deletions
diff --git a/webapp/components/rhs_thread.jsx b/webapp/components/rhs_thread.jsx
index 174799878..82e54f6ff 100644
--- a/webapp/components/rhs_thread.jsx
+++ b/webapp/components/rhs_thread.jsx
@@ -352,7 +352,8 @@ export default class RhsThread extends React.Component {
let previousPostDay = rootPostDay;
const commentsLists = [];
- for (let i = 0; i < postsArray.length; i++) {
+ const postsLength = postsArray.length;
+ for (let i = 0; i < postsLength; i++) {
const comPost = postsArray[i];
let p;
if (UserStore.getCurrentId() === comPost.user_id) {
@@ -371,10 +372,7 @@ export default class RhsThread extends React.Component {
status = this.state.statuses[p.id] || 'offline';
}
- const keyPrefix = comPost.id ? comPost.id : comPost.pending_post_id;
-
const currentPostDay = Utils.getDateForUnixTicks(comPost.create_at);
-
if (currentPostDay.toDateString() !== previousPostDay.toDateString()) {
previousPostDay = currentPostDay;
commentsLists.push(
@@ -383,11 +381,14 @@ export default class RhsThread extends React.Component {
/>);
}
+ const keyPrefix = comPost.id ? comPost.id : comPost.pending_post_id;
+ const reverseCount = postsLength - i - 1;
commentsLists.push(
<div key={keyPrefix + 'commentKey'}>
<Comment
ref={comPost.id}
post={comPost}
+ lastPostCount={(reverseCount >= 0 && reverseCount < Constants.TEST_ID_COUNT) ? reverseCount : -1}
user={p}
currentUser={this.props.currentUser}
compactDisplay={this.state.compactDisplay}
@@ -431,12 +432,12 @@ export default class RhsThread extends React.Component {
className='post-right__scroll'
>
<DateSeparator
- date={rootPostDay.toDateString()}
+ date={rootPostDay}
/>
<RootPost
ref={selected.id}
post={selected}
- commentCount={postsArray.length}
+ commentCount={postsLength}
user={profile}
currentUser={this.props.currentUser}
compactDisplay={this.state.compactDisplay}
@@ -456,7 +457,7 @@ export default class RhsThread extends React.Component {
<CreateComment
channelId={selected.channel_id}
rootId={selected.id}
- latestPostId={postsArray.length > 0 ? postsArray[postsArray.length - 1].id : selected.id}
+ latestPostId={postsLength > 0 ? postsArray[postsLength - 1].id : selected.id}
/>
</div>
</div>