Skip to content

Commit ec3f258

Browse files
authored
Show something useful when there are no notifications in the notifications view (#6876)
Fixes #6856
1 parent 5c84887 commit ec3f258

4 files changed

Lines changed: 15 additions & 0 deletions

File tree

package.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1688,6 +1688,16 @@
16881688
"view": "github:activePullRequest:welcome",
16891689
"when": "!github:stateValidated",
16901690
"contents": "%welcome.github.activePullRequest.contents%"
1691+
},
1692+
{
1693+
"view": "notifications:github",
1694+
"when": "!github:notificationCount",
1695+
"contents": "%welcome.github.notificationsLoading.contents%"
1696+
},
1697+
{
1698+
"view": "notifications:github",
1699+
"when": "ReposManagerStateContext == RepositoriesLoaded && github:notificationCount == 0",
1700+
"contents": "%welcome.github.notifications.contents%"
16911701
}
16921702
],
16931703
"keybindings": [

package.nls.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,8 @@
353353
"Please make sure there is no space between the right bracket and left parenthesis: ]( this is an internal syntax for links"
354354
]
355355
},
356+
"welcome.github.notificationsLoading.contents": "Loading...",
357+
"welcome.github.notifications.contents": "No notifications, your inbox is empty $(rocket)",
356358
"welcome.issues.github.uninitialized.contents": "Loading...",
357359
"welcome.issues.github.noFolder.contents": "You have not yet opened a folder.",
358360
"welcome.issues.github.noRepo.contents": "No git repositories found",

src/common/executeCommands.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export namespace contexts {
1919
export const PULL_REQUEST_DESCRIPTION_VISIBLE = 'github:pullRequestDescriptionVisible'; // Boolean indicating if the pull request description is visible
2020
export const ACTIVE_COMMENT_HAS_SUGGESTION = 'github:activeCommentHasSuggestion'; // Boolean indicating if the active comment has a suggestion
2121
export const CREATING = 'pr:creating';
22+
export const NOTIFICATION_COUNT = 'github:notificationCount'; // Number of notifications in the notifications view
2223
}
2324

2425
export namespace commands {

src/notifications/notificationsProvider.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import * as vscode from 'vscode';
77
import { AuthProvider } from '../common/authentication';
8+
import { commands, contexts } from '../common/executeCommands';
89
import { Disposable } from '../common/lifecycle';
910
import { EXPERIMENTAL_NOTIFICATIONS_PAGE_SIZE, PR_SETTINGS_NAMESPACE } from '../common/settingKeys';
1011
import { OctokitCommon } from '../github/common';
@@ -101,6 +102,7 @@ export class NotificationsProvider extends Disposable {
101102
.map((notification: OctokitCommon.Notification) => parseNotification(notification))
102103
.filter(notification => !!notification) as Notification[];
103104

105+
commands.setContext(contexts.NOTIFICATION_COUNT, notifications.length);
104106
return { notifications, hasNextPage: headers.link?.includes(`rel="next"`) === true };
105107
}
106108

0 commit comments

Comments
 (0)