added settings to disable remote status fetching

This commit is contained in:
Nicolas Constant 2020-04-10 23:27:29 -04:00
parent 49a87aeef0
commit 15ab7ba56e
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
4 changed files with 27 additions and 2 deletions

View File

@ -94,6 +94,15 @@
<span class="sub-section__title" *ngIf="contentWarningPolicyChanged"><br/>this settings needs a <a href (click)="reload()">reload</a> to be effective.</span>
</div>
<h4 class="panel__subtitle">Other</h4>
<div class="sub-section">
<input class="sub-section__checkbox" [(ngModel)]="disableRemoteStatusFetchingEnabled"
(change)="onDisableRemoteStatusFetchingChanged()" type="checkbox" name="disableRemoteFetching" value="disableRemoteFetching"
id="disableRemoteFetching">
<label class="noselect sub-section__label" for="disableRemoteFetching">disable remote status fetching</label>
<br>
</div>
<h4 class="panel__subtitle">About</h4>
<p class="version">
Sengi version: {{version}}<br />

View File

@ -21,6 +21,7 @@ export class SettingsComponent implements OnInit {
notificationForm: FormGroup;
disableAutofocusEnabled: boolean;
disableRemoteStatusFetchingEnabled: boolean;
disableAvatarNotificationsEnabled: boolean;
disableSoundsEnabled: boolean;
version: string;
@ -78,6 +79,7 @@ export class SettingsComponent implements OnInit {
this.disableAutofocusEnabled = settings.disableAutofocus;
this.disableAvatarNotificationsEnabled = settings.disableAvatarNotifications;
this.disableSoundsEnabled = settings.disableSounds;
this.disableRemoteStatusFetchingEnabled = settings.disableRemoteStatusFetching;
if (!settings.columnSwitchingWinAlt) {
this.columnShortcutEnabled = ColumnShortcut.Ctrl;
@ -172,6 +174,12 @@ export class SettingsComponent implements OnInit {
this.toolsService.saveSettings(settings);
}
onDisableRemoteStatusFetchingChanged() {
let settings = this.toolsService.getSettings();
settings.disableRemoteStatusFetching = this.disableRemoteStatusFetchingEnabled;
this.toolsService.saveSettings(settings);
}
onDisableAvatarNotificationsChanged() {
let settings = this.toolsService.getSettings();
settings.disableAvatarNotifications = this.disableAvatarNotificationsEnabled;

View File

@ -22,6 +22,7 @@ export class ThreadComponent implements OnInit, OnDestroy {
isLoading = true;
isThread = true;
hasContentWarnings = false;
private remoteStatusFetchingDisabled = false;
bufferStream: Status[] = []; //html compatibility only
@ -57,6 +58,9 @@ export class ThreadComponent implements OnInit, OnDestroy {
private readonly mastodonService: MastodonWrapperService) { }
ngOnInit() {
let settings = this.toolsService.getSettings();
this.remoteStatusFetchingDisabled = settings.disableRemoteStatusFetching;
if (this.refreshEventEmitter) {
this.refreshSubscription = this.refreshEventEmitter.subscribe(() => {
this.refresh();
@ -219,6 +223,8 @@ export class ThreadComponent implements OnInit, OnDestroy {
}
private async retrieveRemoteThread(status: Status): Promise<Status[]> {
if(this.remoteStatusFetchingDisabled) return [];
try {
let url = status.url;
let splitUrl = url.replace('https://', '').split('/');

View File

@ -51,14 +51,15 @@ export class GlobalSettings {
disableAutofocus = false;
disableAvatarNotifications = false;
disableSounds = false;
disableRemoteStatusFetching = false;
notificationSoundFileId: string = '0';
contentWarningPolicy: ContentWarningPolicy = new ContentWarningPolicy();
columnSwitchingWinAlt = false;
accountSettings: AccountSettings[] = [];
accountSettings: AccountSettings[] = [];
}
export interface SettingsStateModel {
@ -143,6 +144,7 @@ export class SettingsState {
newSettings.disableSounds = oldSettings.disableSounds;
newSettings.notificationSoundFileId = oldSettings.notificationSoundFileId;
newSettings.columnSwitchingWinAlt = oldSettings.columnSwitchingWinAlt;
newSettings.disableRemoteStatusFetching = oldSettings.disableRemoteStatusFetching;
return newSettings;
}