Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/release-7.0.0' into migration-to…
Browse files Browse the repository at this point in the history
…-remove-redundant-indexes
  • Loading branch information
ggazzo committed Oct 15, 2024
2 parents e169558 + 11a47b6 commit d211d3f
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 15 deletions.
5 changes: 5 additions & 0 deletions .changeset/rare-hats-lie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": major
---

Changes End-to-end encryption default setting to enable mention in encrypted messages
2 changes: 1 addition & 1 deletion apps/meteor/server/settings/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const createE2ESettings = () =>
enableQuery: { _id: 'E2E_Enable', value: true },
});

await this.add('E2E_Enabled_Mentions', false, {
await this.add('E2E_Enabled_Mentions', true, {
type: 'boolean',
public: true,
enableQuery: { _id: 'E2E_Enable', value: true },
Expand Down
1 change: 1 addition & 0 deletions apps/meteor/server/startup/migrations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,6 @@ import './v308';
import './v309';
import './v310';
import './v311';
import './v312';

export * from './xrun';
25 changes: 13 additions & 12 deletions apps/meteor/server/startup/migrations/v311.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
import { LivechatRooms, Rooms, Subscriptions, Users } from '@rocket.chat/models';
import { Settings } from '@rocket.chat/models';

import { addMigration } from '../../lib/migrations';

addMigration({
version: 311,
name: 'Update default behavior of E2E_Enabled_Mentions setting, to allow mentions in encrypted messages by default.',
async up() {
try {
await Promise.allSettled([
LivechatRooms.col.dropIndex('v.token_1'),
Rooms.col.dropIndex('t_1'),
Subscriptions.col.dropIndex('rid_1'),
Users.col.dropIndex('active_1'),
]);
} catch (error: unknown) {
console.warn('Error dropping redundant indexes, continuing...');
console.warn(error);
}
await Settings.updateOne(
{
_id: 'E2E_Enabled_Mentions',
},
{
$set: {
value: true,
packageValue: true,
},
},
);
},
});
20 changes: 20 additions & 0 deletions apps/meteor/server/startup/migrations/v312.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { LivechatRooms, Rooms, Subscriptions, Users } from '@rocket.chat/models';

import { addMigration } from '../../lib/migrations';

addMigration({
version: 312,
async up() {
try {
await Promise.allSettled([
LivechatRooms.col.dropIndex('v.token_1'),
Rooms.col.dropIndex('t_1'),
Subscriptions.col.dropIndex('rid_1'),
Users.col.dropIndex('active_1'),
]);
} catch (error: unknown) {
console.warn('Error dropping redundant indexes, continuing...');
console.warn(error);
}
},
});
2 changes: 0 additions & 2 deletions apps/meteor/tests/e2e/e2e-encryption.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,11 @@ test.describe.serial('e2e-encryption', () => {

test.beforeAll(async ({ api }) => {
expect((await api.post('/settings/E2E_Allow_Unencrypted_Messages', { value: true })).status()).toBe(200);
expect((await api.post('/settings/E2E_Enabled_Mentions', { value: true })).status()).toBe(200);
});

test.afterAll(async ({ api }) => {
expect((await api.post('/settings/E2E_Enable', { value: false })).status()).toBe(200);
expect((await api.post('/settings/E2E_Allow_Unencrypted_Messages', { value: false })).status()).toBe(200);
expect((await api.post('/settings/E2E_Enabled_Mentions', { value: false })).status()).toBe(200);
});

test('expect create a private channel encrypted and send an encrypted message', async ({ page }) => {
Expand Down

0 comments on commit d211d3f

Please sign in to comment.