allow filtering of replies
This commit is contained in:
parent
af2deab137
commit
858ce2f291
|
@ -52,6 +52,8 @@ fields as well.
|
||||||
Regular expression match against the post
|
Regular expression match against the post
|
||||||
.Fa content .
|
.Fa content .
|
||||||
The special value of "." will match any post with a summary only.
|
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
|
.It Ar is announce
|
||||||
Is announced (shared).
|
Is announced (shared).
|
||||||
.It Ar announce of
|
.It Ar announce of
|
||||||
|
|
8
hfcs.go
8
hfcs.go
|
@ -33,6 +33,7 @@ type Filter struct {
|
||||||
IncludeAudience bool `json:",omitempty"`
|
IncludeAudience bool `json:",omitempty"`
|
||||||
Text string `json:",omitempty"`
|
Text string `json:",omitempty"`
|
||||||
re_text *regexp.Regexp
|
re_text *regexp.Regexp
|
||||||
|
IsReply bool `json:",omitempty"`
|
||||||
IsAnnounce bool `json:",omitempty"`
|
IsAnnounce bool `json:",omitempty"`
|
||||||
AnnounceOf string `json:",omitempty"`
|
AnnounceOf string `json:",omitempty"`
|
||||||
Reject bool `json:",omitempty"`
|
Reject bool `json:",omitempty"`
|
||||||
|
@ -306,6 +307,13 @@ func matchfilterX(h *Honk, f *Filter) string {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if match && f.IsReply {
|
||||||
|
match = false
|
||||||
|
if h.RID != "" {
|
||||||
|
match = true
|
||||||
|
rv += " reply"
|
||||||
|
}
|
||||||
|
}
|
||||||
if match && f.IsAnnounce {
|
if match && f.IsAnnounce {
|
||||||
match = false
|
match = false
|
||||||
if (f.AnnounceOf == "" && h.Oonker != "") || f.AnnounceOf == h.Oonker ||
|
if (f.AnnounceOf == "" && h.Oonker != "") || f.AnnounceOf == h.Oonker ||
|
||||||
|
|
|
@ -20,6 +20,8 @@ Honk Filtering and Censorship System
|
||||||
<input tabindex=1 type="checkbox" id="incaud" name="incaud" value="yes"><span></span></label></span>
|
<input tabindex=1 type="checkbox" id="incaud" name="incaud" value="yes"><span></span></label></span>
|
||||||
<p><label for="filttext">text matches:</label><br>
|
<p><label for="filttext">text matches:</label><br>
|
||||||
<input tabindex=1 type="text" name="filttext" value="" autocomplete=off>
|
<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:
|
<p><span><label class=button for="isannounce">is announce:
|
||||||
<input tabindex=1 type="checkbox" id="isannounce" name="isannounce" value="yes"><span></span></label></span>
|
<input tabindex=1 type="checkbox" id="isannounce" name="isannounce" value="yes"><span></span></label></span>
|
||||||
<p><label for="announceof">announce of:</label><br>
|
<p><label for="announceof">announce of:</label><br>
|
||||||
|
@ -54,6 +56,7 @@ Honk Filtering and Censorship System
|
||||||
{{ with .Notes }}<p>Notes: {{ . }}{{ end }}
|
{{ 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 }}
|
||||||
|
{{ if .IsReply }}<p>Reply: y{{ end }}
|
||||||
{{ if .IsAnnounce }}<p>Announce: {{ .AnnounceOf }}{{ end }}
|
{{ if .IsAnnounce }}<p>Announce: {{ .AnnounceOf }}{{ end }}
|
||||||
{{ with .Text }}<p>Text: {{ . }}{{ end }}
|
{{ with .Text }}<p>Text: {{ . }}{{ end }}
|
||||||
<p>Actions: {{ range .Actions }} {{ . }} {{ end }}
|
<p>Actions: {{ range .Actions }} {{ . }} {{ end }}
|
||||||
|
|
1
web.go
1
web.go
|
@ -2004,6 +2004,7 @@ func savehfcs(w http.ResponseWriter, r *http.Request) {
|
||||||
filt.Actor = strings.TrimSpace(r.FormValue("actor"))
|
filt.Actor = strings.TrimSpace(r.FormValue("actor"))
|
||||||
filt.IncludeAudience = r.FormValue("incaud") == "yes"
|
filt.IncludeAudience = r.FormValue("incaud") == "yes"
|
||||||
filt.Text = strings.TrimSpace(r.FormValue("filttext"))
|
filt.Text = strings.TrimSpace(r.FormValue("filttext"))
|
||||||
|
filt.IsReply = r.FormValue("isreply") == "yes"
|
||||||
filt.IsAnnounce = r.FormValue("isannounce") == "yes"
|
filt.IsAnnounce = r.FormValue("isannounce") == "yes"
|
||||||
filt.AnnounceOf = strings.TrimSpace(r.FormValue("announceof"))
|
filt.AnnounceOf = strings.TrimSpace(r.FormValue("announceof"))
|
||||||
filt.Reject = r.FormValue("doreject") == "yes"
|
filt.Reject = r.FormValue("doreject") == "yes"
|
||||||
|
|
Loading…
Reference in New Issue