Skip to content

Commit

Permalink
fix: Notifications not working on old server versions (#2643)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanfbrito authored Apr 13, 2023
1 parent 6fc6b54 commit db6acf7
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/injected.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,19 @@ const start = (): void => {

window.RocketChatDesktop.setServerInfo(serverInfo);

function requireLegacyLibrary(path: string): any {
if (serverInfo.version.split('.')[0] >= 6) {
path += '/client/index.ts';
}
return window.require(path);
}

const { Meteor } = window.require('meteor/meteor');
const { Session } = window.require('meteor/session');
const { Tracker } = window.require('meteor/tracker');
const { UserPresence } = window.require('meteor/konecty:user-presence');
const { settings } = window.require('/app/settings/client/index.ts');
const { getUserPreference } = window.require('/app/utils/client/index.ts');
const { settings } = requireLegacyLibrary('/app/settings');
const { getUserPreference } = requireLegacyLibrary('/app/utils');

window.RocketChatDesktop.setUrlResolver(Meteor.absoluteUrl);

Expand Down

0 comments on commit db6acf7

Please sign in to comment.