add notes field to filters for record keeping

This commit is contained in:
Ted Unangst 2019-12-02 18:02:33 -05:00
parent a9b984ec4f
commit 5c18c05517
5 changed files with 12 additions and 1 deletions

View File

@ -2,6 +2,8 @@ changelog
-- next -- next
+ Add notes field to filters for record keeping.
+ Negated search -terms. + Negated search -terms.
+ A raw sendactivity API action for the bold. + A raw sendactivity API action for the bold.

View File

@ -44,6 +44,7 @@ type Filter struct {
re_rewrite *regexp.Regexp re_rewrite *regexp.Regexp
Replace string `json:",omitempty"` Replace string `json:",omitempty"`
Expiration time.Time Expiration time.Time
Notes string
} }
type filtType uint type filtType uint

View File

@ -9,6 +9,9 @@ Honk Filtering and Censorship System
<h3>new filter</h3> <h3>new filter</h3>
<p><label for="name">filter name:</label><br> <p><label for="name">filter name:</label><br>
<input tabindex=1 type="text" name="name" value="" autocomplete=off> <input tabindex=1 type="text" name="name" value="" autocomplete=off>
<p><label for="filtnotes">notes:</label><br>
<textarea tabindex=1 name="filtnotes" height=4>
</textarea>
<hr> <hr>
<h3>match</h3> <h3>match</h3>
<p><label for="actor">who or where:</label><br> <p><label for="actor">who or where:</label><br>
@ -48,6 +51,7 @@ Honk Filtering and Censorship System
{{ range .Filters }} {{ range .Filters }}
<section class="honk"> <section class="honk">
<p>Name: {{ .Name }} <p>Name: {{ .Name }}
{{ with .Notes }}<p>Notes: {{ . }}{{ end }}
<p>Date: {{ .Date.Format "2006-01-02" }} <p>Date: {{ .Date.Format "2006-01-02" }}
{{ with .Actor }}<p>Who: {{ . }}{{ end }} {{ with .IncludeAudience }} (inclusive) {{ end }} {{ with .Actor }}<p>Who: {{ . }}{{ end }} {{ with .IncludeAudience }} (inclusive) {{ end }}
{{ with .Text }}<p>Text: {{ . }}{{ end }} {{ with .Text }}<p>Text: {{ . }}{{ end }}

View File

@ -143,11 +143,14 @@ textarea {
background: var(--bg-page); background: var(--bg-page);
color: var(--fg); color: var(--fg);
width: 600px; width: 600px;
height: 8em; height: 4em;
margin-bottom: 0.5em; margin-bottom: 0.5em;
box-sizing: border-box; box-sizing: border-box;
max-width: 100%; max-width: 100%;
} }
textarea#hostnoise {
height: 8em;
}
input[type="checkbox"] { input[type="checkbox"] {
position: fixed; position: fixed;
top: -9999px; top: -9999px;

1
web.go
View File

@ -1878,6 +1878,7 @@ func savehfcs(w http.ResponseWriter, r *http.Request) {
if dur := parseDuration(r.FormValue("filtduration")); dur > 0 { if dur := parseDuration(r.FormValue("filtduration")); dur > 0 {
filt.Expiration = time.Now().UTC().Add(dur) filt.Expiration = time.Now().UTC().Add(dur)
} }
filt.Notes = strings.TrimSpace(r.FormValue("filtnotes"))
if filt.Actor == "" && filt.Text == "" && !filt.IsAnnounce { if filt.Actor == "" && filt.Text == "" && !filt.IsAnnounce {
log.Printf("blank filter") log.Printf("blank filter")