Repository: gitify-app/gitify (ts)

Issue:
Remove "Mark as read on click" Setting, which has no effect now
See https://github.com/gitify-app/gitify/pull/706#issuecomment-1900315876

Pull request description:
refactor: remove now redundant `mark as read on click` functionality
Closes #712 

Patch:
diff --git a/src/__mocks__/mock-state.ts b/src/__mocks__/mock-state.ts
index 91043e1a..accdabd5 100644
--- a/src/__mocks__/mock-state.ts
+++ b/src/__mocks__/mock-state.ts
@@ -16,7 +16,6 @@ export const mockSettings: SettingsState = {
   participating: false,
   playSound: true,
   showNotifications: true,
-  markOnClick: false,
   openAtStartup: false,
   appearance: Appearance.SYSTEM,
   colors: false,
diff --git a/src/components/NotificationRow.tsx b/src/components/NotificationRow.tsx
index 07f533f8..612a3bbb 100644
--- a/src/components/NotificationRow.tsx
+++ b/src/components/NotificationRow.tsx
@@ -25,10 +25,6 @@ export const NotificationRow: React.FC<IProps> = ({
 
   const pressTitle = useCallback(() => {
     openBrowser();
-
-    if (settings.markOnClick) {
-      markNotification(notification.id, hostname);
-    }
   }, [settings]);
 
   const openBrowser = useCallback(
diff --git a/src/context/App.tsx b/src/context/App.tsx
index 34543cf3..60197bca 100644
--- a/src/context/App.tsx
+++ b/src/context/App.tsx
@@ -34,7 +34,6 @@ export const defaultSettings: SettingsState = {
   participating: false,
   playSound: true,
   showNotifications: true,
-  markOnClick: false,
   openAtStartup: false,
   appearance: Appearance.SYSTEM,
   colors: false,
diff --git a/src/routes/Settings.tsx b/src/routes/Settings.tsx
index 1e38762a..433c0e4e 100644
--- a/src/routes/Settings.tsx
+++ b/src/routes/Settings.tsx
@@ -139,12 +139,6 @@ export const SettingsRoute: React.FC = () => {
             updateSetting('showNotifications', evt.target.checked)
           }
         />
-        <FieldCheckbox
-          name="onClickMarkAsRead"
-          label="Mark as read on click"
-          checked={settings.markOnClick}
-          onChange={(evt) => updateSetting('markOnClick', evt.target.checked)}
-        />
         {!isLinux && (
           <FieldCheckbox
             name="openAtStartUp"
diff --git a/src/types.ts b/src/types.ts
index d3e881b9..8aac5134 100644
--- a/src/types.ts
+++ b/src/types.ts
@@ -10,7 +10,6 @@ export interface SettingsState {
   participating: boolean;
   playSound: boolean;
   showNotifications: boolean;
-  markOnClick: boolean;
   openAtStartup: boolean;
   appearance: Appearance;
   colors: boolean;


Test patch:
diff --git a/src/components/NotificationRow.test.tsx b/src/components/NotificationRow.test.tsx
index e9bfe16a..cb66ae0c 100644
--- a/src/components/NotificationRow.test.tsx
+++ b/src/components/NotificationRow.test.tsx
@@ -41,7 +41,7 @@ describe('components/Notification.js', () => {
     const { getByRole } = render(
       <AppContext.Provider
         value={{
-          settings: { ...mockSettings, markOnClick: true },
+          settings: mockSettings,
           markNotification,
           accounts: mockAccounts,
         }}
@@ -54,31 +54,6 @@ describe('components/Notification.js', () => {
     expect(shell.openExternal).toHaveBeenCalledTimes(1);
   });
 
-  it('should open a notification in browser & mark it as read', () => {
-    const markNotification = jest.fn();
-
-    const props = {
-      notification: mockedSingleNotification,
-      hostname: 'github.com',
-    };
-
-    const { getByRole } = render(
-      <AppContext.Provider
-        value={{
-          settings: { ...mockSettings, markOnClick: true },
-          markNotification,
-          accounts: mockAccounts,
-        }}
-      >
-        <NotificationRow {...props} />
-      </AppContext.Provider>,
-    );
-
-    fireEvent.click(getByRole('main'));
-    expect(shell.openExternal).toHaveBeenCalledTimes(1);
-    expect(markNotification).toHaveBeenCalledTimes(1);
-  });
-
   it('should mark a notification as read', () => {
     const markNotification = jest.fn();
 
@@ -90,7 +65,7 @@ describe('components/Notification.js', () => {
     const { getByTitle } = render(
       <AppContext.Provider
         value={{
-          settings: { ...mockSettings, markOnClick: false },
+          settings: mockSettings,
           accounts: mockAccounts,
         }}
       >
diff --git a/src/components/Sidebar.test.tsx b/src/components/Sidebar.test.tsx
index 94c5bf87..6582f917 100644
--- a/src/components/Sidebar.test.tsx
+++ b/src/components/Sidebar.test.tsx
@@ -35,7 +35,7 @@ describe('components/Sidebar.tsx', () => {
     const tree = TestRenderer.create(
       <AppContext.Provider
         value={{
-          settings: { ...mockSettings },
+          settings: mockSettings,
           notifications: mockedAccountNotifications,
         }}
       >
diff --git a/src/context/App.test.tsx b/src/context/App.test.tsx
index 05e00520..d0b45e63 100644
--- a/src/context/App.test.tsx
+++ b/src/context/App.test.tsx
@@ -259,7 +259,6 @@ describe('context/App.tsx', () => {
       { enterpriseAccounts: [], token: null, user: null },
       {
         appearance: 'SYSTEM',
-        markOnClick: false,
         openAtStartup: false,
         participating: true,
         playSound: true,
@@ -297,7 +296,6 @@ describe('context/App.tsx', () => {
       { enterpriseAccounts: [], token: null, user: null },
       {
         appearance: 'SYSTEM',
-        markOnClick: false,
         openAtStartup: true,
         participating: false,
         playSound: true,
diff --git a/src/routes/Settings.test.tsx b/src/routes/Settings.test.tsx
index 46d31292..d82baf90 100644
--- a/src/routes/Settings.test.tsx
+++ b/src/routes/Settings.test.tsx
@@ -182,34 +182,6 @@ describe('routes/Settings.tsx', () => {
     expect(updateSetting).toHaveBeenCalledWith('showNotifications', false);
   });
 
-  it('should toggle the onClickMarkAsRead checkbox', async () => {
-    let getByLabelText;
-
-    await act(async () => {
-      const { getByLabelText: getByLabelTextLocal } = render(
-        <AppContext.Provider
-          value={{
-            settings: mockSettings,
-            accounts: mockAccounts,
-            updateSetting,
-          }}
-        >
-          <MemoryRouter>
-            <SettingsRoute />
-          </MemoryRouter>
-        </AppContext.Provider>,
-      );
-      getByLabelText = getByLabelTextLocal;
-    });
-
-    fireEvent.click(getByLabelText('Mark as read on click'), {
-      target: { checked: true },
-    });
-
-    expect(updateSetting).toHaveBeenCalledTimes(1);
-    expect(updateSetting).toHaveBeenCalledWith('markOnClick', false);
-  });
-
   it('should toggle the openAtStartup checkbox', async () => {
     let getByLabelText;
 
diff --git a/src/routes/__snapshots__/Settings.test.tsx.snap b/src/routes/__snapshots__/Settings.test.tsx.snap
index fe010b53..a11bcec6 100644
--- a/src/routes/__snapshots__/Settings.test.tsx.snap
+++ b/src/routes/__snapshots__/Settings.test.tsx.snap
@@ -230,29 +230,6 @@ exports[`routes/Settings.tsx should render itself & its children 1`] = `
         </label>
       </div>
     </div>
-    <div
-      class="flex items-start mt-1 mb-3"
-    >
-      <div
-        class="flex items-center h-5"
-      >
-        <input
-          class="focus:ring-indigo-500 h-4 w-4 text-indigo-600 border-gray-300 rounded"
-          id="onClickMarkAsRead"
-          type="checkbox"
-        />
-      </div>
-      <div
-        class="ml-3 text-sm"
-      >
-        <label
-          class="font-medium text-gray-700 dark:text-gray-200"
-          for="onClickMarkAsRead"
-        >
-          Mark as read on click
-        </label>
-      </div>
-    </div>
     <div
       class="flex items-start mt-1 mb-3"
     >