From 5c18c0551756cd1def1a0e85e6fc07141fea6405 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Mon, 2 Dec 2019 18:02:33 -0500 Subject: [PATCH] add notes field to filters for record keeping --- docs/changelog.txt | 2 ++ hfcs.go | 1 + views/hfcs.html | 4 ++++ views/style.css | 5 ++++- web.go | 1 + 5 files changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index cbb945d..47a9081 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -2,6 +2,8 @@ changelog -- next ++ Add notes field to filters for record keeping. + + Negated search -terms. + A raw sendactivity API action for the bold. diff --git a/hfcs.go b/hfcs.go index 42abd1f..400b0eb 100644 --- a/hfcs.go +++ b/hfcs.go @@ -44,6 +44,7 @@ type Filter struct { re_rewrite *regexp.Regexp Replace string `json:",omitempty"` Expiration time.Time + Notes string } type filtType uint diff --git a/views/hfcs.html b/views/hfcs.html index 03bae70..72b106b 100644 --- a/views/hfcs.html +++ b/views/hfcs.html @@ -9,6 +9,9 @@ Honk Filtering and Censorship System

new filter


+


+


match


@@ -48,6 +51,7 @@ Honk Filtering and Censorship System {{ range .Filters }}

Name: {{ .Name }} +{{ with .Notes }}

Notes: {{ . }}{{ end }}

Date: {{ .Date.Format "2006-01-02" }} {{ with .Actor }}

Who: {{ . }}{{ end }} {{ with .IncludeAudience }} (inclusive) {{ end }} {{ with .Text }}

Text: {{ . }}{{ end }} diff --git a/views/style.css b/views/style.css index 89f0194..76d7345 100644 --- a/views/style.css +++ b/views/style.css @@ -143,11 +143,14 @@ textarea { background: var(--bg-page); color: var(--fg); width: 600px; - height: 8em; + height: 4em; margin-bottom: 0.5em; box-sizing: border-box; max-width: 100%; } +textarea#hostnoise { + height: 8em; +} input[type="checkbox"] { position: fixed; top: -9999px; diff --git a/web.go b/web.go index cb0a7f4..413df2c 100644 --- a/web.go +++ b/web.go @@ -1878,6 +1878,7 @@ func savehfcs(w http.ResponseWriter, r *http.Request) { if dur := parseDuration(r.FormValue("filtduration")); dur > 0 { filt.Expiration = time.Now().UTC().Add(dur) } + filt.Notes = strings.TrimSpace(r.FormValue("filtnotes")) if filt.Actor == "" && filt.Text == "" && !filt.IsAnnounce { log.Printf("blank filter")