Website Summary Files Commits Branches @commit @diff @stats
path: root / src
diff options
context:
space:
mode:
Commit5c1216e864004c5694b3475b45e4047c2617a2d2 (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2021-02-02 09:06:16 +0200
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2021-02-02 09:06:16 +0200
Filesb168368306f75a56e9f2af452c1bdc9aa558ce8a /src
DevHive-5c1216e864004c5694b3475b45e4047c2617a2d2.tar
DevHive-5c1216e864004c5694b3475b45e4047c2617a2d2.tar.gz
DevHive-5c1216e864004c5694b3475b45e4047c2617a2d2.zip
Parent1db9ba48bf88d169108fa9355172b9e80d98ad28 (diff)
Fixed comment order when getting a post
1 files changed, 5 insertions, 0 deletions
-rw-r--r--src/DevHive.Services/Services/PostService.cs5
diff --git a/src/DevHive.Services/Services/PostService.cs b/src/DevHive.Services/Services/PostService.cs
index 3206479..8002468 100644
--- a/src/DevHive.Services/Services/PostService.cs
+++ b/src/DevHive.Services/Services/PostService.cs
@@ -65,6 +65,11 @@ namespace DevHive.Services.Services
Post post = await this._postRepository.GetByIdAsync(id) ??
throw new ArgumentException("The post does not exist!");
+ // This can't happen in repo, because of how time is usually compared
+ post.Comments = post.Comments
+ .OrderByDescending(x => x.TimeCreated.ToFileTimeUtc())
+ .ToList();
+
User user = await this._userRepository.GetByIdAsync(post.Creator.Id) ??
throw new ArgumentException("The user does not exist!");