allow filtering of replies
Ted Unangst tedu@tedunangst.com
Wed, 15 Mar 2023 15:26:46 -0400
4 files changed,
14 insertions(+),
0 deletions(-)
M
docs/hfcs.1
→
docs/hfcs.1
@@ -52,6 +52,8 @@ .It Ar text
Regular expression match against the post .Fa content . The special value of "." will match any post with a summary only. +.It Ar is reply +A reply to another post. .It Ar is announce Is announced (shared). .It Ar announce of
M
hfcs.go
→
hfcs.go
@@ -33,6 +33,7 @@ Actor string `json:",omitempty"`
IncludeAudience bool `json:",omitempty"` Text string `json:",omitempty"` re_text *regexp.Regexp + IsReply bool `json:",omitempty"` IsAnnounce bool `json:",omitempty"` AnnounceOf string `json:",omitempty"` Reject bool `json:",omitempty"`@@ -304,6 +305,13 @@ rv = f.Actor
break } } + } + } + if match && f.IsReply { + match = false + if h.RID != "" { + match = true + rv += " reply" } } if match && f.IsAnnounce {
M
views/hfcs.html
→
views/hfcs.html
@@ -20,6 +20,8 @@ <p><span><label class=button for="incaud">include audience:
<input tabindex=1 type="checkbox" id="incaud" name="incaud" value="yes"><span></span></label></span> <p><label for="filttext">text matches:</label><br> <input tabindex=1 type="text" name="filttext" value="" autocomplete=off> +<p><span><label class=button for="isreply">is reply: +<input tabindex=1 type="checkbox" id="isreply" name="isreply" value="yes"><span></span></label></span> <p><span><label class=button for="isannounce">is announce: <input tabindex=1 type="checkbox" id="isannounce" name="isannounce" value="yes"><span></span></label></span> <p><label for="announceof">announce of:</label><br>@@ -54,6 +56,7 @@ <p>Name: {{ .Name }}
{{ with .Notes }}<p>Notes: {{ . }}{{ end }} <p>Date: {{ .Date.Format "2006-01-02" }} {{ with .Actor }}<p>Who: {{ . }}{{ end }} {{ with .IncludeAudience }} (inclusive) {{ end }} +{{ if .IsReply }}<p>Reply: y{{ end }} {{ if .IsAnnounce }}<p>Announce: {{ .AnnounceOf }}{{ end }} {{ with .Text }}<p>Text: {{ . }}{{ end }} <p>Actions: {{ range .Actions }} {{ . }} {{ end }}
M
web.go
→
web.go
@@ -2004,6 +2004,7 @@ filt.Date = time.Now().UTC()
filt.Actor = strings.TrimSpace(r.FormValue("actor")) filt.IncludeAudience = r.FormValue("incaud") == "yes" filt.Text = strings.TrimSpace(r.FormValue("filttext")) + filt.IsReply = r.FormValue("isreply") == "yes" filt.IsAnnounce = r.FormValue("isannounce") == "yes" filt.AnnounceOf = strings.TrimSpace(r.FormValue("announceof")) filt.Reject = r.FormValue("doreject") == "yes"