Merge pull request #2461 from Bilb/remove-asking-pruning-dialog-start

fix: remove the sogs pruning dialog on app start
This commit is contained in:
Audric Ackermann 2022-09-06 17:55:55 +10:00 committed by GitHub
commit fed0f0cc2d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 48 deletions

View file

@ -141,11 +141,7 @@
"zoomFactorSettingTitle": "Zoom Factor",
"pruneSettingTitle": "Prune Old Open Group Messages",
"pruneSettingDescription": "Prune messages older than 6 months from Open Groups on start",
"pruningOpengroupDialogTitle": "Open group pruning",
"pruningOpengroupDialogMessage": "Pruning old open group messages improves performance. Enable pruning for open group messages older than 6 months?",
"pruningOpengroupDialogSubMessage": "You can change this setting in the Session settings menu",
"enable": "Enable",
"keepDisabled": "Keep disabled",
"notificationSettingsDialog": "When messages arrive, display notifications that reveal...",
"disableNotifications": "Mute notifications",
"nameAndMessage": "Name and content",

View file

@ -27,11 +27,7 @@ import { cleanUpOldDecryptedMedias } from '../../session/crypto/DecryptedAttachm
import { DURATION } from '../../session/constants';
import {
editProfileModal,
onionPathModal,
updateConfirmModal,
} from '../../state/ducks/modalDialog';
import { editProfileModal, onionPathModal } from '../../state/ducks/modalDialog';
import { uploadOurAvatar } from '../../interactions/conversationInteractions';
import { ModalContainer } from '../dialog/ModalContainer';
import { debounce, isEmpty, isString } from 'lodash';
@ -54,8 +50,6 @@ import { LeftPaneSectionContainer } from './LeftPaneSectionContainer';
import { ipcRenderer } from 'electron';
import { UserUtils } from '../../session/utils';
import { Storage } from '../../util/storage';
import { SettingsKey } from '../../data/settings-key';
import { getLatestReleaseFromFileServer } from '../../session/apis/file_server_api/FileServerApi';
const Section = (props: { type: SectionType }) => {
@ -236,8 +230,6 @@ const doAppStartUp = () => {
void loadDefaultRooms();
debounce(triggerAvatarReUploadIfNeeded, 200);
void askEnablingOpengroupPruningIfNeeded();
};
const CallContainer = () => {
@ -266,36 +258,6 @@ async function fetchReleaseFromFSAndUpdateMain() {
}
}
async function askEnablingOpengroupPruningIfNeeded() {
if (Storage.get(SettingsKey.settingsOpengroupPruning) === undefined) {
const setSettingsAndCloseDialog = async (valueToSetPruningTo: boolean) => {
window.setSettingValue(SettingsKey.settingsOpengroupPruning, valueToSetPruningTo);
await window.setOpengroupPruning(valueToSetPruningTo);
window.inboxStore?.dispatch(updateConfirmModal(null));
};
window.inboxStore?.dispatch(
updateConfirmModal({
onClickOk: async () => {
await setSettingsAndCloseDialog(true);
},
onClickClose: async () => {
await setSettingsAndCloseDialog(false);
},
onClickCancel: async () => {
await setSettingsAndCloseDialog(false);
},
title: window.i18n('pruningOpengroupDialogTitle'),
message: window.i18n('pruningOpengroupDialogMessage'),
messageSub: window.i18n('pruningOpengroupDialogSubMessage'),
okText: window.i18n('enable'),
cancelText: window.i18n('keepDisabled'),
})
);
return;
}
// otherwise nothing to do. the settings is already on or off, but as expected by the user
}
/**
* ActionsPanel is the far left banner (not the left pane).
* The panel with buttons to switch between the message/contact/settings/theme views

View file

@ -52,6 +52,7 @@ import {
openAndMigrateDatabase,
updateSchema,
} from './migration/signalMigrations';
import { SettingsKey } from '../data/settings-key';
// tslint:disable: no-console function-name non-literal-fs-path
@ -2064,13 +2065,12 @@ function cleanUpOldOpengroupsOnStart() {
console.info('cleanUpOldOpengroups: ourNumber is not set');
return;
}
const pruneSetting = getItemById('prune-setting')?.value;
let pruneSetting = getItemById(SettingsKey.settingsOpengroupPruning)?.value;
if (pruneSetting === undefined) {
console.info(
'Prune settings is undefined, skipping cleanUpOldOpengroups but we will need to ask user'
);
return;
console.info('Prune settings is undefined (and not explicitely false), forcing it to true.');
createOrUpdateItem({ id: SettingsKey.settingsOpengroupPruning, value: true });
pruneSetting = true;
}
if (!pruneSetting) {