Add setting to specify minimum age of open group messages to prune.
When an open group has more than 2000 messages, those older than the specified number of months will be pruned on application start-up. Fixes #2310.pull/2325/head
parent
ea24da0f28
commit
695e867221
@ -0,0 +1,36 @@
|
||||
import Slider from 'rc-slider';
|
||||
import React from 'react';
|
||||
// tslint:disable-next-line: no-submodule-imports
|
||||
import useUpdate from 'react-use/lib/useUpdate';
|
||||
import { SessionSettingsItemWrapper } from './SessionSettingListItem';
|
||||
import { ToastUtils } from '../../session/utils';
|
||||
|
||||
export const PruningSessionSlider = (props: { onSliderChange?: (value: number) => void }) => {
|
||||
const forceUpdate = useUpdate();
|
||||
const handleSlider = (valueToForward: number) => {
|
||||
props?.onSliderChange?.(valueToForward);
|
||||
window.setSettingValue('prune-setting', valueToForward);
|
||||
ToastUtils.pushRestartNeeded();
|
||||
forceUpdate();
|
||||
};
|
||||
const currentValueFromSettings = window.getSettingValue('prune-setting') || 0;
|
||||
|
||||
return (
|
||||
<SessionSettingsItemWrapper title={window.i18n('pruneSettingTitle')} description={window.i18n('pruneSettingDescription')} inline={false}>
|
||||
<div className="slider-wrapper">
|
||||
<Slider
|
||||
dots={true}
|
||||
step={1}
|
||||
min={0}
|
||||
max={12}
|
||||
defaultValue={currentValueFromSettings}
|
||||
onAfterChange={handleSlider}
|
||||
/>
|
||||
|
||||
<div className="slider-info">
|
||||
<p>{currentValueFromSettings} {currentValueFromSettings === 1 ? window.i18n('pruneSettingUnit') : window.i18n('pruneSettingUnits')}</p>
|
||||
</div>
|
||||
</div>
|
||||
</SessionSettingsItemWrapper>
|
||||
);
|
||||
};
|
Loading…
Reference in New Issue