Repository: gitify-app/gitify
Pull request #810 (2024-02-22 17:03:06)

chore: remove `delayedHideAppIcon()`
It looks like the bug has been resolved; I'm running MacOS and I've had no issues with `showDockIcon: false`.

I think we can simply drop this function (I added `showDockIcon: false` to make it more explicit, even though it was already the default value)

setchy: Nice. Any hints in a changelog at when this may have been resolved?
adufr: > Nice. Any hints in a changelog at when this may have been resolved?

Nope, [nothing there](https://github.com/max-mapper/menubar/blob/master/CHANGELOG.md).

Patch:
diff --git a/main.js b/main.js
index 56ffc84c..a6d61e19 100644
--- a/main.js
+++ b/main.js
@@ -4,7 +4,7 @@ const { autoUpdater } = require('electron-updater');
 const { onFirstRunMaybe } = require('./first-run');
 const path = require('path');
 
-require('@electron/remote/main').initialize()
+require('@electron/remote/main').initialize();
 
 app.setAppUserModelId('com.electron.gitify');
 
@@ -12,7 +12,7 @@ const iconIdle = path.join(
   __dirname,
   'assets',
   'images',
-  'tray-idleTemplate.png'
+  'tray-idleTemplate.png',
 );
 const iconActive = path.join(__dirname, 'assets', 'images', 'tray-active.png');
 
@@ -30,16 +30,6 @@ const browserWindowOpts = {
   },
 };
 
-const delayedHideAppIcon = () => {
-  if (app.dock && app.dock.hide) {
-    // Setting a timeout because the showDockIcon is not currently working
-    // See more at https://github.com/maxogden/menubar/issues/306
-    setTimeout(() => {
-      app.dock.hide();
-    }, 1500);
-  }
-};
-
 app.on('ready', async () => {
   await onFirstRunMaybe();
 });
