Add UI for saving excluded post types
This commit is contained in:
parent
f8b9003c36
commit
19f3177f66
|
@ -629,23 +629,25 @@ func (h *mainHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||
defer h.Backend.save()
|
||||
uid := r.FormValue("uid")
|
||||
|
||||
if h.Backend.Settings == nil {
|
||||
h.Backend.Settings = make(map[string]channelSetting)
|
||||
}
|
||||
|
||||
excludeRegex := r.FormValue("exclude_regex")
|
||||
includeRegex := r.FormValue("include_regex")
|
||||
channelType := r.FormValue("type")
|
||||
|
||||
if setting, e := h.Backend.Settings[uid]; e {
|
||||
setting.ExcludeRegex = excludeRegex
|
||||
setting.IncludeRegex = includeRegex
|
||||
setting.ChannelType = channelType
|
||||
h.Backend.Settings[uid] = setting
|
||||
} else {
|
||||
setting = channelSetting{
|
||||
ExcludeRegex: excludeRegex,
|
||||
IncludeRegex: includeRegex,
|
||||
ChannelType: channelType,
|
||||
}
|
||||
h.Backend.Settings[uid] = setting
|
||||
setting, e := h.Backend.Settings[uid]
|
||||
if !e {
|
||||
setting = channelSetting{}
|
||||
}
|
||||
setting.ExcludeRegex = excludeRegex
|
||||
setting.IncludeRegex = includeRegex
|
||||
setting.ChannelType = channelType
|
||||
if values, e := r.Form["exclude_type"]; e {
|
||||
setting.ExcludeType = values
|
||||
}
|
||||
h.Backend.Settings[uid] = setting
|
||||
|
||||
h.Backend.Debug()
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@ type memoryBackend struct {
|
|||
type channelSetting struct {
|
||||
ExcludeRegex string
|
||||
IncludeRegex string
|
||||
ExcludeType []string
|
||||
ChannelType string
|
||||
}
|
||||
|
||||
|
|
|
@ -79,6 +79,20 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="exclude_type" class="label">Exclude Types</label>
|
||||
<div class="control">
|
||||
<div class="select is-multiple">
|
||||
<select name="exclude_type" id="exclude_type" multiple>
|
||||
<option value="repost">Reposts</option>
|
||||
<option value="like">Likes</option>
|
||||
<option value="reply">Replies</option>
|
||||
<option value="bookmark">Bookmarks</option>
|
||||
<option value="checkin">Checkins</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<div class="control">
|
||||
<button type="submit" class="button is-primary">Save</button>
|
||||
|
|
Loading…
Reference in New Issue
Block a user