Просмотр исходного кода

fix(googlereader): fix incorrect read/starred toggling

Add a !read / !starred guard to the else-if branch so that the handler
only toggles the state when the requested value differs from the
current one.
NatsuCamellia 1 месяц назад
Родитель
Сommit
e4338950a0
1 измененных файлов с 2 добавлено и 2 удалено
  1. 2 2
      internal/googlereader/handler.go

+ 2 - 2
internal/googlereader/handler.go

@@ -254,7 +254,7 @@ func (h *greaderHandler) editTagHandler(w http.ResponseWriter, r *http.Request)
 		if read, exists := tags[ReadStream]; exists {
 			if read && entry.Status == model.EntryStatusUnread {
 				readEntryIDs = append(readEntryIDs, entry.ID)
-			} else if entry.Status == model.EntryStatusRead {
+			} else if !read && entry.Status == model.EntryStatusRead {
 				unreadEntryIDs = append(unreadEntryIDs, entry.ID)
 			}
 		}
@@ -264,7 +264,7 @@ func (h *greaderHandler) editTagHandler(w http.ResponseWriter, r *http.Request)
 				// filter the original array
 				entries[n] = entry
 				n++
-			} else if entry.Starred {
+			} else if !starred && entry.Starred {
 				unstarredEntryIDs = append(unstarredEntryIDs, entry.ID)
 			}
 		}