add notes field to filters for record keeping

Ted Unangst 5 years ago
parent 67682429b7
commit e0460e7e58

@ -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.

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

@ -9,6 +9,9 @@ Honk Filtering and Censorship System
<h3>new filter</h3>
<p><label for="name">filter name:</label><br>
<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>
<h3>match</h3>
<p><label for="actor">who or where:</label><br>
@ -48,6 +51,7 @@ Honk Filtering and Censorship System
{{ range .Filters }}
<section class="honk">
<p>Name: {{ .Name }}
{{ with .Notes }}<p>Notes: {{ . }}{{ end }}
<p>Date: {{ .Date.Format "2006-01-02" }}
{{ with .Actor }}<p>Who: {{ . }}{{ end }} {{ with .IncludeAudience }} (inclusive) {{ end }}
{{ with .Text }}<p>Text: {{ . }}{{ end }}

@ -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;

@ -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")

Loading…
Cancel
Save