From 8253c9b0b3f93b8eb8481650d5cb80d8da4c18ac Mon Sep 17 00:00:00 2001 From: Umputun Date: Wed, 14 Feb 2018 02:49:42 -0600 Subject: [PATCH] comment out fb pic magic --- app/rest/auth/providers.go | 22 +++++++++++----------- app/rest/format/tree.go | 12 +++++++++--- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/app/rest/auth/providers.go b/app/rest/auth/providers.go index 7a05dc68..b548c976 100644 --- a/app/rest/auth/providers.go +++ b/app/rest/auth/providers.go @@ -80,17 +80,17 @@ func NewFacebook(p Params) Provider { userInfo.ID = "facebook_" + userInfo.ID // picture under picture[data[url]] - if p, ok := data["picture"]; ok { - if picMap, ok := p.(map[string]interface{}); ok { - if d, ok := picMap["data"]; ok { - if dataMap, ok := d.(map[string]interface{}); ok { - if picURL, ok := dataMap["url"]; ok { - userInfo.Picture = picURL.(string) - } - } - } - } - } + // if p, ok := data["picture"]; ok { + // if picMap, ok := p.(map[string]interface{}); ok { + // if d, ok := picMap["data"]; ok { + // if dataMap, ok := d.(map[string]interface{}); ok { + // if picURL, ok := dataMap["url"]; ok { + // userInfo.Picture = picURL.(string) + // } + // } + // } + // } + // } return userInfo }, }) diff --git a/app/rest/format/tree.go b/app/rest/format/tree.go index a29c2ab5..3a686957 100644 --- a/app/rest/format/tree.go +++ b/app/rest/format/tree.go @@ -23,10 +23,16 @@ func MakeTree(comments []store.Comment, sortType string) *Tree { res := Tree{} topComments := res.filter(comments, "") - res.Nodes = make([]*Node, len(topComments)) - for i, rc := range topComments { + res.Nodes = []*Node{} + for _, rc := range topComments { node := Node{Comment: rc} - res.Nodes[i] = res.proc(comments, &node, rc.ID) + + commentsTree := res.proc(comments, &node, rc.ID) + if commentsTree.Comment.Deleted && len(commentsTree.Replies) == 0 { // skip deleted with no subcomments + continue + } + + res.Nodes = append(res.Nodes, res.proc(comments, &node, rc.ID)) } res.sortNodes(sortType)