Skip to content
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 .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/models/client/models/ChatMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ChatMessageCollection extends Mongo.Collection<IMessage & { ignored?: bool

// TODO: check if we can dodge these missing typings from Meteor Collection Hooks
export const ChatMessage = new ChatMessageCollection() as unknown as Mongo.Collection<IMessage & { ignored?: boolean }> & {
direct: Mongo.Collection<IMessage, IMessage>;
direct: Mongo.Collection<Omit<IMessage, '_id'>, IMessage>;

queries: unknown[];
};
4 changes: 2 additions & 2 deletions apps/meteor/app/threads/client/flextab/thread.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type ThreadTemplateInstance = Blaze.TemplateInstance<{
}> & {
firstNode: HTMLElement;
Threads: Mongo.Collection<IMessage> & {
direct: Mongo.Collection<IMessage>;
direct: Mongo.Collection<Omit<IMessage, '_id'>, IMessage>;
queries: unknown[];
};
threadsObserve?: Meteor.LiveQueryHandle;
Expand Down Expand Up @@ -170,7 +170,7 @@ Template.thread.helpers({

Template.thread.onCreated(async function (this: ThreadTemplateInstance) {
this.Threads = new Mongo.Collection(null) as Mongo.Collection<IMessage> & {
direct: Mongo.Collection<IMessage>;
direct: Mongo.Collection<Omit<IMessage, '_id'>, IMessage>;
queries: unknown[];
};

Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/ui-utils/client/lib/RoomHistoryManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/app/ui/client/lib/ChatMessages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class ChatMessages {

constructor(
public collection: Mongo.Collection<IMessage> & {
direct: Mongo.Collection<IMessage>;
direct: Mongo.Collection<Omit<IMessage, '_id'>, IMessage>;
queries: unknown[];
} = ChatMessage,
) {}
Expand Down
25 changes: 17 additions & 8 deletions apps/meteor/client/startup/banners.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -20,14 +21,16 @@ const fetchInitialBanners = async (): Promise<void> => {
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;
Expand Down Expand Up @@ -78,6 +81,12 @@ Meteor.startup(() => {
return;
}

FlowRouter.watchPathChange();

if (FlowRouter.getRouteName() === 'setup-wizard') {
return;
}

unwatchBanners = Tracker.nonreactive(watchBanners);
});
});
6 changes: 6 additions & 0 deletions apps/meteor/ee/app/license/server/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions apps/meteor/tests/end-to-end/api/20-licenses.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand All @@ -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);
});
Expand Down
25 changes: 24 additions & 1 deletion apps/meteor/tests/end-to-end/api/26-LDAP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);
});
});
});