add setting to disable mark as read confirmation (#1110)

This commit is contained in:
Athou
2023-08-03 08:46:43 +02:00
parent da6f2050f9
commit cb779ec494
37 changed files with 179 additions and 8 deletions

View File

@@ -91,6 +91,17 @@ export const changeAlwaysScrollToEntry = createAsyncThunk<
if (!settings) return
client.user.saveSettings({ ...settings, alwaysScrollToEntry })
})
export const changeMarkAllAsReadConfirmation = createAsyncThunk<
void,
boolean,
{
state: RootState
}
>("settings/markAllAsReadConfirmation", (markAllAsReadConfirmation, thunkApi) => {
const { settings } = thunkApi.getState().user
if (!settings) return
client.user.saveSettings({ ...settings, markAllAsReadConfirmation })
})
export const changeSharingSetting = createAsyncThunk<
void,
{ site: keyof SharingSettings; value: boolean },
@@ -151,6 +162,10 @@ export const userSlice = createSlice({
if (!state.settings) return
state.settings.alwaysScrollToEntry = action.meta.arg
})
builder.addCase(changeMarkAllAsReadConfirmation.pending, (state, action) => {
if (!state.settings) return
state.settings.markAllAsReadConfirmation = action.meta.arg
})
builder.addCase(changeSharingSetting.pending, (state, action) => {
if (!state.settings) return
state.settings.sharingSettings[action.meta.arg.site] = action.meta.arg.value
@@ -162,6 +177,7 @@ export const userSlice = createSlice({
changeShowRead.fulfilled,
changeScrollMarks.fulfilled,
changeAlwaysScrollToEntry.fulfilled,
changeMarkAllAsReadConfirmation.fulfilled,
changeSharingSetting.fulfilled
),
() => {

View File

@@ -202,6 +202,7 @@ export interface Settings {
customJs?: string
scrollSpeed: number
alwaysScrollToEntry: boolean
markAllAsReadConfirmation: boolean
sharingSettings: SharingSettings
}