option to mention all in replies
Ted Unangst tedu@tedunangst.com
Wed, 05 Aug 2020 15:33:27 -0400
7 files changed,
33 insertions(+),
3 deletions(-)
M
docs/changelog.txt
→
docs/changelog.txt
@@ -2,6 +2,8 @@ changelog
=== next ++ Option to mention all in replies. + + Reduce interference between various text substitution rules. + Fix crash in search with extra space.
M
fun.go
→
fun.go
@@ -52,6 +52,8 @@ allowedclasses["dl"] = true
} func reverbolate(userid int64, honks []*Honk) { + var user *WhatAbout + somenumberedusers.Get(userid, &user) for _, h := range honks { h.What += "ed" if h.What == "tonked" {@@ -80,6 +82,22 @@ if len(h.Username) > 20 {
h.Username = h.Username[:20] + ".." } } + } + if user.Options.MentionAll { + hset := []string{"@" + h.Handle} + for _, a := range h.Audience { + if a == h.Honker { + continue + } + _, hand := handles(a) + if hand != "" { + hand = "@" + hand + hset = append(hset, hand) + } + } + h.Handles = strings.Join(hset, " ") + } else { + h.Handles = "@" + h.Handle } if h.URL == "" { h.URL = h.XID@@ -527,7 +545,7 @@ }})
// handle, handle@host func handles(xid string) (string, string) { - if xid == "" { + if xid == "" || xid == thewholeworld || strings.HasSuffix(xid, "/followers") { return "", "" } var handle string
M
honk.go
→
honk.go
@@ -52,6 +52,7 @@ OmitImages bool `json:",omitempty"`
Avatar string `json:",omitempty"` MapLink string `json:",omitempty"` Reaction string `json:",omitempty"` + MentionAll bool } type KeyInfo struct {@@ -68,6 +69,7 @@ Username string
What string Honker string Handle string + Handles string Oonker string Oondle string XID string
M
views/account.html
→
views/account.html
@@ -12,6 +12,9 @@ <p><label class="button" for="skinny">skinny layout:</label>
<input tabindex=1 type="checkbox" id="skinny" name="skinny" value="skinny" {{ if .User.Options.SkinnyCSS }}checked{{ end }}><span></span> <p><label class="button" for="omitimages">omit images:</label> <input tabindex=1 type="checkbox" id="omitimages" name="omitimages" value="omitimages" {{ if .User.Options.OmitImages }}checked{{ end }}><span></span> +<p><label class="button" for="mentionall">mention all:</label> +<input tabindex=1 type="checkbox" id="mentionall" name="mentionall" value="mentionall" {{ if .User.Options.MentionAll }}checked{{ end }}><span></span> + <p><label class="button" for="maps">apple map links:</label> <input tabindex=1 type="checkbox" id="maps" name="maps" value="apple" {{ if eq "apple" .User.Options.MapLink }}checked{{ end }}><span></span> <p><label class="button" for="reaction">reaction:</label>
M
views/honk.html
→
views/honk.html
@@ -106,7 +106,7 @@ {{ end }}
{{ else }} <button disabled>nope</button> {{ end }} -<button onclick="return showhonkform(this, '{{ .Honk.XID }}', '{{ .Honk.Handle }}');"><a href="/newhonk?rid={{ .Honk.XID }}">honk back</a></button> +<button onclick="return showhonkform(this, '{{ .Honk.XID }}', '{{ .Honk.Handles }}');"><a href="/newhonk?rid={{ .Honk.XID }}">honk back</a></button> <button onclick="return muteit(this, '{{ .Honk.Convoy }}');">mute</button> <button onclick="return showelement('evenmore{{ .Honk.ID }}')">even more</button> </div>
M
views/honkpage.js
→
views/honkpage.js
@@ -261,7 +261,7 @@ }
var ridinput = document.getElementById("ridinput") if (rid) { ridinput.value = rid - honknoise.value = "@" + hname + " " + honknoise.value = hname + " " } else { ridinput.value = "" honknoise.value = ""