diff --git a/src/app/components/create-status/create-status.component.ts b/src/app/components/create-status/create-status.component.ts index f6d9588f..b9450795 100644 --- a/src/app/components/create-status/create-status.component.ts +++ b/src/app/components/create-status/create-status.component.ts @@ -106,7 +106,13 @@ export class CreateStatusComponent implements OnInit, OnDestroy { private accountChanged(accounts: AccountInfo[]): void { if (accounts && accounts.length > 0) { const selectedAccount = accounts.filter(x => x.isSelected)[0]; - this.instancesInfoService.getMaxStatusChars(selectedAccount.instance) + + const settings = this.toolsService.getAccountSettings(selectedAccount); + if(settings.customStatusCharLengthEnabled){ + this.maxCharLength = settings.customStatusCharLength; + this.countStatusChar(this.status); + } else { + this.instancesInfoService.getMaxStatusChars(selectedAccount.instance) .then((maxChars: number) => { this.maxCharLength = maxChars; this.countStatusChar(this.status); @@ -114,6 +120,7 @@ export class CreateStatusComponent implements OnInit, OnDestroy { .catch((err: HttpErrorResponse) => { this.notificationService.notifyHttpError(err); }); + } if (!this.statusReplyingToWrapper) { this.instancesInfoService.getDefaultPrivacy(selectedAccount) diff --git a/src/app/components/floating-column/manage-account/my-account/my-account.component.html b/src/app/components/floating-column/manage-account/my-account/my-account.component.html index 1e098168..a8ef56e8 100644 --- a/src/app/components/floating-column/manage-account/my-account/my-account.component.html +++ b/src/app/components/floating-column/manage-account/my-account/my-account.component.html @@ -43,11 +43,11 @@

advanced settings:

-

use this only if your instance doesn't support custom length detection (i.e. not a Pleroma or glitch-soc instance)

- +

remove account from sengi:

diff --git a/src/app/components/floating-column/manage-account/my-account/my-account.component.ts b/src/app/components/floating-column/manage-account/my-account/my-account.component.ts index 183bf612..64a729f2 100644 --- a/src/app/components/floating-column/manage-account/my-account/my-account.component.ts +++ b/src/app/components/floating-column/manage-account/my-account/my-account.component.ts @@ -10,6 +10,8 @@ import { AccountWrapper } from '../../../../models/account.models'; import { RemoveAccount } from '../../../../states/accounts.state'; import { NavigationService } from '../../../../services/navigation.service'; import { MastodonService } from '../../../../services/mastodon.service'; +import { ToolsService } from '../../../../services/tools.service'; +import { AccountSettings } from '../../../../states/settings.state'; @Component({ selector: 'app-my-account', @@ -26,6 +28,7 @@ export class MyAccountComponent implements OnInit, OnDestroy { customStatusLengthEnabled: boolean; customStatusLength: number; + private accountSettings: AccountSettings; availableStreams: StreamWrapper[] = []; availableLists: StreamWrapper[] = []; @@ -35,6 +38,7 @@ export class MyAccountComponent implements OnInit, OnDestroy { set account(acc: AccountWrapper) { this._account = acc; this.loadStreams(acc); + this.loadAccountSettings(); } get account(): AccountWrapper { return this._account; @@ -45,6 +49,7 @@ export class MyAccountComponent implements OnInit, OnDestroy { constructor( private readonly store: Store, + private readonly toolsService: ToolsService, private readonly navigationService: NavigationService, private readonly mastodonService: MastodonService, private readonly notificationService: NotificationService) { } @@ -52,7 +57,7 @@ export class MyAccountComponent implements OnInit, OnDestroy { ngOnInit() { this.streamChangedSub = this.streamElements$.subscribe((streams: StreamElement[]) => { this.loadStreams(this.account); - }); + }); } ngOnDestroy(): void { @@ -61,8 +66,21 @@ export class MyAccountComponent implements OnInit, OnDestroy { } } - onCustomLengthChange(): boolean { - this.customStatusLengthEnabled = !this.customStatusLengthEnabled; + private loadAccountSettings(){ + this.accountSettings = this.toolsService.getAccountSettings(this.account.info); + + this.customStatusLengthEnabled = this.accountSettings.customStatusCharLengthEnabled; this.customStatusLength = this.accountSettings.customStatusCharLength; + } + + onCustomLengthEnabledChanged(): boolean { + this.accountSettings.customStatusCharLengthEnabled = this.customStatusLengthEnabled; + this.toolsService.saveAccountSettings(this.accountSettings); + return false; + } + + customStatusLengthChanged(event): boolean{ + this.accountSettings.customStatusCharLength = this.customStatusLength; + this.toolsService.saveAccountSettings(this.accountSettings); return false; } diff --git a/src/app/services/tools.service.ts b/src/app/services/tools.service.ts index f1a1ecb0..5f0f4721 100644 --- a/src/app/services/tools.service.ts +++ b/src/app/services/tools.service.ts @@ -30,6 +30,10 @@ export class ToolsService { accountSettings.accountId = account.id; this.saveAccountSettings(accountSettings); } + if(!accountSettings.customStatusCharLength){ + accountSettings.customStatusCharLength = 500; + this.saveAccountSettings(accountSettings); + } return accountSettings; }