From 43675432247fdcd57cafc3e3da2eb005ed0ae5d6 Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Thu, 1 Sep 2022 13:09:30 +1000 Subject: [PATCH] fix: remove the sogs pruning dialog on app start the settings in ON by default, and can be turned off from the settings screen. That dialog was only used until our existing users got asked the question, which was 3 months ago. --- _locales/en/messages.json | 4 --- ts/components/leftpane/ActionsPanel.tsx | 40 +------------------------ ts/node/sql.ts | 10 +++---- 3 files changed, 6 insertions(+), 48 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index c23feed5e..f76249055 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -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", diff --git a/ts/components/leftpane/ActionsPanel.tsx b/ts/components/leftpane/ActionsPanel.tsx index 83b2e7fea..ff629be05 100644 --- a/ts/components/leftpane/ActionsPanel.tsx +++ b/ts/components/leftpane/ActionsPanel.tsx @@ -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 diff --git a/ts/node/sql.ts b/ts/node/sql.ts index fa08c6de4..c77434835 100644 --- a/ts/node/sql.ts +++ b/ts/node/sql.ts @@ -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) {