提交 00de15d7 编写于 作者: I isidor

notificationFilter.ERROR

上级 671fc8f6
......@@ -238,7 +238,12 @@ export enum NotificationsFilter {
* All notifications are configured as silent. See
* `INotificationProperties.silent` for more info.
*/
SILENT
SILENT,
/**
* All notifications are silent except error notifications.
*/
ERROR
}
/**
......
......@@ -685,7 +685,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
this.state.zenMode.setNotificationsFilter = config.silentNotifications;
if (config.silentNotifications) {
this.notificationService.setFilter(NotificationsFilter.SILENT);
this.notificationService.setFilter(NotificationsFilter.ERROR);
}
if (config.centerLayout) {
......
......@@ -95,7 +95,7 @@ export class NotificationsToasts extends Themable {
// Filter
this._register(this.model.onDidFilterChange(filter => {
if (filter === NotificationsFilter.SILENT) {
if (filter === NotificationsFilter.SILENT || filter === NotificationsFilter.ERROR) {
this.hide();
}
}));
......
......@@ -438,7 +438,7 @@ export class NotificationViewItem extends Disposable implements INotificationVie
actions = { primary: notification.message.actions };
}
return new NotificationViewItem(severity, notification.sticky, notification.silent || filter === NotificationsFilter.SILENT, message, notification.source, actions);
return new NotificationViewItem(severity, notification.sticky, notification.silent || filter === NotificationsFilter.SILENT || (filter === NotificationsFilter.ERROR && notification.severity !== Severity.Error), message, notification.source, actions);
}
private static parseNotificationMessage(input: NotificationMessage): INotificationMessage | undefined {
......
......@@ -134,6 +134,12 @@ suite('Notifications', () => {
let item9 = NotificationViewItem.create({ severity: Severity.Error, message: 'Error Message' }, NotificationsFilter.OFF)!;
assert.equal(item9.silent, false);
let item10 = NotificationViewItem.create({ severity: Severity.Error, message: 'Error Message' }, NotificationsFilter.ERROR)!;
assert.equal(item10.silent, false);
let item11 = NotificationViewItem.create({ severity: Severity.Warning, message: 'Error Message' }, NotificationsFilter.ERROR)!;
assert.equal(item11.silent, true);
});
test('Model', () => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册