added account settings binding

This commit is contained in:
Nicolas Constant 2019-11-16 17:32:58 -05:00
parent 97976a1f68
commit d7d1952c5e
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
2 changed files with 20 additions and 5 deletions

View File

@ -43,10 +43,16 @@
<h4 class="my-account__label my-account__margin-top">advanced settings:</h4>
<div class="advanced-settings">
<input class="advanced-settings__checkbox" [(ngModel)]="customStatusLengthEnabled" (change)="onCustomLengthEnabledChanged()"
type="checkbox" name="customCharLength" value="customCharLength" id="customCharLength"> <label class="noselect advanced-settings__label" for="customCharLength">custom char limit</label><br>
<p *ngIf="customStatusLengthEnabled" class="advanced-settings__text">use this only if your instance doesn't support status custom length detection (i.e. not a Pleroma or glitch-soc instance)</p>
<input *ngIf="customStatusLengthEnabled" [(ngModel)]="customStatusLength" class="themed-form advanced-settings__input" type="number" (keyup)="customStatusLengthChanged($event)" />
<input class="advanced-settings__checkbox" [(ngModel)]="avatarNotificationDisabled"
(change)="onDisableAvatarNotificationChanged()" type="checkbox" name="avatarNotification" value="avatarNotification" id="avatarNotification"> <label class="noselect advanced-settings__label" for="avatarNotification">disable avatar notifications</label><br>
<input class="advanced-settings__checkbox" [(ngModel)]="customStatusLengthEnabled"
(change)="onCustomLengthEnabledChanged()" type="checkbox" name="customCharLength" value="customCharLength"
id="customCharLength"> <label class="noselect advanced-settings__label" for="customCharLength">custom char
limit</label><br>
<p *ngIf="customStatusLengthEnabled" class="advanced-settings__text">use this only if your instance doesn't
support status custom length detection (i.e. not a Pleroma or glitch-soc instance)</p>
<input *ngIf="customStatusLengthEnabled" [(ngModel)]="customStatusLength"
class="themed-form advanced-settings__input" type="number" (keyup)="customStatusLengthChanged($event)" />
</div>
<h4 class="my-account__label my-account__margin-top">remove account from sengi:</h4>

View File

@ -26,6 +26,7 @@ export class MyAccountComponent implements OnInit, OnDestroy {
faCheck = faCheck;
faTimes = faTimes;
avatarNotificationDisabled: boolean;
customStatusLengthEnabled: boolean;
customStatusLength: number;
private accountSettings: AccountSettings;
@ -69,7 +70,9 @@ export class MyAccountComponent implements OnInit, OnDestroy {
private loadAccountSettings(){
this.accountSettings = this.toolsService.getAccountSettings(this.account.info);
this.customStatusLengthEnabled = this.accountSettings.customStatusCharLengthEnabled; this.customStatusLength = this.accountSettings.customStatusCharLength;
this.customStatusLengthEnabled = this.accountSettings.customStatusCharLengthEnabled;
this.customStatusLength = this.accountSettings.customStatusCharLength;
this.avatarNotificationDisabled = this.accountSettings.disableAvatarNotifications;
}
onCustomLengthEnabledChanged(): boolean {
@ -183,6 +186,12 @@ export class MyAccountComponent implements OnInit, OnDestroy {
return false;
}
onDisableAvatarNotificationChanged() {
let settings = this.toolsService.getAccountSettings(this.account.info);
settings.disableAvatarNotifications = this.avatarNotificationDisabled;
this.toolsService.saveAccountSettings(settings);
}
}
export class StreamWrapper extends StreamElement {