rename to "enable gravatars"

This commit is contained in:
Kyle Spearrin 2018-07-31 00:02:09 -04:00
parent ac33d2f37c
commit 8eb48e4311
6 changed files with 15 additions and 15 deletions

View File

@ -45,8 +45,8 @@ export class AvatarComponent implements OnChanges, OnInit {
} }
private async generate() { private async generate() {
const useGravatars = await this.stateService.get<boolean>('useGravatars'); const enableGravatars = await this.stateService.get<boolean>('enableGravatars');
if (useGravatars && this.email != null) { if (enableGravatars && this.email != null) {
const hashBytes = await this.cryptoFunctionService.hash(this.email.toLowerCase().trim(), 'md5'); const hashBytes = await this.cryptoFunctionService.hash(this.email.toLowerCase().trim(), 'md5');
const hash = Utils.fromBufferToHex(hashBytes).toLowerCase(); const hash = Utils.fromBufferToHex(hashBytes).toLowerCase();
this.src = 'https://www.gravatar.com/avatar/' + hash + '?s=' + this.size + '&r=pg&d=retro'; this.src = 'https://www.gravatar.com/avatar/' + hash + '?s=' + this.size + '&r=pg&d=retro';

View File

@ -146,7 +146,7 @@ export function initFactory(): Function {
htmlEl.classList.add('theme_' + theme); htmlEl.classList.add('theme_' + theme);
stateService.save(ConstantsService.disableFaviconKey, stateService.save(ConstantsService.disableFaviconKey,
await storageService.get<boolean>(ConstantsService.disableFaviconKey)); await storageService.get<boolean>(ConstantsService.disableFaviconKey));
stateService.save('useGravatars', await storageService.get<boolean>('useGravatars')); stateService.save('enableGravatars', await storageService.get<boolean>('enableGravatars'));
}; };
} }

View File

@ -44,15 +44,15 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="form-check"> <div class="form-check">
<input class="form-check-input" type="checkbox" id="useGravatars" name="UseGravatars" [(ngModel)]="useGravatars"> <input class="form-check-input" type="checkbox" id="enableGravatars" name="enableGravatars" [(ngModel)]="enableGravatars">
<label class="form-check-label" for="useGravatars"> <label class="form-check-label" for="enableGravatars">
{{'useGravatars' | i18n}} {{'enableGravatars' | i18n}}
</label> </label>
<a href="https://gravatar.com/" target="_blank" rel="noopener" title="{{'learnMore' | i18n}}"> <a href="https://gravatar.com/" target="_blank" rel="noopener" title="{{'learnMore' | i18n}}">
<i class="fa fa-question-circle-o"></i> <i class="fa fa-question-circle-o"></i>
</a> </a>
</div> </div>
<small class="form-text text-muted">{{'useGravatarsDesc' | i18n}}</small> <small class="form-text text-muted">{{'enableGravatarsDesc' | i18n}}</small>
</div> </div>
<button type="submit" class="btn btn-primary"> <button type="submit" class="btn btn-primary">
{{'save' | i18n}} {{'save' | i18n}}

View File

@ -23,7 +23,7 @@ import { Utils } from 'jslib/misc/utils';
export class OptionsComponent implements OnInit { export class OptionsComponent implements OnInit {
lockOption: number = null; lockOption: number = null;
disableIcons: boolean; disableIcons: boolean;
useGravatars: boolean; enableGravatars: boolean;
locale: string; locale: string;
lockOptions: any[]; lockOptions: any[];
localeOptions: any[]; localeOptions: any[];
@ -59,7 +59,7 @@ export class OptionsComponent implements OnInit {
async ngOnInit() { async ngOnInit() {
this.lockOption = await this.storageService.get<number>(ConstantsService.lockOptionKey); this.lockOption = await this.storageService.get<number>(ConstantsService.lockOptionKey);
this.disableIcons = await this.storageService.get<boolean>(ConstantsService.disableFaviconKey); this.disableIcons = await this.storageService.get<boolean>(ConstantsService.disableFaviconKey);
this.useGravatars = await this.storageService.get<boolean>('useGravatars'); this.enableGravatars = await this.storageService.get<boolean>('enableGravatars');
this.locale = this.startingLocale = await this.storageService.get<string>(ConstantsService.localeKey); this.locale = this.startingLocale = await this.storageService.get<string>(ConstantsService.localeKey);
} }
@ -67,8 +67,8 @@ export class OptionsComponent implements OnInit {
await this.lockService.setLockOption(this.lockOption != null ? this.lockOption : null); await this.lockService.setLockOption(this.lockOption != null ? this.lockOption : null);
await this.storageService.save(ConstantsService.disableFaviconKey, this.disableIcons); await this.storageService.save(ConstantsService.disableFaviconKey, this.disableIcons);
await this.stateService.save(ConstantsService.disableFaviconKey, this.disableIcons); await this.stateService.save(ConstantsService.disableFaviconKey, this.disableIcons);
await this.storageService.save('useGravatars', this.useGravatars); await this.storageService.save('enableGravatars', this.enableGravatars);
await this.stateService.save('useGravatars', this.useGravatars); await this.stateService.save('enableGravatars', this.enableGravatars);
await this.storageService.save(ConstantsService.localeKey, this.locale); await this.storageService.save(ConstantsService.localeKey, this.locale);
this.analytics.eventTrack.next({ action: 'Saved Options' }); this.analytics.eventTrack.next({ action: 'Saved Options' });
if (this.locale !== this.startingLocale) { if (this.locale !== this.startingLocale) {

View File

@ -958,11 +958,11 @@
"disableIconsDesc": { "disableIconsDesc": {
"message": "Website Icons provide a recognizable image next to each login item in your vault." "message": "Website Icons provide a recognizable image next to each login item in your vault."
}, },
"useGravatars": { "enableGravatars": {
"message": "Use Gravatars", "message": "Enable Gravatars",
"description": "'Gravatar' is the name of a service. See www.gravatar.com" "description": "'Gravatar' is the name of a service. See www.gravatar.com"
}, },
"useGravatarsDesc": { "enableGravatarsDesc": {
"message": "Use avatar images loaded from gravatar.com." "message": "Use avatar images loaded from gravatar.com."
}, },
"default": { "default": {

View File

@ -4,7 +4,7 @@ import { ConstantsService } from 'jslib/services';
export class HtmlStorageService implements StorageService { export class HtmlStorageService implements StorageService {
private localStorageKeys = new Set(['appId', 'anonymousAppId', 'rememberedEmail', 'passwordGenerationOptions', private localStorageKeys = new Set(['appId', 'anonymousAppId', 'rememberedEmail', 'passwordGenerationOptions',
ConstantsService.disableFaviconKey, ConstantsService.lockOptionKey, 'rememberEmail', ConstantsService.disableFaviconKey, ConstantsService.lockOptionKey, 'rememberEmail', 'enableGravatars',
ConstantsService.localeKey, ConstantsService.lockOptionKey]); ConstantsService.localeKey, ConstantsService.lockOptionKey]);
private localStorageStartsWithKeys = ['twoFactorToken_']; private localStorageStartsWithKeys = ['twoFactorToken_'];