mirror of
https://github.com/yang991178/fluent-reader.git
synced 2025-02-06 12:23:24 +01:00
fix negative unread counts #216
This commit is contained in:
parent
82a6a2c170
commit
4e842e6420
@ -312,7 +312,8 @@ const markUnreadDone = (item: RSSItem): ItemActionTypes => ({
|
|||||||
})
|
})
|
||||||
|
|
||||||
export function markRead(item: RSSItem): AppThunk {
|
export function markRead(item: RSSItem): AppThunk {
|
||||||
return dispatch => {
|
return (dispatch, getState) => {
|
||||||
|
item = getState().items[item._id]
|
||||||
if (!item.hasRead) {
|
if (!item.hasRead) {
|
||||||
db.itemsDB
|
db.itemsDB
|
||||||
.update(db.items)
|
.update(db.items)
|
||||||
@ -377,7 +378,8 @@ export function markAllRead(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function markUnread(item: RSSItem): AppThunk {
|
export function markUnread(item: RSSItem): AppThunk {
|
||||||
return dispatch => {
|
return (dispatch, getState) => {
|
||||||
|
item = getState().items[item._id]
|
||||||
if (item.hasRead) {
|
if (item.hasRead) {
|
||||||
db.itemsDB
|
db.itemsDB
|
||||||
.update(db.items)
|
.update(db.items)
|
||||||
|
@ -483,7 +483,7 @@ export function sourceReducer(
|
|||||||
}
|
}
|
||||||
case MARK_ALL_READ: {
|
case MARK_ALL_READ: {
|
||||||
let nextState = { ...state }
|
let nextState = { ...state }
|
||||||
action.sids.map((sid, i) => {
|
action.sids.forEach((sid) => {
|
||||||
nextState[sid] = {
|
nextState[sid] = {
|
||||||
...state[sid],
|
...state[sid],
|
||||||
unreadCount: action.time ? state[sid].unreadCount : 0,
|
unreadCount: action.time ? state[sid].unreadCount : 0,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user