From 90a6e0f7c3d2cb1bd141a7098d6170117efbf7d5 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Fri, 3 May 2019 13:42:39 -0400 Subject: [PATCH] people really want to believe that deletion can work. i think it's dangerous to perpetuate this belief, but i'm not interested in being the internet archive either. --- activity.go | 11 +++-------- docs/manual.txt | 5 ++--- honk.go | 20 +++++++++++++++----- upgradedb.go | 4 ++++ util.go | 2 +- views/honk.html | 2 +- views/style.css | 11 ----------- 7 files changed, 26 insertions(+), 29 deletions(-) diff --git a/activity.go b/activity.go index fb0e4fa..6a1f077 100644 --- a/activity.go +++ b/activity.go @@ -680,22 +680,14 @@ func jonkjonk(user *WhatAbout, h *Honk) (map[string]interface{}, map[string]inte } switch h.What { - case "zonk": - fallthrough case "tonk": fallthrough case "honk": j["type"] = "Create" - if h.What == "zonk" { - j["type"] = "Delete" - } jo = NewJunk() jo["id"] = user.URL + "/h/" + h.XID jo["type"] = "Note" - if h.What == "zonk" { - jo["type"] = "Tombstone" - } jo["published"] = dt jo["url"] = user.URL + "/h/" + h.XID jo["attributedTo"] = user.URL @@ -756,6 +748,9 @@ func jonkjonk(user *WhatAbout, h *Honk) (map[string]interface{}, map[string]inte case "bonk": j["type"] = "Announce" j["object"] = h.XID + case "zonk": + j["type"] = "Delete" + j["object"] = user.URL + "/h/" + h.XID } return j, jo diff --git a/docs/manual.txt b/docs/manual.txt index b3dc94a..71f9918 100644 --- a/docs/manual.txt +++ b/docs/manual.txt @@ -26,9 +26,8 @@ Cant be useful for managing as part of a combo, however. -- zonking You can zonk anything you like (or dislike), either your own honk or -those of others that you're tired of seeing. This reduces its visibility, but -doesn't attempt to delete it, which is infeasible. -It's more like disavow or disregard. +those of others that you're tired of seeing. Be advised that deletion +works poorly in a federated environment. It's more like please disregard. The killzone supports blocking unwanted contacts. One may block an actor (zonker), a domain (zurl), or thread (zonvoy). diff --git a/honk.go b/honk.go index 1237eaa..c25bd11 100644 --- a/honk.go +++ b/honk.go @@ -711,9 +711,6 @@ func donksforhonks(honks []*Honk) { var ids []string hmap := make(map[int64]*Honk) for _, h := range honks { - if h.What == "zonk" { - continue - } ids = append(ids, fmt.Sprintf("%d", h.ID)) hmap[h.ID] = h } @@ -814,7 +811,20 @@ func zonkit(w http.ResponseWriter, r *http.Request) { log.Printf("zonking %s %s", wherefore, what) userinfo := login.GetUserInfo(r) if wherefore == "zonk" { + xonk := getxonk(userinfo.Username, what) stmtZonkIt.Exec(userinfo.UserID, what) + if xonk != nil && xonk.Honker == "" { + zonk := Honk{ + What: "zonk", + XID: xonk.XID, + Date: time.Now().UTC(), + Audience: oneofakind(xonk.Audience), + } + + user, _ := butwhatabout(userinfo.Username) + log.Printf("announcing deleted honk: %s", what) + go honkworldwide(user, &zonk) + } } else { _, err := stmtSaveZonker.Exec(userinfo.UserID, what, wherefore) if err != nil { @@ -1331,7 +1341,8 @@ func prepareStatements(db *sql.DB) { stmtFileData = preparetodie(db, "select media, content from files where xid = ?") stmtFindXonk = preparetodie(db, "select honkid from honks where userid = ? and xid = ?") stmtSaveDonk = preparetodie(db, "insert into donks (honkid, fileid) values (?, ?)") - stmtDeleteHonk = preparetodie(db, "update honks set what = 'zonk' where xid = ? and honker = ? and userid = ?") + stmtDeleteHonk = preparetodie(db, "delete from honks where xid = ? and honker = ? and userid = ?") + stmtZonkIt = preparetodie(db, "delete from honks where userid = ? and xid = ?") stmtFindFile = preparetodie(db, "select fileid from files where url = ?") stmtSaveFile = preparetodie(db, "insert into files (xid, name, url, media, content) values (?, ?, ?, ?, ?)") stmtWhatAbout = preparetodie(db, "select userid, username, displayname, about, pubkey from users where username = ?") @@ -1340,7 +1351,6 @@ func prepareStatements(db *sql.DB) { stmtGetDoovers = preparetodie(db, "select dooverid, dt from doovers") stmtLoadDoover = preparetodie(db, "select tries, username, rcpt, msg from doovers where dooverid = ?") stmtZapDoover = preparetodie(db, "delete from doovers where dooverid = ?") - stmtZonkIt = preparetodie(db, "update honks set what = 'zonk' where userid = ? and xid = ?") stmtThumbBiters = preparetodie(db, "select userid, name, wherefore from zonkers where (wherefore = 'zonker' or wherefore = 'zurl')") stmtSaveZonker = preparetodie(db, "insert into zonkers (userid, name, wherefore) values (?, ?, ?)") stmtGetBoxes = preparetodie(db, "select ibox, obox, sbox from xonkers where xid = ?") diff --git a/upgradedb.go b/upgradedb.go index e1c4d9d..611b36f 100644 --- a/upgradedb.go +++ b/upgradedb.go @@ -65,6 +65,10 @@ func upgradedb() { doordie(db, "update config set value = 5 where key = 'dbversion'") fallthrough case 5: + doordie(db, "delete from honks where what = 'zonk'") + doordie(db, "update config set value = 6 where key = 'dbversion'") + fallthrough + case 6: default: log.Fatalf("can't upgrade unknown version %d", dbversion) } diff --git a/util.go b/util.go index 4421685..a6b0224 100644 --- a/util.go +++ b/util.go @@ -70,7 +70,7 @@ var dbtimeformat = "2006-01-02 15:04:05" var alreadyopendb *sql.DB var dbname = "honk.db" var stmtConfig *sql.Stmt -var myVersion = 5 +var myVersion = 6 func initdb() { schema, err := ioutil.ReadFile("schema.sql") diff --git a/views/honk.html b/views/honk.html index c18e063..7dc5605 100644 --- a/views/honk.html +++ b/views/honk.html @@ -25,7 +25,7 @@ convoy: {{ .Convoy }} {{ end }} {{ end }} -{{ if and .BonkCSRF (not (eq .Honk.What "zonked")) }} +{{ if .BonkCSRF }}

{{ if not .Honk.Privacy }} diff --git a/views/style.css b/views/style.css index 7d3e326..642192d 100644 --- a/views/style.css +++ b/views/style.css @@ -140,17 +140,6 @@ button a { .tonked .noise a { color: #aab; } -.zonked { - color: #a79; -} -.zonked .noise { - color: #a79; - font-size: 0.8em; - text-decoration: line-through; -} -.zonked .noise a { - color: #a79; -} .limited { border: 1px solid #a04; color: #a79;