瀏覽代碼

Fixes #336 - stops adding suppressed message defaults

main
Eric Amodio 6 年之前
父節點
當前提交
71aace552d
共有 2 個文件被更改,包括 19 次插入11 次删除
  1. +1
    -0
      CHANGELOG.md
  2. +18
    -11
      src/messages.ts

+ 1
- 0
CHANGELOG.md 查看文件

@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
### Fixed
- Fixes [#345](https://github.com/eamodio/vscode-gitlens/issues/345) - Custom date formats don't work in the GitLens view
- Fixes [#336](https://github.com/eamodio/vscode-gitlens/issues/336) - Default Settings Get Added Automatically
- Fixes issue where username and/or password in a remote urls could be shown
## [8.2.1] - 2018-04-11

+ 18
- 11
src/messages.ts 查看文件

@ -32,14 +32,10 @@ export class Messages {
}
static async showKeyBindingsInfoMessage(): Promise<MessageItem | undefined> {
const section = configuration.name('advanced')('messages').value;
const messages: { [key: string]: boolean } = configuration.get<{}>(section);
if (messages[SuppressedMessages.ShowKeyBindingsNotice]) return undefined;
if (Container.config.advanced.messages.suppressShowKeyBindingsNotice) return undefined;
if (Container.config.keymap !== KeyMap.Alternate) {
messages[SuppressedMessages.ShowKeyBindingsNotice] = true;
await configuration.update(section, messages, ConfigurationTarget.Global);
await this.suppressedMessage(SuppressedMessages.ShowKeyBindingsNotice);
return undefined;
}
@ -115,11 +111,7 @@ export class Messages {
if (dontShowAgain === null || result === dontShowAgain) {
Logger.log(`ShowMessage(${type}, '${message}', ${suppressionKey}, ${dontShowAgain}) don't show again requested`);
const section = configuration.name('advanced')('messages').value;
const messages: { [key: string]: boolean } = configuration.get<{}>(section);
messages[suppressionKey] = true;
await configuration.update(section, messages, ConfigurationTarget.Global);
await this.suppressedMessage(suppressionKey);
if (result === dontShowAgain) return undefined;
}
@ -127,4 +119,19 @@ export class Messages {
Logger.log(`ShowMessage(${type}, '${message}', ${suppressionKey}, ${dontShowAgain}) returned ${result ? result.title : result}`);
return result;
}
private static suppressedMessage(suppressionKey: SuppressedMessages) {
const section = configuration.name('advanced')('messages').value;
const messages: { [key: string]: boolean | undefined } = configuration.get<{}>(section);
messages[suppressionKey] = true;
for (const [key, value] of Object.entries(messages)) {
if (value !== true) {
messages[key] = undefined;
}
}
return configuration.update(section, messages, ConfigurationTarget.Global);
}
}

Loading…
取消
儲存