added autofollow settings for pleroma

This commit is contained in:
Nicolas Constant 2021-02-28 01:19:41 -05:00
parent 3724b0b4c2
commit 47a8cdc096
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
3 changed files with 38 additions and 4 deletions

View File

@ -135,6 +135,17 @@
<br>
</div>
<div *ngIf="hasPleromaAccount">
<h4 class="panel__subtitle">Pleroma</h4>
<div class="sub-section">
<input class="sub-section__checkbox" [(ngModel)]="autoFollowOnListEnabled"
(change)="onAutoFollowOnListChanged()" type="checkbox" name="onAutoFollowOnListChanged"
value="onAutoFollowOnListChanged" id="onAutoFollowOnListChanged">
<label class="noselect sub-section__label" for="onAutoFollowOnListChanged">autofollow accounts when adding to list</label>
<br>
</div>
</div>
<h4 class="panel__subtitle">Other</h4>
<div class="sub-section">
<input class="sub-section__checkbox" [(ngModel)]="disableRemoteStatusFetchingEnabled"
@ -148,9 +159,9 @@
<h4 class="panel__subtitle">About</h4>
<p class="version">
Sengi version: {{version}}<br />
<a href class="version__link" (click)="openTutorial()">open tutorial</a><br/>
<a href="assets/docs/privacy.html" class="version__link" target="_blank">imprint & privacy</a><br/>
<a href class="version__link" (click)="checkForUpdates()">check for updates</a>
<a href class="version__link" (click)="openTutorial()">open tutorial</a><br />
<a href="assets/docs/privacy.html" class="version__link" target="_blank">imprint & privacy</a><br />
<a href class="version__link" (click)="checkForUpdates()">check for updates</a>
<app-waiting-animation *ngIf="isCheckingUpdates" class="waiting-icon"></app-waiting-animation>
</p>

View File

@ -3,7 +3,7 @@ import { FormBuilder, FormGroup } from '@angular/forms';
import { Howl } from 'howler';
import { environment } from '../../../../environments/environment';
import { ToolsService } from '../../../services/tools.service';
import { ToolsService, InstanceType } from '../../../services/tools.service';
import { UserNotificationService, NotificationSoundDefinition } from '../../../services/user-notification.service';
import { ServiceWorkerService } from '../../../services/service-worker.service';
import { ContentWarningPolicy, ContentWarningPolicyEnum, TimeLineModeEnum, TimeLineHeaderEnum } from '../../../states/settings.state';
@ -28,6 +28,9 @@ export class SettingsComponent implements OnInit {
disableSoundsEnabled: boolean;
version: string;
hasPleromaAccount: boolean;
autoFollowOnListEnabled: boolean;
columnShortcutEnabled: ColumnShortcut = ColumnShortcut.Ctrl;
timeLineHeader: TimeLineHeaderEnum = TimeLineHeaderEnum.Title_DomainName;
timeLineMode: TimeLineModeEnum = TimeLineModeEnum.OnTop;
@ -97,6 +100,18 @@ export class SettingsComponent implements OnInit {
this.timeLineHeader = settings.timelineHeader;
this.timeLineMode = settings.timelineMode;
this.autoFollowOnListEnabled = settings.autoFollowOnListEnabled;
const accs = this.toolsService.getAllAccounts();
accs.forEach(a => {
this.toolsService.getInstanceInfo(a)
.then(ins => {
if(ins.type === InstanceType.Pleroma){
this.hasPleromaAccount = true;
}
})
.catch(err => console.error(err));
});
}
onShortcutChange(id: ColumnShortcut) {
@ -219,6 +234,12 @@ export class SettingsComponent implements OnInit {
this.toolsService.saveSettings(settings);
}
onAutoFollowOnListChanged(){
let settings = this.toolsService.getSettings();
settings.autoFollowOnListEnabled = this.autoFollowOnListEnabled;
this.toolsService.saveSettings(settings);
}
isCleanningAll: boolean = false;
startClearAllLocalData(): boolean {
this.isCleanningAll = !this.isCleanningAll;

View File

@ -66,6 +66,7 @@ export class GlobalSettings {
disableAvatarNotifications = false;
disableSounds = false;
disableRemoteStatusFetching = false;
autoFollowOnListEnabled = false;
notificationSoundFileId: string = '0';
@ -164,6 +165,7 @@ export class SettingsState {
newSettings.disableRemoteStatusFetching = oldSettings.disableRemoteStatusFetching;
newSettings.timelineHeader = oldSettings.timelineHeader;
newSettings.timelineMode = oldSettings.timelineMode;
newSettings.autoFollowOnListEnabled = oldSettings.autoFollowOnListEnabled;
return newSettings;
}