mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
MM-53688 Remove boards dataretention (#24231)
* remove boards data-retention * remove another variable * update snapshots, to remove boards * need to keep config settings until focalboard is updated --------- Co-authored-by: Mattermost Build <build@mattermost.com>
This commit is contained in:
@@ -583,10 +583,8 @@ const defaultServerConfig: AdminConfig = {
|
||||
DataRetentionSettings: {
|
||||
EnableMessageDeletion: false,
|
||||
EnableFileDeletion: false,
|
||||
EnableBoardsDeletion: false,
|
||||
MessageRetentionDays: 365,
|
||||
FileRetentionDays: 365,
|
||||
BoardsRetentionDays: 365,
|
||||
DeletionJobStartTime: '02:00',
|
||||
BatchSize: 3000,
|
||||
},
|
||||
@@ -669,7 +667,6 @@ const defaultServerConfig: AdminConfig = {
|
||||
PermalinkPreviews: true,
|
||||
CallsEnabled: true,
|
||||
BoardsFeatureFlags: '',
|
||||
BoardsDataRetention: false,
|
||||
NormalizeLdapDNs: false,
|
||||
GraphQL: false,
|
||||
CommandPalette: false,
|
||||
|
||||
@@ -126,8 +126,6 @@ func GenerateClientConfig(c *model.Config, telemetryID string, license *model.Li
|
||||
props["DataRetentionMessageRetentionDays"] = "0"
|
||||
props["DataRetentionEnableFileDeletion"] = "false"
|
||||
props["DataRetentionFileRetentionDays"] = "0"
|
||||
props["DataRetentionEnableBoardsDeletion"] = "false"
|
||||
props["DataRetentionBoardsRetentionDays"] = "0"
|
||||
|
||||
props["CustomUrlSchemes"] = strings.Join(c.DisplaySettings.CustomURLSchemes, ",")
|
||||
props["IsDefaultMarketplace"] = strconv.FormatBool(*c.PluginSettings.MarketplaceURL == model.PluginSettingsDefaultMarketplaceURL)
|
||||
@@ -200,8 +198,6 @@ func GenerateClientConfig(c *model.Config, telemetryID string, license *model.Li
|
||||
props["DataRetentionMessageRetentionDays"] = strconv.FormatInt(int64(*c.DataRetentionSettings.MessageRetentionDays), 10)
|
||||
props["DataRetentionEnableFileDeletion"] = strconv.FormatBool(*c.DataRetentionSettings.EnableFileDeletion)
|
||||
props["DataRetentionFileRetentionDays"] = strconv.FormatInt(int64(*c.DataRetentionSettings.FileRetentionDays), 10)
|
||||
props["DataRetentionEnableBoardsDeletion"] = strconv.FormatBool(*c.DataRetentionSettings.EnableBoardsDeletion)
|
||||
props["DataRetentionBoardsRetentionDays"] = strconv.FormatInt(int64(*c.DataRetentionSettings.BoardsRetentionDays), 10)
|
||||
}
|
||||
|
||||
if license.HasSharedChannels() {
|
||||
|
||||
@@ -829,10 +829,8 @@ func (ts *TelemetryService) trackConfig() {
|
||||
ts.SendTelemetry(TrackConfigDataRetention, map[string]any{
|
||||
"enable_message_deletion": *cfg.DataRetentionSettings.EnableMessageDeletion,
|
||||
"enable_file_deletion": *cfg.DataRetentionSettings.EnableFileDeletion,
|
||||
"enable_boards_deletion": *cfg.DataRetentionSettings.EnableBoardsDeletion,
|
||||
"message_retention_days": *cfg.DataRetentionSettings.MessageRetentionDays,
|
||||
"file_retention_days": *cfg.DataRetentionSettings.FileRetentionDays,
|
||||
"boards_retention_days": *cfg.DataRetentionSettings.BoardsRetentionDays,
|
||||
"deletion_job_start_time": *cfg.DataRetentionSettings.DeletionJobStartTime,
|
||||
"batch_size": *cfg.DataRetentionSettings.BatchSize,
|
||||
"time_between_batches": *cfg.DataRetentionSettings.TimeBetweenBatchesMilliseconds,
|
||||
|
||||
@@ -6,10 +6,8 @@ package model
|
||||
type GlobalRetentionPolicy struct {
|
||||
MessageDeletionEnabled bool `json:"message_deletion_enabled"`
|
||||
FileDeletionEnabled bool `json:"file_deletion_enabled"`
|
||||
BoardsDeletionEnabled bool `json:"boards_deletion_enabled"`
|
||||
MessageRetentionCutoff int64 `json:"message_retention_cutoff"`
|
||||
FileRetentionCutoff int64 `json:"file_retention_cutoff"`
|
||||
BoardsRetentionCutoff int64 `json:"boards_retention_cutoff"`
|
||||
}
|
||||
|
||||
type RetentionPolicy struct {
|
||||
|
||||
@@ -27,9 +27,6 @@ type FeatureFlags struct {
|
||||
// CallsEnabled controls whether or not the Calls plugin should be enabled
|
||||
CallsEnabled bool
|
||||
|
||||
// Enable DataRetention for Boards
|
||||
BoardsDataRetention bool
|
||||
|
||||
NormalizeLdapDNs bool
|
||||
|
||||
// Enable GraphQL feature
|
||||
@@ -58,7 +55,6 @@ func (f *FeatureFlags) SetDefaults() {
|
||||
f.TestBoolFeature = false
|
||||
f.EnableRemoteClusterService = false
|
||||
f.AppsEnabled = true
|
||||
f.BoardsDataRetention = false
|
||||
f.NormalizeLdapDNs = false
|
||||
f.GraphQL = false
|
||||
f.CallsEnabled = true
|
||||
|
||||
@@ -112,14 +112,6 @@ exports[`components/admin_console/data_retention_settings/data_retention_setting
|
||||
/>
|
||||
</Menu>
|
||||
</MenuWrapper>,
|
||||
"boards": <div
|
||||
data-testid="global_boards_retention_cell"
|
||||
>
|
||||
<Memo(MemoizedFormattedMessage)
|
||||
defaultMessage="Keep forever"
|
||||
id="admin.data_retention.form.keepForever"
|
||||
/>
|
||||
</div>,
|
||||
"channel_messages": <div
|
||||
data-testid="global_message_retention_cell"
|
||||
>
|
||||
@@ -490,19 +482,6 @@ exports[`components/admin_console/data_retention_settings/data_retention_setting
|
||||
/>
|
||||
</Menu>
|
||||
</MenuWrapper>,
|
||||
"boards": <div
|
||||
data-testid="global_boards_retention_cell"
|
||||
>
|
||||
<Memo(MemoizedFormattedMessage)
|
||||
defaultMessage="{count} {count, plural, one {day} other {days}}"
|
||||
id="admin.data_retention.retention_days"
|
||||
values={
|
||||
Object {
|
||||
"count": "100",
|
||||
}
|
||||
}
|
||||
/>
|
||||
</div>,
|
||||
"channel_messages": <div
|
||||
data-testid="global_message_retention_cell"
|
||||
>
|
||||
@@ -888,19 +867,6 @@ exports[`components/admin_console/data_retention_settings/data_retention_setting
|
||||
/>
|
||||
</Menu>
|
||||
</MenuWrapper>,
|
||||
"boards": <div
|
||||
data-testid="global_boards_retention_cell"
|
||||
>
|
||||
<Memo(MemoizedFormattedMessage)
|
||||
defaultMessage="{count} {count, plural, one {day} other {days}}"
|
||||
id="admin.data_retention.retention_days"
|
||||
values={
|
||||
Object {
|
||||
"count": "100",
|
||||
}
|
||||
}
|
||||
/>
|
||||
</div>,
|
||||
"channel_messages": <div
|
||||
data-testid="global_message_retention_cell"
|
||||
>
|
||||
@@ -1281,19 +1247,6 @@ exports[`components/admin_console/data_retention_settings/data_retention_setting
|
||||
/>
|
||||
</Menu>
|
||||
</MenuWrapper>,
|
||||
"boards": <div
|
||||
data-testid="global_boards_retention_cell"
|
||||
>
|
||||
<Memo(MemoizedFormattedMessage)
|
||||
defaultMessage="{count} {count, plural, one {day} other {days}}"
|
||||
id="admin.data_retention.retention_days"
|
||||
values={
|
||||
Object {
|
||||
"count": "100",
|
||||
}
|
||||
}
|
||||
/>
|
||||
</div>,
|
||||
"channel_messages": <div
|
||||
data-testid="global_message_retention_cell"
|
||||
>
|
||||
|
||||
@@ -12,10 +12,8 @@ describe('components/admin_console/data_retention_settings/data_retention_settin
|
||||
DataRetentionSettings: {
|
||||
EnableMessageDeletion: true,
|
||||
EnableFileDeletion: true,
|
||||
EnableBoardsDeletion: true,
|
||||
MessageRetentionDays: 100,
|
||||
FileRetentionDays: 100,
|
||||
BoardsRetentionDays: 100,
|
||||
DeletionJobStartTime: '00:15',
|
||||
},
|
||||
},
|
||||
@@ -83,7 +81,6 @@ describe('components/admin_console/data_retention_settings/data_retention_settin
|
||||
const props = baseProps;
|
||||
props.config.DataRetentionSettings.EnableMessageDeletion = false;
|
||||
props.config.DataRetentionSettings.EnableFileDeletion = false;
|
||||
props.config.DataRetentionSettings.EnableBoardsDeletion = false;
|
||||
const wrapper = shallow(
|
||||
<DataRetentionSettings
|
||||
{...props}
|
||||
|
||||
@@ -69,7 +69,6 @@ export default class DataRetentionSettings extends React.PureComponent<Props, St
|
||||
this.loadPage(0);
|
||||
};
|
||||
|
||||
includeBoards = this.props.config.PluginSettings?.PluginStates?.focalboard?.Enable && this.props.config.FeatureFlags?.BoardsDataRetention;
|
||||
getGlobalPolicyColumns = (): Column[] => {
|
||||
const columns: Column[] = [
|
||||
{
|
||||
@@ -100,19 +99,6 @@ export default class DataRetentionSettings extends React.PureComponent<Props, St
|
||||
field: 'files',
|
||||
},
|
||||
];
|
||||
if (this.includeBoards) {
|
||||
columns.push(
|
||||
{
|
||||
name: (
|
||||
<FormattedMessage
|
||||
id='admin.data_retention.globalPoliciesTable.boards'
|
||||
defaultMessage='Boards'
|
||||
/>
|
||||
),
|
||||
field: 'boards',
|
||||
},
|
||||
);
|
||||
}
|
||||
columns.push(
|
||||
{
|
||||
name: '',
|
||||
@@ -205,11 +191,6 @@ export default class DataRetentionSettings extends React.PureComponent<Props, St
|
||||
{this.getMessageRetentionSetting(DataRetentionSettings?.EnableFileDeletion, DataRetentionSettings?.FileRetentionDays)}
|
||||
</div>
|
||||
),
|
||||
boards: (
|
||||
<div data-testid='global_boards_retention_cell'>
|
||||
{this.getMessageRetentionSetting(DataRetentionSettings?.EnableBoardsDeletion, DataRetentionSettings?.BoardsRetentionDays)}
|
||||
</div>
|
||||
),
|
||||
actions: (
|
||||
<MenuWrapper
|
||||
isDisabled={false}
|
||||
|
||||
@@ -36,8 +36,6 @@ type State = {
|
||||
messageRetentionInputValue: string;
|
||||
fileRetentionDropdownValue: ValueType;
|
||||
fileRetentionInputValue: string;
|
||||
boardsRetentionDropdownValue: ValueType;
|
||||
boardsRetentionInputValue: string;
|
||||
saveNeeded: boolean;
|
||||
saving: boolean;
|
||||
serverError: JSX.Element | string | null;
|
||||
@@ -57,13 +55,9 @@ export default class GlobalPolicyForm extends React.PureComponent<Props, State>
|
||||
messageRetentionInputValue: this.getDefaultInputValue(DataRetentionSettings?.EnableMessageDeletion, DataRetentionSettings?.MessageRetentionDays),
|
||||
fileRetentionDropdownValue: this.getDefaultDropdownValue(DataRetentionSettings?.EnableFileDeletion, DataRetentionSettings?.FileRetentionDays),
|
||||
fileRetentionInputValue: this.getDefaultInputValue(DataRetentionSettings?.EnableFileDeletion, DataRetentionSettings?.FileRetentionDays),
|
||||
boardsRetentionDropdownValue: this.getDefaultDropdownValue(DataRetentionSettings?.EnableBoardsDeletion, DataRetentionSettings?.BoardsRetentionDays),
|
||||
boardsRetentionInputValue: this.getDefaultInputValue(DataRetentionSettings?.EnableBoardsDeletion, DataRetentionSettings?.BoardsRetentionDays),
|
||||
};
|
||||
}
|
||||
|
||||
includeBoards = this.props.config.PluginSettings?.PluginStates?.focalboard?.Enable && this.props.config.FeatureFlags?.BoardsDataRetention;
|
||||
|
||||
getDefaultInputValue = (isEnabled: boolean | undefined, days: number | undefined): string => {
|
||||
if (!isEnabled || days === undefined) {
|
||||
return '';
|
||||
@@ -84,7 +78,7 @@ export default class GlobalPolicyForm extends React.PureComponent<Props, State>
|
||||
};
|
||||
|
||||
handleSubmit = async () => {
|
||||
const {messageRetentionDropdownValue, messageRetentionInputValue, fileRetentionDropdownValue, fileRetentionInputValue, boardsRetentionDropdownValue, boardsRetentionInputValue} = this.state;
|
||||
const {messageRetentionDropdownValue, messageRetentionInputValue, fileRetentionDropdownValue, fileRetentionInputValue} = this.state;
|
||||
const newConfig: AdminConfig = JSON.parse(JSON.stringify(this.props.config));
|
||||
|
||||
this.setState({saving: true});
|
||||
@@ -108,13 +102,6 @@ export default class GlobalPolicyForm extends React.PureComponent<Props, State>
|
||||
newConfig.DataRetentionSettings.FileRetentionDays = fileDays;
|
||||
}
|
||||
|
||||
newConfig.DataRetentionSettings.EnableBoardsDeletion = this.setDeletionEnabled(boardsRetentionDropdownValue.value);
|
||||
|
||||
const boardsDays = this.setRetentionDays(boardsRetentionDropdownValue.value, boardsRetentionInputValue);
|
||||
if (boardsDays >= 1) {
|
||||
newConfig.DataRetentionSettings.BoardsRetentionDays = boardsDays;
|
||||
}
|
||||
|
||||
const {error} = await this.props.actions.updateConfig(newConfig);
|
||||
|
||||
if (error) {
|
||||
@@ -222,33 +209,6 @@ export default class GlobalPolicyForm extends React.PureComponent<Props, State>
|
||||
inputId={'file_retention_input'}
|
||||
/>
|
||||
</div>
|
||||
{ this.includeBoards &&
|
||||
<div id='global_boards_dropdown'>
|
||||
<DropdownInputHybrid
|
||||
onDropdownChange={(value) => {
|
||||
if (this.state.boardsRetentionDropdownValue.value !== value.value) {
|
||||
this.setState({boardsRetentionDropdownValue: value, saveNeeded: true});
|
||||
this.props.actions.setNavigationBlocked(true);
|
||||
}
|
||||
}}
|
||||
onInputChange={(e) => {
|
||||
this.setState({boardsRetentionInputValue: e.target.value, saveNeeded: true});
|
||||
this.props.actions.setNavigationBlocked(true);
|
||||
}}
|
||||
value={this.state.boardsRetentionDropdownValue}
|
||||
inputValue={this.state.boardsRetentionInputValue}
|
||||
width={90}
|
||||
exceptionToInput={[FOREVER]}
|
||||
defaultValue={keepForeverOption()}
|
||||
options={[daysOption(), yearsOption(), keepForeverOption()]}
|
||||
legend={Utils.localizeMessage('admin.data_retention.form.boardsRetention', 'Boards retention')}
|
||||
placeholder={Utils.localizeMessage('admin.data_retention.form.boardsRetention', 'Boards retention')}
|
||||
name={'boards_retention'}
|
||||
inputType={'number'}
|
||||
dropdownClassNamePrefix={'boards_retention_dropdown'}
|
||||
inputId={'boards_retention_input'}
|
||||
/>
|
||||
</div>}
|
||||
</div>
|
||||
|
||||
</Card.Body>
|
||||
|
||||
@@ -708,7 +708,6 @@
|
||||
"admin.data_retention.customPoliciesTable.channelMessages": "Channel messages",
|
||||
"admin.data_retention.customPoliciesTable.description": "Description",
|
||||
"admin.data_retention.customTitle": "Custom Retention Policy",
|
||||
"admin.data_retention.form.boardsRetention": "Boards retention",
|
||||
"admin.data_retention.form.channelAndDirectMessageRetention": "Channel & direct message retention",
|
||||
"admin.data_retention.form.days": "Days",
|
||||
"admin.data_retention.form.fileRetention": "File retention",
|
||||
@@ -716,7 +715,6 @@
|
||||
"admin.data_retention.form.text": "Applies to all teams and channels, but does not apply to custom retention policies.",
|
||||
"admin.data_retention.form.years": "Years",
|
||||
"admin.data_retention.global_policy.form.numberError": "You must add a number greater than or equal to 1.",
|
||||
"admin.data_retention.globalPoliciesTable.boards": "Boards",
|
||||
"admin.data_retention.globalPoliciesTable.channelMessages": "Channel messages",
|
||||
"admin.data_retention.globalPoliciesTable.delete": "Delete",
|
||||
"admin.data_retention.globalPoliciesTable.description": "Description",
|
||||
|
||||
@@ -790,10 +790,8 @@ export type BleveSettings = {
|
||||
export type DataRetentionSettings = {
|
||||
EnableMessageDeletion: boolean;
|
||||
EnableFileDeletion: boolean;
|
||||
EnableBoardsDeletion: boolean;
|
||||
MessageRetentionDays: number;
|
||||
FileRetentionDays: number;
|
||||
BoardsRetentionDays: number;
|
||||
DeletionJobStartTime: string;
|
||||
BatchSize: number;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user