add option to disable custom context menu (#1128)

This commit is contained in:
Athou
2023-08-04 08:53:34 +02:00
parent cb779ec494
commit 466846d268
36 changed files with 156 additions and 3 deletions

View File

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

View File

@@ -203,6 +203,7 @@ export interface Settings {
scrollSpeed: number
alwaysScrollToEntry: boolean
markAllAsReadConfirmation: boolean
customContextMenu: boolean
sharingSettings: SharingSettings
}

View File

@@ -34,6 +34,7 @@ export function FeedEntries() {
const scrollMarks = useAppSelector(state => state.user.settings?.scrollMarks)
const scrollingToEntry = useAppSelector(state => state.entries.scrollingToEntry)
const sidebarVisible = useAppSelector(state => state.tree.sidebarVisible)
const customContextMenu = useAppSelector(state => state.user.settings?.customContextMenu)
const { viewMode } = useViewMode()
const dispatch = useAppDispatch()
const { openLinkInBackgroundTab } = useBrowserExtension()
@@ -62,7 +63,7 @@ export function FeedEntries() {
const contextMenu = useContextMenu()
const headerRightClicked = (entry: ExpendableEntry, event: React.MouseEvent) => {
if (event.shiftKey) return
if (event.shiftKey || !customContextMenu) return
event.preventDefault()
contextMenu.show({

View File

@@ -3,6 +3,7 @@ import { Divider, Select, SimpleGrid, Stack, Switch } from "@mantine/core"
import { Constants } from "app/constants"
import {
changeAlwaysScrollToEntry,
changeCustomContextMenu,
changeLanguage,
changeMarkAllAsReadConfirmation,
changeScrollMarks,
@@ -21,6 +22,7 @@ export function DisplaySettings() {
const scrollMarks = useAppSelector(state => state.user.settings?.scrollMarks)
const alwaysScrollToEntry = useAppSelector(state => state.user.settings?.alwaysScrollToEntry)
const markAllAsReadConfirmation = useAppSelector(state => state.user.settings?.markAllAsReadConfirmation)
const customContextMenu = useAppSelector(state => state.user.settings?.customContextMenu)
const sharingSettings = useAppSelector(state => state.user.settings?.sharingSettings)
const dispatch = useAppDispatch()
@@ -66,6 +68,12 @@ export function DisplaySettings() {
onChange={e => dispatch(changeMarkAllAsReadConfirmation(e.currentTarget.checked))}
/>
<Switch
label={<Trans>Show CommaFeed's own context menu on right click</Trans>}
checked={customContextMenu}
onChange={e => dispatch(changeCustomContextMenu(e.currentTarget.checked))}
/>
<Divider label={<Trans>Sharing sites</Trans>} labelPosition="center" />
<SimpleGrid cols={2}>

View File

@@ -727,6 +727,10 @@ msgstr "مشاركة المواقع"
msgid "Shift"
msgstr "الحلقة"
#: src/components/settings/DisplaySettings.tsx
msgid "Show CommaFeed's own context menu on right click"
msgstr ""
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "Compartir llocs"
msgid "Shift"
msgstr "canvi"
#: src/components/settings/DisplaySettings.tsx
msgid "Show CommaFeed's own context menu on right click"
msgstr ""
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "Stránky pro sdílení"
msgid "Shift"
msgstr "Směna"
#: src/components/settings/DisplaySettings.tsx
msgid "Show CommaFeed's own context menu on right click"
msgstr ""
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "Rhannu gwefannau"
msgid "Shift"
msgstr "shifft"
#: src/components/settings/DisplaySettings.tsx
msgid "Show CommaFeed's own context menu on right click"
msgstr ""
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "Delingssider"
msgid "Shift"
msgstr "Skift"
#: src/components/settings/DisplaySettings.tsx
msgid "Show CommaFeed's own context menu on right click"
msgstr ""
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "Seiten teilen"
msgid "Shift"
msgstr "Verschiebung"
#: src/components/settings/DisplaySettings.tsx
msgid "Show CommaFeed's own context menu on right click"
msgstr ""
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "Sharing sites"
msgid "Shift"
msgstr "Shift"
#: src/components/settings/DisplaySettings.tsx
msgid "Show CommaFeed's own context menu on right click"
msgstr "Show CommaFeed's own context menu on right click"
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr "Show confirmation when marking all entries as read"

View File

@@ -727,6 +727,10 @@ msgstr "Compartir sitios"
msgid "Shift"
msgstr "Cambio"
#: src/components/settings/DisplaySettings.tsx
msgid "Show CommaFeed's own context menu on right click"
msgstr ""
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "اشتراک گذاری سایت ها"
msgid "Shift"
msgstr "شیفت"
#: src/components/settings/DisplaySettings.tsx
msgid "Show CommaFeed's own context menu on right click"
msgstr ""
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "Sivustojen jakaminen"
msgid "Shift"
msgstr "Vaihto"
#: src/components/settings/DisplaySettings.tsx
msgid "Show CommaFeed's own context menu on right click"
msgstr ""
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "Sites de partage"
msgid "Shift"
msgstr "Maj"
#: src/components/settings/DisplaySettings.tsx
msgid "Show CommaFeed's own context menu on right click"
msgstr ""
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "Compartir sitios"
msgid "Shift"
msgstr "quendas"
#: src/components/settings/DisplaySettings.tsx
msgid "Show CommaFeed's own context menu on right click"
msgstr ""
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "Webhelyek megosztása"
msgid "Shift"
msgstr ""
#: src/components/settings/DisplaySettings.tsx
msgid "Show CommaFeed's own context menu on right click"
msgstr ""
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "Berbagi situs"
msgid "Shift"
msgstr "Pergeseran"
#: src/components/settings/DisplaySettings.tsx
msgid "Show CommaFeed's own context menu on right click"
msgstr ""
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "Condivisione di siti"
msgid "Shift"
msgstr "Cambio"
#: src/components/settings/DisplaySettings.tsx
msgid "Show CommaFeed's own context menu on right click"
msgstr ""
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "共有サイト"
msgid "Shift"
msgstr "シフト"
#: src/components/settings/DisplaySettings.tsx
msgid "Show CommaFeed's own context menu on right click"
msgstr ""
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "사이트 공유"
msgid "Shift"
msgstr "시프트"
#: src/components/settings/DisplaySettings.tsx
msgid "Show CommaFeed's own context menu on right click"
msgstr ""
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "Berkongsi tapak"
msgid "Shift"
msgstr "Anjakan"
#: src/components/settings/DisplaySettings.tsx
msgid "Show CommaFeed's own context menu on right click"
msgstr ""
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "Delingssider"
msgid "Shift"
msgstr "Skift"
#: src/components/settings/DisplaySettings.tsx
msgid "Show CommaFeed's own context menu on right click"
msgstr ""
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "Sites delen"
msgid "Shift"
msgstr ""
#: src/components/settings/DisplaySettings.tsx
msgid "Show CommaFeed's own context menu on right click"
msgstr ""
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "Delingssider"
msgid "Shift"
msgstr "Skift"
#: src/components/settings/DisplaySettings.tsx
msgid "Show CommaFeed's own context menu on right click"
msgstr ""
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "Udostępnianie witryn"
msgid "Shift"
msgstr "zmiana"
#: src/components/settings/DisplaySettings.tsx
msgid "Show CommaFeed's own context menu on right click"
msgstr ""
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "Compartilhando sites"
msgid "Shift"
msgstr "Mudar"
#: src/components/settings/DisplaySettings.tsx
msgid "Show CommaFeed's own context menu on right click"
msgstr ""
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "Обмен сайтами"
msgid "Shift"
msgstr "Сдвиг"
#: src/components/settings/DisplaySettings.tsx
msgid "Show CommaFeed's own context menu on right click"
msgstr ""
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "Zdieľanie stránok"
msgid "Shift"
msgstr "Smena"
#: src/components/settings/DisplaySettings.tsx
msgid "Show CommaFeed's own context menu on right click"
msgstr ""
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "Delningssajter"
msgid "Shift"
msgstr "Skift"
#: src/components/settings/DisplaySettings.tsx
msgid "Show CommaFeed's own context menu on right click"
msgstr ""
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "Siteleri paylaşma"
msgid "Shift"
msgstr "Vardiya"
#: src/components/settings/DisplaySettings.tsx
msgid "Show CommaFeed's own context menu on right click"
msgstr ""
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""

View File

@@ -727,6 +727,10 @@ msgstr "共享站点"
msgid "Shift"
msgstr "换档"
#: src/components/settings/DisplaySettings.tsx
msgid "Show CommaFeed's own context menu on right click"
msgstr ""
#: src/components/settings/DisplaySettings.tsx
msgid "Show confirmation when marking all entries as read"
msgstr ""

View File

@@ -67,6 +67,7 @@ public class UserSettings extends AbstractModel {
private boolean alwaysScrollToEntry;
private boolean markAllAsReadConfirmation;
private boolean customContextMenu;
private boolean email;
private boolean gmail;

View File

@@ -41,6 +41,9 @@ public class Settings implements Serializable {
@ApiModelProperty(value = "ask for confirmation when marking all entries as read", required = true)
private boolean markAllAsReadConfirmation;
@ApiModelProperty(value = "show commafeed's own context menu on right click", required = true)
private boolean customContextMenu;
@ApiModelProperty(value = "sharing settings", required = true)
private SharingSettings sharingSettings = new SharingSettings();

View File

@@ -105,6 +105,7 @@ public class UserREST {
s.setScrollSpeed(settings.getScrollSpeed());
s.setAlwaysScrollToEntry(settings.isAlwaysScrollToEntry());
s.setMarkAllAsReadConfirmation(settings.isMarkAllAsReadConfirmation());
s.setCustomContextMenu(settings.isCustomContextMenu());
} else {
s.setReadingMode(ReadingMode.unread.name());
s.setReadingOrder(ReadingOrder.desc.name());
@@ -124,6 +125,7 @@ public class UserREST {
s.setScrollSpeed(400);
s.setAlwaysScrollToEntry(false);
s.setMarkAllAsReadConfirmation(true);
s.setCustomContextMenu(true);
}
return Response.ok(s).build();
}
@@ -151,6 +153,7 @@ public class UserREST {
s.setScrollSpeed(settings.getScrollSpeed());
s.setAlwaysScrollToEntry(settings.isAlwaysScrollToEntry());
s.setMarkAllAsReadConfirmation(settings.isMarkAllAsReadConfirmation());
s.setCustomContextMenu(settings.isCustomContextMenu());
s.setEmail(settings.getSharingSettings().isEmail());
s.setGmail(settings.getSharingSettings().isGmail());

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
<changeSet id="mark-all-as-read-confirmation" author="athou">
<addColumn tableName="USERSETTINGS">
@@ -11,4 +11,12 @@
</addColumn>
</changeSet>
<changeSet id="custom-context-menu" author="athou">
<addColumn tableName="USERSETTINGS">
<column name="customContextMenu" type="BOOLEAN" defaultValueBoolean="true">
<constraints nullable="false" />
</column>
</addColumn>
</changeSet>
</databaseChangeLog>