mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
add an option to navigate to the next unread category/feed when marking all as read (#1807)
This commit is contained in:
@@ -3,7 +3,7 @@ import { client } from "app/client"
|
||||
import { Constants } from "app/constants"
|
||||
import { type EntrySource, type EntrySourceType, entriesSlice, setMarkAllAsReadConfirmationDialogOpen, setSearch } from "app/entries/slice"
|
||||
import type { RootState } from "app/store"
|
||||
import { reloadTree } from "app/tree/thunks"
|
||||
import { reloadTree, selectNextUnreadTreeItem } from "app/tree/thunks"
|
||||
import type { Entry, MarkRequest, TagRequest } from "app/types"
|
||||
import { reloadTags } from "app/user/thunks"
|
||||
import { scrollToWithCallback } from "app/utils"
|
||||
@@ -130,11 +130,12 @@ export const markAllAsReadWithConfirmationIfRequired = createAppAsyncThunk(
|
||||
const source = state.entries.source
|
||||
const entriesTimestamp = state.entries.timestamp ?? Date.now()
|
||||
const markAllAsReadConfirmation = state.user.settings?.markAllAsReadConfirmation
|
||||
const markAllAsReadNavigateToNextUnread = state.user.settings?.markAllAsReadNavigateToNextUnread
|
||||
|
||||
if (markAllAsReadConfirmation) {
|
||||
thunkApi.dispatch(setMarkAllAsReadConfirmationDialogOpen(true))
|
||||
} else {
|
||||
thunkApi.dispatch(
|
||||
await thunkApi.dispatch(
|
||||
markAllEntries({
|
||||
sourceType: source.type,
|
||||
req: {
|
||||
@@ -145,6 +146,9 @@ export const markAllAsReadWithConfirmationIfRequired = createAppAsyncThunk(
|
||||
},
|
||||
})
|
||||
)
|
||||
const isAllCategorySelected = source.type === "category" && source.id === Constants.categories.all.id
|
||||
if (markAllAsReadNavigateToNextUnread && !isAllCategorySelected)
|
||||
await thunkApi.dispatch(selectNextUnreadTreeItem({ direction: "forward" }))
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user