mirror of
https://github.com/rystaf/mlmym.git
synced 2024-11-08 08:04:26 +00:00
hide all toggle, get comments/posts bugfixes
This commit is contained in:
parent
834d8170d1
commit
ae0c8427d2
|
@ -104,9 +104,11 @@ function hideAllChildComments(e) {
|
|||
if (children.className.indexOf("hidden") == -1) {
|
||||
children.className = "children hidden"
|
||||
btn.className = "hidechildren hidden"
|
||||
e.target.innerHTML = "show all child comments"
|
||||
} else {
|
||||
children.className = "children"
|
||||
btn.className = "hidechildren"
|
||||
e.target.innerHTML = "hide all child comments"
|
||||
}
|
||||
}
|
||||
return false
|
||||
|
|
25
state.go
25
state.go
|
@ -269,6 +269,14 @@ func (state *State) GetComments() {
|
|||
Limit: types.NewOptional(int64(200)),
|
||||
Page: types.NewOptional(int64(state.Page)),
|
||||
})
|
||||
if err != nil && strings.Contains(fmt.Sprintf("%v", err), "couldnt_get_comments") {
|
||||
cresp, err = state.Client.Comments(context.Background(), types.GetComments{
|
||||
PostID: types.NewOptional(state.PostID),
|
||||
Sort: types.NewOptional(types.CommentSortType(state.Sort)),
|
||||
Type: types.NewOptional(types.ListingType("All")),
|
||||
Page: types.NewOptional(int64(state.Page)),
|
||||
})
|
||||
}
|
||||
if err != nil {
|
||||
state.Status = http.StatusInternalServerError
|
||||
fmt.Println(err)
|
||||
|
@ -432,13 +440,16 @@ func (state *State) MarkAllAsRead() {
|
|||
}
|
||||
|
||||
func (state *State) GetPosts() {
|
||||
resp, err := state.Client.Posts(context.Background(), types.GetPosts{
|
||||
Sort: types.NewOptional(types.SortType(state.Sort)),
|
||||
Type: types.NewOptional(types.ListingType(state.Listing)),
|
||||
CommunityName: types.NewOptional(state.CommunityName),
|
||||
Limit: types.NewOptional(int64(25)),
|
||||
Page: types.NewOptional(int64(state.Page)),
|
||||
})
|
||||
posts := types.GetPosts{
|
||||
Sort: types.NewOptional(types.SortType(state.Sort)),
|
||||
Type: types.NewOptional(types.ListingType(state.Listing)),
|
||||
Limit: types.NewOptional(int64(25)),
|
||||
Page: types.NewOptional(int64(state.Page)),
|
||||
}
|
||||
if state.CommunityName != "" {
|
||||
posts.CommunityName = types.NewOptional(state.CommunityName)
|
||||
}
|
||||
resp, err := state.Client.Posts(context.Background(), posts)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
state.Status = http.StatusInternalServerError
|
||||
|
|
Loading…
Reference in a new issue