Skip to content

Instantly share code, notes, and snippets.

@Pagliacii
Last active October 3, 2024 11:45
Show Gist options
  • Save Pagliacii/0fb58e077f73cc13212a9faa04c43ebd to your computer and use it in GitHub Desktop.
Save Pagliacii/0fb58e077f73cc13212a9faa04c43ebd to your computer and use it in GitHub Desktop.
Fix invisible notification in your GitHub inbox

Where are unread notifications?

Sometimes you may see a blue dot on your GitHub avatar, but can't find what unread notification it's referring to.

This is a trivial UI bug. You can see these "invisible" notifications in the terminal by using gh.

Ref.

Show me

After you've authorized your account, you could see the unread notifications by running:

gh api notifications -H "Accept: application/vnd.github.v3+json"

Then, you can update the last_read_at field to mark notifications as read:

gh api notifications -H "Accept: application/vnd.github.v3+json" -X PUT -f last_read_at=2024-08-07T00:00:00Z

And voila, the blue dot should disappear!

Details

One such example is notifications from removed repositories.

Here's a sample output showing an "invisible" notification:

[
  {
    "id": "11206978932",
    "unread": true,
    "reason": "subscribed",
    "updated_at": "2024-06-23T03:29:59Z",
    "last_read_at": null,
    "subject": {
      "title": "Invitation to join overzealousquant/Quant-Leaks-Interview from overzealousquant",
      "url": null,
      "latest_comment_url": null,
      "type": "RepositoryInvitation"
    },
    "repository": {
      "id": 817075042,
      "node_id": "R_kgDOMLOTYg",
      "name": "Quant-Leaks-Interview",
      "full_name": "overzealousquant/Quant-Leaks-Interview",
      "private": true,
      "owner": {
        "login": "overzealousquant",
        "id": 170038529,
        "node_id": "U_kgDOCiKVAQ",
        "avatar_url": "https://avatars.githubusercontent.com/u/170038529?v=4",
        "gravatar_id": "",
        "url": "https://api.github.com/users/overzealousquant",
        "html_url": "https://github.com/overzealousquant",
        "followers_url": "https://api.github.com/users/overzealousquant/followers",
        "following_url": "https://api.github.com/users/overzealousquant/following{/other_user}",
        "gists_url": "https://api.github.com/users/overzealousquant/gists{/gist_id}",
        "starred_url": "https://api.github.com/users/overzealousquant/starred{/owner}{/repo}",
        "subscriptions_url": "https://api.github.com/users/overzealousquant/subscriptions",
        "organizations_url": "https://api.github.com/users/overzealousquant/orgs",
        "repos_url": "https://api.github.com/users/overzealousquant/repos",
        "events_url": "https://api.github.com/users/overzealousquant/events{/privacy}",
        "received_events_url": "https://api.github.com/users/overzealousquant/received_events",
        "type": "User",
        "site_admin": false
      },
      "html_url": "https://github.com/overzealousquant/Quant-Leaks-Interview",
      "description": null,
      "fork": false,
      "url": "https://api.github.com/repos/overzealousquant/Quant-Leaks-Interview",
      "forks_url": "https://api.github.com/repos/overzealousquant/Quant-Leaks-Interview/forks",
      "keys_url": "https://api.github.com/repos/overzealousquant/Quant-Leaks-Interview/keys{/key_id}",
      "collaborators_url": "https://api.github.com/repos/overzealousquant/Quant-Leaks-Interview/collaborators{/collaborator}",
      "teams_url": "https://api.github.com/repos/overzealousquant/Quant-Leaks-Interview/teams",
      "hooks_url": "https://api.github.com/repos/overzealousquant/Quant-Leaks-Interview/hooks",
      "issue_events_url": "https://api.github.com/repos/overzealousquant/Quant-Leaks-Interview/issues/events{/number}",
      "events_url": "https://api.github.com/repos/overzealousquant/Quant-Leaks-Interview/events",
      "assignees_url": "https://api.github.com/repos/overzealousquant/Quant-Leaks-Interview/assignees{/user}",
      "branches_url": "https://api.github.com/repos/overzealousquant/Quant-Leaks-Interview/branches{/branch}",
      "tags_url": "https://api.github.com/repos/overzealousquant/Quant-Leaks-Interview/tags",
      "blobs_url": "https://api.github.com/repos/overzealousquant/Quant-Leaks-Interview/git/blobs{/sha}",
      "git_tags_url": "https://api.github.com/repos/overzealousquant/Quant-Leaks-Interview/git/tags{/sha}",
      "git_refs_url": "https://api.github.com/repos/overzealousquant/Quant-Leaks-Interview/git/refs{/sha}",
      "trees_url": "https://api.github.com/repos/overzealousquant/Quant-Leaks-Interview/git/trees{/sha}",
      "statuses_url": "https://api.github.com/repos/overzealousquant/Quant-Leaks-Interview/statuses/{sha}",
      "languages_url": "https://api.github.com/repos/overzealousquant/Quant-Leaks-Interview/languages",
      "stargazers_url": "https://api.github.com/repos/overzealousquant/Quant-Leaks-Interview/stargazers",
      "contributors_url": "https://api.github.com/repos/overzealousquant/Quant-Leaks-Interview/contributors",
      "subscribers_url": "https://api.github.com/repos/overzealousquant/Quant-Leaks-Interview/subscribers",
      "subscription_url": "https://api.github.com/repos/overzealousquant/Quant-Leaks-Interview/subscription",
      "commits_url": "https://api.github.com/repos/overzealousquant/Quant-Leaks-Interview/commits{/sha}",
      "git_commits_url": "https://api.github.com/repos/overzealousquant/Quant-Leaks-Interview/git/commits{/sha}",
      "comments_url": "https://api.github.com/repos/overzealousquant/Quant-Leaks-Interview/comments{/number}",
      "issue_comment_url": "https://api.github.com/repos/overzealousquant/Quant-Leaks-Interview/issues/comments{/number}",
      "contents_url": "https://api.github.com/repos/overzealousquant/Quant-Leaks-Interview/contents/{+path}",
      "compare_url": "https://api.github.com/repos/overzealousquant/Quant-Leaks-Interview/compare/{base}...{head}",
      "merges_url": "https://api.github.com/repos/overzealousquant/Quant-Leaks-Interview/merges",
      "archive_url": "https://api.github.com/repos/overzealousquant/Quant-Leaks-Interview/{archive_format}{/ref}",
      "downloads_url": "https://api.github.com/repos/overzealousquant/Quant-Leaks-Interview/downloads",
      "issues_url": "https://api.github.com/repos/overzealousquant/Quant-Leaks-Interview/issues{/number}",
      "pulls_url": "https://api.github.com/repos/overzealousquant/Quant-Leaks-Interview/pulls{/number}",
      "milestones_url": "https://api.github.com/repos/overzealousquant/Quant-Leaks-Interview/milestones{/number}",
      "notifications_url": "https://api.github.com/repos/overzealousquant/Quant-Leaks-Interview/notifications{?since,all,participating}",
      "labels_url": "https://api.github.com/repos/overzealousquant/Quant-Leaks-Interview/labels{/name}",
      "releases_url": "https://api.github.com/repos/overzealousquant/Quant-Leaks-Interview/releases{/id}",
      "deployments_url": "https://api.github.com/repos/overzealousquant/Quant-Leaks-Interview/deployments"
    },
    "url": "https://api.github.com/notifications/threads/11206978932",
    "subscription_url": "https://api.github.com/notifications/threads/11206978932/subscription"
  }
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment