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()
|
defer h.Backend.save()
|
||||||
uid := r.FormValue("uid")
|
uid := r.FormValue("uid")
|
||||||
|
|
||||||
|
if h.Backend.Settings == nil {
|
||||||
|
h.Backend.Settings = make(map[string]channelSetting)
|
||||||
|
}
|
||||||
|
|
||||||
excludeRegex := r.FormValue("exclude_regex")
|
excludeRegex := r.FormValue("exclude_regex")
|
||||||
includeRegex := r.FormValue("include_regex")
|
includeRegex := r.FormValue("include_regex")
|
||||||
channelType := r.FormValue("type")
|
channelType := r.FormValue("type")
|
||||||
|
|
||||||
if setting, e := h.Backend.Settings[uid]; e {
|
setting, e := h.Backend.Settings[uid]
|
||||||
setting.ExcludeRegex = excludeRegex
|
if !e {
|
||||||
setting.IncludeRegex = includeRegex
|
setting = channelSetting{}
|
||||||
setting.ChannelType = channelType
|
|
||||||
h.Backend.Settings[uid] = setting
|
|
||||||
} else {
|
|
||||||
setting = channelSetting{
|
|
||||||
ExcludeRegex: excludeRegex,
|
|
||||||
IncludeRegex: includeRegex,
|
|
||||||
ChannelType: channelType,
|
|
||||||
}
|
|
||||||
h.Backend.Settings[uid] = setting
|
|
||||||
}
|
}
|
||||||
|
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()
|
h.Backend.Debug()
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,7 @@ type memoryBackend struct {
|
||||||
type channelSetting struct {
|
type channelSetting struct {
|
||||||
ExcludeRegex string
|
ExcludeRegex string
|
||||||
IncludeRegex string
|
IncludeRegex string
|
||||||
|
ExcludeType []string
|
||||||
ChannelType string
|
ChannelType string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,6 +79,20 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</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="field">
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<button type="submit" class="button is-primary">Save</button>
|
<button type="submit" class="button is-primary">Save</button>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user