Selaa lähdekoodia

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

Jan-Lukas Else 4 vuotta sitten
vanhempi
commit
b58a46455b

+ 2 - 0
storage/feed_query_builder.go

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

+ 4 - 1
template/templates/views/edit_feed.html

@@ -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>
         {{ 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="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">
             <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>

+ 1 - 0
ui/feed_edit.go

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

+ 1 - 0
ui/form/feed.go

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