Skip to content

Commit

Permalink
Merge pull request #92 from jefft0/chore/Render-reverse-posts
Browse files Browse the repository at this point in the history
chore: Render posts in reverse order, fix a small bug
  • Loading branch information
jefft0 authored Jun 12, 2024
2 parents 1079c10 + b422618 commit e46f2cf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion realm/post.gno
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func (post *Post) RenderPost(indent string, levels int) string {
str += "\n"
if levels > 0 {
if post.replies.Size() > 0 {
post.replies.Iterate("", "", func(key string, value interface{}) bool {
post.replies.ReverseIterate("", "", func(key string, value interface{}) bool {
str += indent + "\n"
str += value.(*Post).RenderPost(indent+"> ", levels-1)
return false
Expand Down
4 changes: 2 additions & 2 deletions realm/userposts.gno
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func (userPosts *UserPosts) RenderUserPosts(includeFollowed bool) string {
} else {
posts = &userPosts.threads
}
posts.Iterate("", "", func(key string, postI interface{}) bool {
posts.ReverseIterate("", "", func(key string, postI interface{}) bool {
str += "----------------------------------------\n"
str += postI.(*Post).RenderSummary() + "\n"
return false
Expand Down Expand Up @@ -243,7 +243,7 @@ func (userPosts *UserPosts) refreshHomePosts() {
startKey := minStartKey
if info.startedPostsCtr > userPosts.lastRefreshId {
// Started following after the last refresh. Ignore messages before started following.
startKey := postIDKey(info.startedPostsCtr + 1)
startKey = postIDKey(info.startedPostsCtr + 1)
}

followedUserPosts.threads.Iterate(startKey, "", func(id string, postI interface{}) bool {
Expand Down

0 comments on commit e46f2cf

Please sign in to comment.