Skip to content

Commit

Permalink
keep the reply count when stargazing a post
Browse files Browse the repository at this point in the history
  • Loading branch information
krustowski committed Sep 12, 2024
1 parent a57ad3d commit ba9545b
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
#

APP_NAME=littr
APP_VERSION=0.40.1
APP_VERSION=0.40.2
GOLANG_VERSION=1.23
2 changes: 1 addition & 1 deletion api/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"name": "MIT",
"url": "https://github.com/krustowski/littr/blob/master/LICENSE"
},
"version": "0.40.1"
"version": "0.40.2"
},
"host": "www.littr.eu",
"basePath": "/api/v1",
Expand Down
1 change: 1 addition & 0 deletions configs/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ var UserDeletionList []string = []string{
"nickname",
"test",
"tester",
"littr",
}

// This array is used in a procedure's loop to manually unshade listed users.
Expand Down
2 changes: 1 addition & 1 deletion pkg/backend/router.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @title littr
// @version 0.40.1
// @version 0.40.2
// @description a simple nanoblogging platform as PWA built on go-app framework
// @termsOfService https://littr.eu/tos

Expand Down
7 changes: 6 additions & 1 deletion pkg/frontend/flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -786,8 +786,13 @@ func (c *flowContent) handleStar(ctx app.Context, a app.Action) {
toastText = "backend error: cannot rate a post"
}

// keep the reply count!
oldPost := c.posts[key]
newPost := postsRaw.Posts[key]
newPost.ReplyCount = oldPost.ReplyCount

ctx.Dispatch(func(ctx app.Context) {
c.posts[key] = postsRaw.Posts[key]
c.posts[key] = newPost
c.toastText = toastText
c.toastShow = (toastText != "")
})
Expand Down

0 comments on commit ba9545b

Please sign in to comment.