Merge pull request #110 from ClaytonWWilson/chronological

can sort posts chronologically in userline and formatted topics listi…
This commit is contained in:
asankaran35 2019-12-05 18:56:18 -05:00 committed by GitHub
commit 76792148cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -46,8 +46,10 @@ exports.getallPostsforUser = (req, res) => {
myPosts.forEach(function(doc) {
posts.push(doc.data());
});
posts.sort((a, b) => -a.createdAt.localeCompare(b.createdAt));
return res.status(200).json(posts);
})
.then(function() {
return res
.status(200)

View File

@ -230,7 +230,7 @@ class user extends Component {
<b>{post.userHandle}</b>
</Typography>
<Typography variant="body2" color={"textSecondary"}>
{post.createdAt}
{this.formatDate(post.createdAt) }
</Typography>
<br />
@ -243,7 +243,7 @@ class user extends Component {
<Typography variant="body2">{post.body}</Typography>
<br />
<Typography variant="body2">
<b>Topics:</b> {post.microBlogTopics}
<b>Topics:</b> {post.microBlogTopics.join(", ")}
</Typography>
<br />
<Typography variant="body2" color={"textSecondary"}>