@@ -49,11 +39,10 @@ const menubarApp = menubar({
   index: `file://${__dirname}/index.html`,
   browserWindow: browserWindowOpts,
   preloadWindow: true,
+  showDockIcon: false,
 });
 
 menubarApp.on('ready', () => {
-  delayedHideAppIcon();
-
   menubarApp.tray.setIgnoreDoubleClickEvents(true);
 
   autoUpdater.checkForUpdatesAndNotify();
@@ -100,7 +89,7 @@ menubarApp.on('ready', () => {
     const trayBounds = menubarApp.tray.getBounds();
     menubarApp.window.setSize(
       browserWindowOpts.width,
-      browserWindowOpts.height
+      browserWindowOpts.height,
     );
     menubarApp.positioner.move('trayCenter', trayBounds);
     menubarApp.window.resizable = false;
diff --git a/src/typesGithub.ts b/src/typesGithub.ts
index 98dfa7f5..fe80ff92 100644
--- a/src/typesGithub.ts
+++ b/src/typesGithub.ts
@@ -1,16 +1,17 @@
 export type Reason =
   | 'assign'
   | 'author'
+  | 'ci_activity'
   | 'comment'
   | 'invitation'
   | 'manual'
+  | 'member_feature_requested'
   | 'mention'
   | 'review_requested'
   | 'security_alert'
   | 'state_change'
   | 'subscribed'
-  | 'team_mention'
-  | 'ci_activity';
+  | 'team_mention';
 
 export type SubjectType =
   | 'CheckSuite'
@@ -125,9 +126,9 @@ export interface Owner {
 
 export interface Subject {
   title: string;
-  url?: string;
-  state: StateType;
-  latest_comment_url?: string;
+  url: string | null;
+  state?: StateType;
+  latest_comment_url: string | null;
   type: SubjectType;
 }
 
diff --git a/src/utils/github-api.ts b/src/utils/github-api.ts
index ea1adca0..f5b45395 100644
--- a/src/utils/github-api.ts
+++ b/src/utils/github-api.ts
@@ -25,6 +25,7 @@ const DESCRIPTIONS = {
     COMMENT: 'You commented on the thread.',
     INVITATION: 'You accepted an invitation to contribute to the repository.',
     MANUAL: 'You subscribed to the thread (via an issue or pull request).',
+    MEMBER_FEATURE_REQUESTED: 'Organization members have requested to enable a feature such as Draft Pull Requests or CoPilot.',
     MENTION: 'You were specifically @mentioned in the content.',
     REVIEW_REQUESTED: "You, or a team you're a member of, were requested to review a pull request.",
     SECURITY_ALERT: 'GitHub discovered a security vulnerability in your repository.',
@@ -51,6 +52,8 @@ export function formatReason(reason: Reason): {
       return { type: 'Invitation', description: DESCRIPTIONS['INVITATION'] };
     case 'manual':
       return { type: 'Manual', description: DESCRIPTIONS['MANUAL'] };
+    case 'member_feature_requested':
+      return { type: 'Member Feature Requested', description: DESCRIPTIONS['MEMBER_FEATURE_REQUESTED'] };
     case 'mention':
       return { type: 'Mention', description: DESCRIPTIONS['MENTION'] };
     case 'review_requested':


Test patch:
diff --git a/src/utils/__snapshots__/github-api.test.ts.snap b/src/utils/__snapshots__/github-api.test.ts.snap
index f2aa1166..09d81888 100644
--- a/src/utils/__snapshots__/github-api.test.ts.snap
+++ b/src/utils/__snapshots__/github-api.test.ts.snap
@@ -31,76 +31,83 @@ exports[`./utils/github-api.ts should format the notification reason 2`] = `
 `;
 
 exports[`./utils/github-api.ts should format the notification reason 3`] = `
+{
+  "description": "A GitHub Actions workflow run was triggered for your repository",
+  "type": "Workflow Run",
+}
+`;
+
+exports[`./utils/github-api.ts should format the notification reason 4`] = `
 {
   "description": "You commented on the thread.",
   "type": "Comment",
 }
 `;
 
-exports[`./utils/github-api.ts should format the notification reason 4`] = `
+exports[`./utils/github-api.ts should format the notification reason 5`] = `
 {
   "description": "You accepted an invitation to contribute to the repository.",
   "type": "Invitation",
 }
 `;
 
-exports[`./utils/github-api.ts should format the notification reason 5`] = `
+exports[`./utils/github-api.ts should format the notification reason 6`] = `
 {
   "description": "You subscribed to the thread (via an issue or pull request).",
   "type": "Manual",
 }
 `;
 
-exports[`./utils/github-api.ts should format the notification reason 6`] = `
+exports[`./utils/github-api.ts should format the notification reason 7`] = `
+{
+  "description": "Organization members have requested to enable a feature such as Draft Pull Requests or CoPilot.",
+  "type": "Member Feature Requested",
+}
+`;
+
+exports[`./utils/github-api.ts should format the notification reason 8`] = `
 {
   "description": "You were specifically @mentioned in the content.",
   "type": "Mention",
 }
 `;
 
-exports[`./utils/github-api.ts should format the notification reason 7`] = `
+exports[`./utils/github-api.ts should format the notification reason 9`] = `
 {
   "description": "You, or a team you're a member of, were requested to review a pull request.",
   "type": "Review Requested",
 }
 `;
 
-exports[`./utils/github-api.ts should format the notification reason 8`] = `
+exports[`./utils/github-api.ts should format the notification reason 10`] = `
 {
   "description": "GitHub discovered a security vulnerability in your repository.",
   "type": "Security Alert",
 }
 `;
 
-exports[`./utils/github-api.ts should format the notification reason 9`] = `
+exports[`./utils/github-api.ts should format the notification reason 11`] = `
 {
   "description": "You changed the thread state (for example, closing an issue or merging a pull request).",
   "type": "State Change",
 }
 `;
 
-exports[`./utils/github-api.ts should format the notification reason 10`] = `
+exports[`./utils/github-api.ts should format the notification reason 12`] = `
 {
   "description": "You're watching the repository.",
   "type": "Subscribed",
 }
 `;
 
-exports[`./utils/github-api.ts should format the notification reason 11`] = `
+exports[`./utils/github-api.ts should format the notification reason 13`] = `
 {
   "description": "You were on a team that was mentioned.",
   "type": "Team Mention",
 }
 `;
 
-exports[`./utils/github-api.ts should format the notification reason 12`] = `
-{
-  "description": "A GitHub Actions workflow run was triggered for your repository",
-  "type": "Workflow Run",
-}
-`;
-
-exports[`./utils/github-api.ts should format the notification reason 13`] = `
+exports[`./utils/github-api.ts should format the notification reason 14`] = `
 {
   "description": "The reason for this notification is not supported by the app.",
   "type": "Unknown",
diff --git a/src/utils/github-api.test.ts b/src/utils/github-api.test.ts
index c0b31fb4..8a055d37 100644
--- a/src/utils/github-api.test.ts
+++ b/src/utils/github-api.test.ts
@@ -9,16 +9,17 @@ describe('./utils/github-api.ts', () => {
   it('should format the notification reason', () => {
     expect(formatReason('assign')).toMatchSnapshot();
     expect(formatReason('author')).toMatchSnapshot();
+    expect(formatReason('ci_activity')).toMatchSnapshot();
     expect(formatReason('comment')).toMatchSnapshot();
     expect(formatReason('invitation')).toMatchSnapshot();
     expect(formatReason('manual')).toMatchSnapshot();
+    expect(formatReason('member_feature_requested')).toMatchSnapshot();
     expect(formatReason('mention')).toMatchSnapshot();
     expect(formatReason('review_requested')).toMatchSnapshot();
     expect(formatReason('security_alert')).toMatchSnapshot();
     expect(formatReason('state_change')).toMatchSnapshot();
     expect(formatReason('subscribed')).toMatchSnapshot();
     expect(formatReason('team_mention')).toMatchSnapshot();
-    expect(formatReason('ci_activity')).toMatchSnapshot();
     expect(formatReason('something_else_unknown' as Reason)).toMatchSnapshot();
   });