Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Misleading labels in Prune Messages #18006

Merged
merged 3 commits into from
Jun 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/channel-settings/client/views/channelSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function roomExcludePinned(room) {
return room.retention.excludePinned;
}

return settings.get('RetentionPolicy_ExcludePinned');
return settings.get('RetentionPolicy_DoNotPrunePinned');
}

function roomHasGlobalPurge(room) {
Expand Down
12 changes: 6 additions & 6 deletions app/discussion/server/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,23 @@ Meteor.startup(() => {
value: true,
};

settings.add('RetentionPolicy_DoNotExcludeDiscussion', true, {
settings.add('RetentionPolicy_DoNotPruneDiscussion', true, {
group: 'RetentionPolicy',
section: 'Global Policy',
type: 'boolean',
public: true,
i18nLabel: 'RetentionPolicy_DoNotExcludeDiscussion',
i18nDescription: 'RetentionPolicy_DoNotExcludeDiscussion_Description',
i18nLabel: 'RetentionPolicy_DoNotPruneDiscussion',
i18nDescription: 'RetentionPolicy_DoNotPruneDiscussion_Description',
enableQuery: globalQuery,
});

settings.add('RetentionPolicy_DoNotExcludeThreads', true, {
settings.add('RetentionPolicy_DoNotPruneThreads', true, {
group: 'RetentionPolicy',
section: 'Global Policy',
type: 'boolean',
public: true,
i18nLabel: 'RetentionPolicy_DoNotExcludeThreads',
i18nDescription: 'RetentionPolicy_DoNotExcludeThreads_Description',
i18nLabel: 'RetentionPolicy_DoNotPruneThreads',
i18nDescription: 'RetentionPolicy_DoNotPruneThreads_Description',
enableQuery: globalQuery,
});
});
6 changes: 3 additions & 3 deletions app/retention-policy/server/cronPruneMessages.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ const toDays = (d) => d * 1000 * 60 * 60 * 24;
function job() {
const now = new Date();
const filesOnly = settings.get('RetentionPolicy_FilesOnly');
const excludePinned = settings.get('RetentionPolicy_ExcludePinned');
const ignoreDiscussion = settings.get('RetentionPolicy_DoNotExcludeDiscussion');
const ignoreThreads = settings.get('RetentionPolicy_DoNotExcludeThreads');
const excludePinned = settings.get('RetentionPolicy_DoNotPrunePinned');
const ignoreDiscussion = settings.get('RetentionPolicy_DoNotPruneDiscussion');
const ignoreThreads = settings.get('RetentionPolicy_DoNotPruneThreads');

// get all rooms with default values
types.forEach((type) => {
Expand Down
4 changes: 2 additions & 2 deletions app/retention-policy/server/startup/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ settings.addGroup('RetentionPolicy', function() {
}, globalQuery],
});

this.add('RetentionPolicy_ExcludePinned', false, {
this.add('RetentionPolicy_DoNotPrunePinned', false, {
type: 'boolean',
public: true,
i18nLabel: 'RetentionPolicy_ExcludePinned',
i18nLabel: 'RetentionPolicy_DoNotPrunePinned',
enableQuery: globalQuery,
});
this.add('RetentionPolicy_FilesOnly', false, {
Expand Down
6 changes: 3 additions & 3 deletions app/ui-clean-history/client/views/cleanHistory.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,17 @@
<label class="rc-checkbox">
<input type="checkbox" name="excludePinned" class="rc-checkbox__input">
{{> icon icon="check" block="rc-checkbox__icon"}}
<span class="rc-checkbox__text rc-text__small">{{_ "Exclude_pinned"}}</span>
<span class="rc-checkbox__text rc-text__small">{{_ "RetentionPolicy_DoNotPrunePinned"}}</span>
</label>
<label class="rc-checkbox">
<input type="checkbox" name="ignoreDiscussion" class="rc-checkbox__input">
{{> icon icon="check" block="rc-checkbox__icon"}}
<span class="rc-checkbox__text rc-text__small">{{_ "RetentionPolicy_DoNotExcludeDiscussion"}}</span>
<span class="rc-checkbox__text rc-text__small">{{_ "RetentionPolicy_DoNotPruneDiscussion"}}</span>
</label>
<label class="rc-checkbox">
<input type="checkbox" name="ignoreThreads" class="rc-checkbox__input">
{{> icon icon="check" block="rc-checkbox__icon"}}
<span class="rc-checkbox__text rc-text__small">{{_ "RetentionPolicy_DoNotExcludeThreads"}}</span>
<span class="rc-checkbox__text rc-text__small">{{_ "RetentionPolicy_DoNotPruneThreads"}}</span>
</label>
<label class="rc-checkbox">
<input type="checkbox" name="filesOnly" class="rc-checkbox__input">
Expand Down
2 changes: 1 addition & 1 deletion app/ui/client/views/app/room.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ function roomExcludePinned(room) {
return room.retention.excludePinned;
}

return settings.get('RetentionPolicy_ExcludePinned');
return settings.get('RetentionPolicy_DoNotPrunePinned');
}

function roomMaxAge(room) {
Expand Down
6 changes: 3 additions & 3 deletions packages/rocketchat-i18n/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -2972,8 +2972,8 @@
"Retail": "Retail",
"Retention_setting_changed_successfully": "Retention policy setting changed successfully",
"RetentionPolicy": "Retention Policy",
"RetentionPolicy_DoNotExcludeDiscussion": "Do not exclude discussion messages",
"RetentionPolicy_DoNotExcludeThreads": "Do not exclude Threads",
"RetentionPolicy_DoNotPruneDiscussion": "Do not prune discussion messages",
"RetentionPolicy_DoNotPruneThreads": "Do not prune Threads",
"RetentionPolicy_RoomWarning": "Messages older than __time__ are automatically pruned here",
"RetentionPolicy_RoomWarning_Unpinned": "Unpinned messages older than __time__ are automatically pruned here",
"RetentionPolicy_RoomWarning_FilesOnly": "Files older than __time__ are automatically pruned here (messages stay intact)",
Expand All @@ -2983,7 +2983,7 @@
"RetentionPolicy_AppliesToChannels": "Applies to channels",
"RetentionPolicy_AppliesToGroups": "Applies to private groups",
"RetentionPolicy_AppliesToDMs": "Applies to direct messages",
"RetentionPolicy_ExcludePinned": "Exclude pinned messages",
"RetentionPolicy_DoNotPrunePinned": "Do not prune pinned messages",
"RetentionPolicy_FilesOnly": "Only delete files",
"RetentionPolicy_FilesOnly_Description": "Only files will be deleted, the messages themselves will stay in place.",
"RetentionPolicy_MaxAge": "Maximum message age",
Expand Down
1 change: 1 addition & 0 deletions server/startup/migrations/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,4 +194,5 @@ import './v194';
import './v195';
import './v196';
import './v197';
import './v198';
import './xrun';
45 changes: 45 additions & 0 deletions server/startup/migrations/v198.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { Settings } from '../../../app/models/server';
import { Migrations } from '../../../app/migrations/server';

Migrations.add({
version: 198,
up: () => {
const discussion = Settings.findOneById('RetentionPolicy_DoNotExcludeDiscussion');
const thread = Settings.findOneById('RetentionPolicy_DoNotExcludeThreads');
const pinned = Settings.findOneById('RetentionPolicy_ExcludePinned');

if (discussion) {
Settings.upsert({
_id: 'RetentionPolicy_DoNotPruneDiscussion',
}, {
$set: {
value: discussion.value,
},
});
}

if (thread) {
Settings.upsert({
_id: 'RetentionPolicy_DoNotPruneThreads',
}, {
$set: {
value: thread.value,
},
});
}

if (pinned) {
Settings.upsert({
_id: 'RetentionPolicy_DoNotPrunePinned',
}, {
$set: {
value: pinned.value,
},
});
}

Settings.remove({
_id: { $in: ['RetentionPolicy_DoNotExcludeDiscussion', 'RetentionPolicy_DoNotExcludeThreads', 'RetentionPolicy_ExcludePinned'] },
});
},
});