From 5ff07a65fe7719ed67568492e289165383180928 Mon Sep 17 00:00:00 2001 From: Djorkaeff Alexandre Date: Mon, 18 Nov 2019 14:50:00 -0300 Subject: [PATCH] [FIX] Server Version (#1392) --- app/lib/methods/getCustomEmojis.js | 2 +- app/lib/methods/getPermissions.js | 2 +- app/lib/rocketchat.js | 2 +- app/sagas/selectServer.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/lib/methods/getCustomEmojis.js b/app/lib/methods/getCustomEmojis.js index d7dd56580..9454b9013 100644 --- a/app/lib/methods/getCustomEmojis.js +++ b/app/lib/methods/getCustomEmojis.js @@ -91,7 +91,7 @@ export function getCustomEmojis() { const updatedSince = await getUpdatedSince(allRecords); // if server version is lower than 0.75.0, fetches from old api - if (semver.lt(serverVersion, '0.75.0')) { + if (serverVersion && semver.lt(serverVersion, '0.75.0')) { // RC 0.61.0 const result = await this.sdk.get('emoji-custom'); diff --git a/app/lib/methods/getPermissions.js b/app/lib/methods/getPermissions.js index b6a2dcd02..0d3829808 100644 --- a/app/lib/methods/getPermissions.js +++ b/app/lib/methods/getPermissions.js @@ -79,7 +79,7 @@ export default function() { const allRecords = await permissionsCollection.query().fetch(); // if server version is lower than 0.73.0, fetches from old api - if (semver.lt(serverVersion, '0.73.0')) { + if (serverVersion && semver.lt(serverVersion, '0.73.0')) { // RC 0.66.0 const result = await this.sdk.get('permissions.list'); if (!result.success) { diff --git a/app/lib/rocketchat.js b/app/lib/rocketchat.js index d9986abf3..17adcdc8b 100644 --- a/app/lib/rocketchat.js +++ b/app/lib/rocketchat.js @@ -1031,7 +1031,7 @@ const RocketChat = { const serverVersion = reduxStore.getState().server.version; // if server is lower than 1.1.0 - if (semver.lt(semver.coerce(serverVersion), '1.1.0')) { + if (serverVersion && semver.lt(semver.coerce(serverVersion), '1.1.0')) { if (this.activeUsersSubTimeout) { clearTimeout(this.activeUsersSubTimeout); this.activeUsersSubTimeout = false; diff --git a/app/sagas/selectServer.js b/app/sagas/selectServer.js index 64795ede2..f453b7270 100644 --- a/app/sagas/selectServer.js +++ b/app/sagas/selectServer.js @@ -22,7 +22,7 @@ import { SERVERS, TOKEN, SERVER_URL } from '../constants/userDefaults'; const getServerInfo = function* getServerInfo({ server, raiseError = true }) { try { const serverInfo = yield RocketChat.getServerInfo(server); - let websocketInfo = true; + let websocketInfo = { success: true }; if (raiseError) { websocketInfo = yield RocketChat.getWebsocketInfo({ server }); }