all repos — honk @ 405e1c153dcf38cd85a1df0b611f0c3afb2355a9

my fork of honk

allow zonking of anything, but be clear that disavow is not delete
Ted Unangst tedu@tedunangst.com
Mon, 15 Apr 2019 16:18:38 -0400
commit

405e1c153dcf38cd85a1df0b611f0c3afb2355a9

parent

c06fdf138ba5bb3f4765ed3305663157aa8a38ec

6 files changed, 62 insertions(+), 13 deletions(-)

jump to
M activity.goactivity.go

@@ -521,13 +521,22 @@ j["cc"] = h.Audience[1:]

} 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
M docs/manual.txtdocs/manual.txt

@@ -14,6 +14,13 @@ @name in it is not their actor ID and won't work.

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.
M honk.gohonk.go

@@ -611,6 +611,9 @@ db := opendatabase()

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 }

@@ -682,6 +685,14 @@ user, _ := butwhatabout(userinfo.Username)

go honkworldwide(user, &bonk) +} + +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) {

@@ -991,6 +1002,7 @@ loggedin := mux.NewRoute().Subrouter()

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 @@ stmtAddDoover = preparetodie(db, "insert into doovers (dt, tries, username, rcpt, msg) values (?, ?, ?, ?, ?)")

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() {
M views/homepage.htmlviews/homepage.html

@@ -23,5 +23,8 @@ }

function bonk(xid) { post("/bonk", "CSRF={{ $BonkCSRF }}&xid=" + xid) } +function zonkit(xid) { + post("/zonkit", "CSRF={{ $BonkCSRF }}&xid=" + xid) +} </script> {{ end }}
M views/honk.htmlviews/honk.html

@@ -1,7 +1,8 @@

-<div class="honk {{ if eq .Honk.What "tonked" }} tonk {{ end }}"> +<div class="honk {{ .Honk.What }}"> {{ with .Honk }} <div class="title"><img alt="avatar" src="/a?a={{ .Honker}}"><p><a href="{{ .Honker }}" rel=noreferrer>{{ .Username }}</a> <span class="clip">{{ .What }} {{ .Date.Format "02 Jan 2006 15:04" }} <a href="{{ .URL }}" rel=noreferrer>{{ .URL }}</a></span></div> -<div class="noise"><p>{{ .HTML }}</div> +<div class="noise"> +<p>{{ .HTML }} {{ range .Donks }} {{ if eq .Media "text/plain" }} <p><a href="/d/{{ .XID }}">Attachment: {{ .Name }}</a>

@@ -9,10 +10,12 @@ {{ else }}

<p><a href="/d/{{ .XID }}"><img src="/d/{{ .XID }}" title="{{ .URL }}"></a> {{ end }} {{ end }} +</div> {{ end }} -{{ if .Bonk }} +{{ if and .Bonk (not (eq .Honk.What "zonked")) }} <p> <button onclick="bonk('{{ .Honk.XID }}'); return false;"><a href="/bonk">bonk</a></button> -<button style="margin-left: 4em;" onclick="showhonkform('{{ .Honk.XID }}', '{{ .Honk.Username }}'); return false;"><a href="/newhonk">tonk</a></button> +<button onclick="showhonkform('{{ .Honk.XID }}', '{{ .Honk.Username }}'); return false;"><a href="/newhonk">tonk</a></button> +<button onclick="zonkit('{{ .Honk.XID }}'); return false;"><a href="/zonkit">zonk</a></button> {{ end }} </div>
M views/style.cssviews/style.css

@@ -110,15 +110,6 @@ padding-left: 1em;

padding-right: 1em; padding-top: 0; } -.tonk { -} -.tonk .noise { - color: #aab; - font-size: 0.8em; -} -.tonk .noise a { - color: #aab; -} .honk a { color: #dde; }

@@ -140,6 +131,28 @@ height: 64px;

} .honk .title p { margin-top: 0px; +} +.honk button { + margin-right: 6em; +} +.tonked { +} +.tonked .noise { + color: #aab; + font-size: 0.8em; +} +.tonked .noise a { + color: #aab; +} +.zonked { +} +.zonked .noise { + color: #a79; + font-size: 0.8em; + text-decoration: line-through; +} +.zonked .noise a { + color: #a79; } img { max-width: 100%