Display option to hide feed only when category is not already hidden

This commit is contained in:
Jan-Lukas Else 2021-08-16 11:23:52 +02:00 committed by fguillot
parent ce6fa4c0fc
commit b58a46455b
4 changed files with 8 additions and 1 deletions

View File

@ -169,6 +169,7 @@ func (f *FeedQueryBuilder) GetFeeds() (model.Feeds, error) {
f.hide_globally, f.hide_globally,
f.category_id, f.category_id,
c.title as category_title, c.title as category_title,
c.hide_globally as category_hidden,
fi.icon_id, fi.icon_id,
u.timezone u.timezone
FROM FROM
@ -230,6 +231,7 @@ func (f *FeedQueryBuilder) GetFeeds() (model.Feeds, error) {
&feed.HideGlobally, &feed.HideGlobally,
&feed.Category.ID, &feed.Category.ID,
&feed.Category.Title, &feed.Category.Title,
&feed.Category.HideGlobally,
&iconID, &iconID,
&tz, &tz,
) )

View File

@ -87,7 +87,10 @@
<label><input type="checkbox" name="fetch_via_proxy" value="1" {{ if .form.FetchViaProxy }}checked{{ end }}> {{ t "form.feed.label.fetch_via_proxy" }}</label> <label><input type="checkbox" name="fetch_via_proxy" value="1" {{ if .form.FetchViaProxy }}checked{{ end }}> {{ t "form.feed.label.fetch_via_proxy" }}</label>
{{ end }} {{ end }}
<label><input type="checkbox" name="disabled" value="1" {{ if .form.Disabled }}checked{{ end }}> {{ t "form.feed.label.disabled" }}</label> <label><input type="checkbox" name="disabled" value="1" {{ if .form.Disabled }}checked{{ end }}> {{ t "form.feed.label.disabled" }}</label>
<label><input type="checkbox" name="hide_globally" value="1" {{ if .form.HideGlobally }}checked{{ end }}> {{ t "form.feed.label.hide_globally" }}</label>
{{ if not .form.CategoryHidden }}
<label><input type="checkbox" name="hide_globally" value="1"{{ if .form.HideGlobally }} checked{{ end }}> {{ t "form.feed.label.hide_globally" }}</label>
{{ end }}
<div class="buttons"> <div class="buttons">
<button type="submit" class="button button-primary" data-label-loading="{{ t "form.submit.saving" }}">{{ t "action.update" }}</button> {{ t "action.or" }} <a href="{{ route "feeds" }}">{{ t "action.cancel" }}</a> <button type="submit" class="button button-primary" data-label-loading="{{ t "form.submit.saving" }}">{{ t "action.update" }}</button> {{ t "action.or" }} <a href="{{ route "feeds" }}">{{ t "action.cancel" }}</a>

View File

@ -59,6 +59,7 @@ func (h *handler) showEditFeedPage(w http.ResponseWriter, r *http.Request) {
FetchViaProxy: feed.FetchViaProxy, FetchViaProxy: feed.FetchViaProxy,
Disabled: feed.Disabled, Disabled: feed.Disabled,
HideGlobally: feed.HideGlobally, HideGlobally: feed.HideGlobally,
CategoryHidden: feed.Category.HideGlobally,
} }
sess := session.New(h.store, request.SessionID(r)) sess := session.New(h.store, request.SessionID(r))

View File

@ -31,6 +31,7 @@ type FeedForm struct {
FetchViaProxy bool FetchViaProxy bool
Disabled bool Disabled bool
HideGlobally bool HideGlobally bool
CategoryHidden bool // Category has "hide_globally"
} }
// Merge updates the fields of the given feed. // Merge updates the fields of the given feed.