diff --git a/activity.go b/activity.go index 3462b9f..23d1ba5 100644 --- a/activity.go +++ b/activity.go @@ -521,13 +521,22 @@ 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 diff --git a/docs/manual.txt b/docs/manual.txt index b556468..d698ae8 100644 --- a/docs/manual.txt +++ b/docs/manual.txt @@ -14,6 +14,13 @@ like https://example.com/users/name. Note that the commonly seen URL with Selecting just peeping won't actually follow them. (Incomplete feature.) +-- 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. + -- css Custom CSS may be provided by creating a views/local.css file. diff --git a/honk.go b/honk.go index 4abf557..3545cc2 100644 --- a/honk.go +++ b/honk.go @@ -611,6 +611,9 @@ 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 } @@ -684,6 +687,14 @@ func savebonk(w http.ResponseWriter, r *http.Request) { } +func zonkit(w http.ResponseWriter, r *http.Request) { + xid := r.FormValue("xid") + + log.Printf("zonking %s", xid) + userinfo := GetUserInfo(r) + stmtZonkIt.Exec(userinfo.UserID, xid) +} + func savehonk(w http.ResponseWriter, r *http.Request) { rid := r.FormValue("rid") noise := r.FormValue("noise") @@ -991,6 +1002,7 @@ func serve() { loggedin.Use(LoginRequired) loggedin.Handle("/honk", CSRFWrap("honkhonk", http.HandlerFunc(savehonk))) loggedin.Handle("/bonk", CSRFWrap("honkhonk", http.HandlerFunc(savebonk))) + loggedin.Handle("/zonkit", CSRFWrap("honkhonk", http.HandlerFunc(zonkit))) loggedin.Handle("/saveuser", CSRFWrap("saveuser", http.HandlerFunc(saveuser))) loggedin.HandleFunc("/honkers", showhonkers) loggedin.Handle("/savehonker", CSRFWrap("savehonker", http.HandlerFunc(savehonker))) @@ -1006,6 +1018,7 @@ var stmtHonksForUser, stmtDeleteHonk, stmtSaveDub *sql.Stmt var stmtHonksByHonker, stmtSaveHonk, stmtFileData, stmtWhatAbout *sql.Stmt var stmtFindXonk, stmtSaveDonk, stmtFindFile, stmtSaveFile *sql.Stmt var stmtAddDoover, stmtGetDoovers, stmtLoadDoover, stmtZapDoover *sql.Stmt +var stmtZonkIt *sql.Stmt func preparetodie(db *sql.DB, s string) *sql.Stmt { stmt, err := db.Prepare(s) @@ -1036,6 +1049,7 @@ 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 = ?") } func ElaborateUnitTests() { diff --git a/views/homepage.html b/views/homepage.html index 97f188e..0c39a48 100644 --- a/views/homepage.html +++ b/views/homepage.html @@ -23,5 +23,8 @@ function post(url, data) { function bonk(xid) { post("/bonk", "CSRF={{ $BonkCSRF }}&xid=" + xid) } +function zonkit(xid) { + post("/zonkit", "CSRF={{ $BonkCSRF }}&xid=" + xid) +} {{ end }} diff --git a/views/honk.html b/views/honk.html index 013e8dc..ec53dce 100644 --- a/views/honk.html +++ b/views/honk.html @@ -1,7 +1,8 @@ -
{{ .Username }} {{ .What }} {{ .Date.Format "02 Jan 2006 15:04" }} {{ .URL }}
{{ .HTML }}
{{ .HTML }} {{ range .Donks }} {{ if eq .Media "text/plain" }}
Attachment: {{ .Name }} @@ -9,10 +10,12 @@
- + + {{ end }}