Skip to content

Commit

Permalink
patch private acc posts (non)fetching on user's flow
Browse files Browse the repository at this point in the history
  • Loading branch information
krustowski committed Jul 22, 2024
1 parent 5b50f5d commit 451618a
Show file tree
Hide file tree
Showing 5 changed files with 27 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=litter-go
APP_VERSION=0.35.23
APP_VERSION=0.36.0
GOLANG_VERSION=1.22
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/litter-go/blob/master/LICENSE"
},
"version": "0.35.23"
"version": "0.36.0"
},
"host": "littr.eu",
"basePath": "/api/v1",
Expand Down
4 changes: 4 additions & 0 deletions pkg/backend/posts/paginate.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ func GetOnePage(opts PageOptions) (map[string]models.Post, map[string]models.Use
}

if opts.UserFlow && opts.UserFlowNick != "" {
if value, found := user.FlowList[opts.UserFlowNick]; (!value || !found) && allUsers[opts.UserFlowNick].Private {
continue
}

if post.Nickname == opts.UserFlowNick {
posts = append(posts, post)
}
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 litter-go
// @version 0.35.23
// @version 0.36.0
// @description nanoblogging platform as PWA built on go-app framework
// @termsOfService https://littr.eu/tos

Expand Down
21 changes: 20 additions & 1 deletion pkg/frontend/flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,24 @@ func (c *flowContent) onClickFollow(ctx app.Context, e app.Event) {

if value, found := flowList[key]; found {
if !value && c.users[key].Private {
ctx.Dispatch(func(ctx app.Context) {
c.buttonDisabled = false
c.postButtonsDisabled = false
c.toastText = "this account is private"
c.toastShow = true
})

return
}
flowList[key] = !flowList[key]
} else {
if c.users[key].Private {
ctx.Dispatch(func(ctx app.Context) {
c.buttonDisabled = false
c.postButtonsDisabled = false
c.toastText = "this account is private"
c.toastShow = true
})
return
}
flowList[key] = true
Expand Down Expand Up @@ -1071,7 +1084,13 @@ func (c *flowContent) Render() app.UI {
app.Div().Class("row").Body(
app.Div().Class("max padding").Body(
app.If(c.userFlowNick != "" && !c.isPost,
app.H5().Text(c.userFlowNick+"'s flow"),
app.H5().Body(
app.Text(c.userFlowNick+"'s flow"),

app.Span().Class("bold").Body(
app.I().Text("lock"),
),
),
).ElseIf(c.singlePostID != "" && c.isPost,
app.H5().Text("single post and replies"),
).Else(
Expand Down

0 comments on commit 451618a

Please sign in to comment.