Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the update check not working #17809

Merged
merged 2 commits into from Jun 3, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/version-check/server/functions/checkVersionUpdate.js
Expand Up @@ -44,7 +44,7 @@ export default () => {
sendMessagesToAdmins({
msgs: ({ adminUser }) => [{ msg: `*${ TAPi18n.__('Update_your_RocketChat', adminUser.language) }*\n${ TAPi18n.__('New_version_available_(s)', update.lastestVersion.version, adminUser.language) }\n${ update.lastestVersion.infoUrl }` }],
banners: [{
id: 'versionUpdate',
id: `versionUpdate-${ update.lastestVersion.version }`.replace(/\./g, '_'),
priority: 10,
title: 'Update_your_RocketChat',
text: 'New_version_available_(s)',
Expand All @@ -62,7 +62,7 @@ export default () => {
msg: `*${ TAPi18n.__('Rocket_Chat_Alert', adminUser.language) }:*\n\n*${ TAPi18n.__(alert.title, adminUser.language) }*\n${ TAPi18n.__(alert.text, ...alert.textArguments || [], adminUser.language) }\n${ alert.infoUrl }`,
})),
banners: alerts.map((alert) => ({
id: `alert-${ alert.id }`,
id: `alert-${ alert.id }`.replace(/\./g, '_'),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed because otherwise with a dot its inserting and nesting. So like in the version one it was nesting like:

versionUpdate-3: {
 '3': {
    '0': banner
   }
}

priority: 10,
title: alert.title,
text: alert.text,
Expand Down
12 changes: 6 additions & 6 deletions app/version-check/server/functions/getNewUpdates.js
Expand Up @@ -2,7 +2,6 @@ import os from 'os';

import { HTTP } from 'meteor/http';
import { check, Match } from 'meteor/check';
import { MongoInternals } from 'meteor/mongo';

import { Settings } from '../../../models';
import { Info } from '../../../utils';
Expand All @@ -11,14 +10,11 @@ import { getWorkspaceAccessToken } from '../../../cloud/server';
export default () => {
try {
const uniqueID = Settings.findOne('uniqueID');
const { _oplogHandle } = MongoInternals.defaultRemoteCollectionDriver().mongo;
const oplogEnabled = _oplogHandle && _oplogHandle.onOplogEntry;

const params = {
uniqueId: uniqueID.value,
installedAt: uniqueID.createdAt,
installedAt: uniqueID.createdAt.toJSON(),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is another reason why the previous version won't work. Sadly, meteor has an issue parameterizing date objects.

version: Info.version,
oplogEnabled,
osType: os.type(),
osPlatform: os.platform(),
osArch: os.arch(),
Expand All @@ -40,7 +36,11 @@ export default () => {
});

check(data, Match.ObjectIncluding({
versions: [String],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is one reason why the previous version won't work.

versions: [Match.ObjectIncluding({
version: Match.Optional(String),
security: Match.Optional(Boolean),
infoUrl: Match.Optional(String),
})],
alerts: Match.Optional([Match.ObjectIncluding({
id: Match.Optional(String),
title: Match.Optional(String),
Expand Down