aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFChannel <>2021-06-06 00:24:15 -0700
committerFChannel <>2021-06-06 00:24:15 -0700
commit3efbc7fad19d5927e479258e94c62ae26e334f66 (patch)
treecb74ce7ecd17ae339a877d901e20701049489466
parent5ca02e417cb5e60b020c0e090ac56d1000aed1cd (diff)
removed redundent functions
-rw-r--r--client.go102
1 files changed, 0 insertions, 102 deletions
diff --git a/client.go b/client.go
index 6ca3ee0..e9ecd80 100644
--- a/client.go
+++ b/client.go
@@ -124,10 +124,6 @@ func OutboxGet(w http.ResponseWriter, r *http.Request, db *sql.DB, collection Co
returnData.Key = *Key
- DeleteRemovedPosts(db, &collection)
- DeleteTombstoneReplies(&collection)
- DeleteTombstonePosts(&collection)
-
returnData.Boards = Boards
returnData.Posts = collection.OrderedItems
@@ -171,9 +167,6 @@ func CatalogGet(w http.ResponseWriter, r *http.Request, db *sql.DB, collection C
returnData.Boards = Boards
- DeleteRemovedPosts(db, &collection)
- DeleteTombstonePosts(&collection)
-
returnData.Posts = collection.OrderedItems
t.ExecuteTemplate(w, "layout", returnData)
@@ -216,9 +209,6 @@ func PostGet(w http.ResponseWriter, r *http.Request, db *sql.DB){
followActors := GetActorsFollowFromName(actor, name)
followCollection := GetActorsFollowPostFromId(db, followActors, postId)
- DeleteRemovedPosts(db, &followCollection)
- DeleteTombstoneReplies(&followCollection)
-
if len(followCollection.OrderedItems) > 0 {
returnData.Board.InReplyTo = followCollection.OrderedItems[0].Id
returnData.Posts = append(returnData.Posts, followCollection.OrderedItems[0])
@@ -233,9 +223,6 @@ func PostGet(w http.ResponseWriter, r *http.Request, db *sql.DB){
returnData.Board.Post.Actor = collection.Actor
returnData.Board.InReplyTo = inReplyTo
- DeleteRemovedPosts(db, &collection)
- DeleteTombstoneReplies(&collection)
-
if len(collection.OrderedItems) > 0 {
returnData.Posts = append(returnData.Posts, collection.OrderedItems[0])
}
@@ -346,95 +333,6 @@ func GetCaptchaCode(captcha string) string {
return code
}
-func DeleteTombstoneReplies(collection *Collection) {
-
- for i, e := range collection.OrderedItems {
- var replies CollectionBase
- for _, k := range e.Replies.OrderedItems {
- if k.Type != "Tombstone" {
- replies.OrderedItems = append(replies.OrderedItems, k)
- }
- }
-
- replies.TotalItems = collection.OrderedItems[i].Replies.TotalItems
- replies.TotalImgs = collection.OrderedItems[i].Replies.TotalImgs
- collection.OrderedItems[i].Replies = &replies
- }
-}
-
-func DeleteTombstonePosts(collection *Collection) {
- var nColl Collection
-
- for _, e := range collection.OrderedItems {
- if e.Type != "Tombstone" {
- nColl.OrderedItems = append(nColl.OrderedItems, e)
- }
- }
- collection.OrderedItems = nColl.OrderedItems
-}
-
-func DeleteRemovedPosts(db *sql.DB, collection *Collection) {
-
- removed := GetLocalDeleteDB(db)
-
- for p, e := range collection.OrderedItems {
- for _, j := range removed {
- if e.Id == j.ID {
- if j.Type == "attachment" {
- collection.OrderedItems[p].Preview.Href = "/public/removed.png"
- collection.OrderedItems[p].Preview.Name = "deleted"
- collection.OrderedItems[p].Preview.MediaType = "image/png"
- collection.OrderedItems[p].Attachment[0].Href = "/public/removed.png"
- collection.OrderedItems[p].Attachment[0].Name = "deleted"
- collection.OrderedItems[p].Attachment[0].MediaType = "image/png"
- } else {
- collection.OrderedItems[p].AttributedTo = "deleted"
- collection.OrderedItems[p].Content = ""
- collection.OrderedItems[p].Type = "Tombstone"
- if collection.OrderedItems[p].Attachment != nil {
- collection.OrderedItems[p].Preview.Href = "/public/removed.png"
- collection.OrderedItems[p].Preview.Name = "deleted"
- collection.OrderedItems[p].Preview.MediaType = "image/png"
- collection.OrderedItems[p].Attachment[0].Href = "/public/removed.png"
- collection.OrderedItems[p].Attachment[0].Name = "deleted"
- collection.OrderedItems[p].Attachment[0].MediaType = "image/png"
- }
- }
- }
- }
-
- for i, r := range e.Replies.OrderedItems {
- for _, k := range removed {
- if r.Id == k.ID {
- if k.Type == "attachment" {
- e.Replies.OrderedItems[i].Preview.Href = "/public/removed.png"
- e.Replies.OrderedItems[i].Preview.Name = "deleted"
- e.Replies.OrderedItems[i].Preview.MediaType = "image/png"
- e.Replies.OrderedItems[i].Attachment[0].Href = "/public/removed.png"
- e.Replies.OrderedItems[i].Attachment[0].Name = "deleted"
- e.Replies.OrderedItems[i].Attachment[0].MediaType = "image/png"
- collection.OrderedItems[p].Replies.TotalImgs = collection.OrderedItems[p].Replies.TotalImgs - 1
- } else {
- e.Replies.OrderedItems[i].AttributedTo = "deleted"
- e.Replies.OrderedItems[i].Content = ""
- e.Replies.OrderedItems[i].Type = "Tombstone"
- if e.Replies.OrderedItems[i].Attachment != nil {
- e.Replies.OrderedItems[i].Preview.Href = "/public/removed.png"
- e.Replies.OrderedItems[i].Preview.Name = "deleted"
- e.Replies.OrderedItems[i].Preview.MediaType = "image/png"
- e.Replies.OrderedItems[i].Attachment[0].Name = "deleted"
- e.Replies.OrderedItems[i].Attachment[0].Href = "/public/removed.png"
- e.Replies.OrderedItems[i].Attachment[0].MediaType = "image/png"
- collection.OrderedItems[p].Replies.TotalImgs = collection.OrderedItems[p].Replies.TotalImgs - 1
- }
- collection.OrderedItems[p].Replies.TotalItems = collection.OrderedItems[p].Replies.TotalItems - 1
- }
- }
- }
- }
- }
-}
-
func CreateLocalDeleteDB(db *sql.DB, id string, _type string) {
query := `select id from removed where id=$1`