diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 9a323cc53e311..50138d215a3c2 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -494,7 +494,7 @@ jobs: cd ./apps/meteor for i in $(seq 1 5); do - npm run testapi && s=0 && break || s=$?; + IS_EE=true npm run testapi && s=0 && break || s=$?; docker compose -f ../../docker-compose-ci.yml logs --tail=100 diff --git a/apps/meteor/app/models/client/models/ChatMessage.ts b/apps/meteor/app/models/client/models/ChatMessage.ts index 20b2bc916347d..2b039db75a25a 100644 --- a/apps/meteor/app/models/client/models/ChatMessage.ts +++ b/apps/meteor/app/models/client/models/ChatMessage.ts @@ -26,7 +26,7 @@ class ChatMessageCollection extends Mongo.Collection & { - direct: Mongo.Collection; + direct: Mongo.Collection, IMessage>; queries: unknown[]; }; diff --git a/apps/meteor/app/threads/client/flextab/thread.ts b/apps/meteor/app/threads/client/flextab/thread.ts index 1bd4569ae07b8..585716f519479 100644 --- a/apps/meteor/app/threads/client/flextab/thread.ts +++ b/apps/meteor/app/threads/client/flextab/thread.ts @@ -28,7 +28,7 @@ type ThreadTemplateInstance = Blaze.TemplateInstance<{ }> & { firstNode: HTMLElement; Threads: Mongo.Collection & { - direct: Mongo.Collection; + direct: Mongo.Collection, IMessage>; queries: unknown[]; }; threadsObserve?: Meteor.LiveQueryHandle; @@ -170,7 +170,7 @@ Template.thread.helpers({ Template.thread.onCreated(async function (this: ThreadTemplateInstance) { this.Threads = new Mongo.Collection(null) as Mongo.Collection & { - direct: Mongo.Collection; + direct: Mongo.Collection, IMessage>; queries: unknown[]; }; diff --git a/apps/meteor/app/ui-utils/client/lib/RoomHistoryManager.ts b/apps/meteor/app/ui-utils/client/lib/RoomHistoryManager.ts index 7ce23fd5eb9d6..8e477ca074c18 100644 --- a/apps/meteor/app/ui-utils/client/lib/RoomHistoryManager.ts +++ b/apps/meteor/app/ui-utils/client/lib/RoomHistoryManager.ts @@ -59,7 +59,7 @@ export async function upsertMessage( ); } - return direct.upsert({ _id }, { $set: messageToUpsert }); + return direct.upsert({ _id }, messageToUpsert); } export function upsertMessageBulk({ msgs, subscription }: { msgs: IMessage[]; subscription?: ISubscription }, collection = ChatMessage) { diff --git a/apps/meteor/app/ui/client/lib/ChatMessages.ts b/apps/meteor/app/ui/client/lib/ChatMessages.ts index c0a84ed4dd8f0..a41015e8bf85c 100644 --- a/apps/meteor/app/ui/client/lib/ChatMessages.ts +++ b/apps/meteor/app/ui/client/lib/ChatMessages.ts @@ -55,7 +55,7 @@ export class ChatMessages { constructor( public collection: Mongo.Collection & { - direct: Mongo.Collection; + direct: Mongo.Collection, IMessage>; queries: unknown[]; } = ChatMessage, ) {} diff --git a/apps/meteor/client/startup/banners.ts b/apps/meteor/client/startup/banners.ts index 57dbf8351bd98..776d54501343e 100644 --- a/apps/meteor/client/startup/banners.ts +++ b/apps/meteor/client/startup/banners.ts @@ -1,4 +1,5 @@ import { BannerPlatform } from '@rocket.chat/core-typings'; +import { FlowRouter } from 'meteor/kadira:flow-router'; import { Meteor } from 'meteor/meteor'; import { Tracker } from 'meteor/tracker'; @@ -20,14 +21,16 @@ const fetchInitialBanners = async (): Promise => { if (!user?.username) { return; } - setTimeout(() => { - imperativeModal.open({ - component: DeviceManagementFeatureModal, - props: { - close: imperativeModal.close, - }, - }); - }, 2000); + + process.env.TEST_MODE && + setTimeout(() => { + imperativeModal.open({ + component: DeviceManagementFeatureModal, + props: { + close: imperativeModal.close, + }, + }); + }, 2000); computation.stop(); }); continue; @@ -78,6 +81,12 @@ Meteor.startup(() => { return; } + FlowRouter.watchPathChange(); + + if (FlowRouter.getRouteName() === 'setup-wizard') { + return; + } + unwatchBanners = Tracker.nonreactive(watchBanners); }); }); diff --git a/apps/meteor/ee/app/license/server/settings.js b/apps/meteor/ee/app/license/server/settings.js index 27867ee7fccf6..f921993a5d406 100644 --- a/apps/meteor/ee/app/license/server/settings.js +++ b/apps/meteor/ee/app/license/server/settings.js @@ -25,6 +25,10 @@ settings.watch('Enterprise_License', (license) => { return; } + if (license === process.env.ROCKETCHAT_LICENSE) { + return; + } + if (!addLicense(license)) { Settings.updateValueById('Enterprise_License_Status', 'Invalid'); return; @@ -34,6 +38,8 @@ settings.watch('Enterprise_License', (license) => { }); if (process.env.ROCKETCHAT_LICENSE) { + addLicense(process.env.ROCKETCHAT_LICENSE); + Meteor.startup(() => { if (settings.get('Enterprise_License')) { console.warn( diff --git a/apps/meteor/tests/end-to-end/api/20-licenses.js b/apps/meteor/tests/end-to-end/api/20-licenses.js index 307ff1810dfe4..ea049a8ec65c9 100644 --- a/apps/meteor/tests/end-to-end/api/20-licenses.js +++ b/apps/meteor/tests/end-to-end/api/20-licenses.js @@ -124,7 +124,7 @@ describe('licenses', function () { .expect('Content-Type', 'application/json') .expect(200) .expect((res) => { - expect(res.body).to.have.property('isEnterprise', false); + expect(res.body).to.have.property('isEnterprise', Boolean(process.env.IS_EE)); }) .end(done); }); @@ -136,7 +136,7 @@ describe('licenses', function () { .expect('Content-Type', 'application/json') .expect(200) .expect((res) => { - expect(res.body).to.have.property('isEnterprise', false); + expect(res.body).to.have.property('isEnterprise', Boolean(process.env.IS_EE)); }) .end(done); }); diff --git a/apps/meteor/tests/end-to-end/api/26-LDAP.ts b/apps/meteor/tests/end-to-end/api/26-LDAP.ts index 225dd36abe39b..408a436cb7313 100644 --- a/apps/meteor/tests/end-to-end/api/26-LDAP.ts +++ b/apps/meteor/tests/end-to-end/api/26-LDAP.ts @@ -9,7 +9,13 @@ describe('LDAP', function () { before((done) => getCredentials(done)); describe('[/ldap.syncNow]', () => { - it('should throw an error containing totp-required error ', (done) => { + it('should throw an error containing totp-required error when not running EE', function (done) { + // TODO this is not the right way to do it. We're doing this way for now just because we have separate CI jobs for EE and CE, + // ideally we should have a single CI job that adds a license and runs both CE and EE tests. + if (process.env.IS_EE) { + this.skip(); + return; + } request .post(api('ldap.syncNow')) .set(credentials) @@ -21,5 +27,22 @@ describe('LDAP', function () { }) .end(done); }); + + it('should throw an error of LDAP disabled when running EE', function (done) { + if (!process.env.IS_EE) { + this.skip(); + return; + } + request + .post(api('ldap.syncNow')) + .set(credentials) + .expect('Content-Type', 'application/json') + .expect(400) + .expect((res: Response) => { + expect(res.body).to.have.property('success', false); + expect(res.body).to.have.property('error', 'LDAP_disabled'); + }) + .end(done); + }); }); });