0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

Removed outdated Ghost-Desktop client check (#1047)

closes https://github.com/TryGhost/Ghost/issues/9895
This commit is contained in:
Sumedh Nimkarde 2018-11-26 13:58:48 +05:30 committed by Kevin Ansfield
parent dd8fec7c1f
commit 276f9a9c80
2 changed files with 0 additions and 94 deletions

View file

@ -5,7 +5,6 @@ import Route from '@ember/routing/route';
import ShortcutsRoute from 'ghost-admin/mixins/shortcuts-route'; import ShortcutsRoute from 'ghost-admin/mixins/shortcuts-route';
import ctrlOrCmd from 'ghost-admin/utils/ctrl-or-cmd'; import ctrlOrCmd from 'ghost-admin/utils/ctrl-or-cmd';
import windowProxy from 'ghost-admin/utils/window-proxy'; import windowProxy from 'ghost-admin/utils/window-proxy';
import {htmlSafe} from '@ember/string';
import { import {
isAjaxError, isAjaxError,
isNotFoundError, isNotFoundError,
@ -53,7 +52,6 @@ export default Route.extend(ApplicationRouteMixin, ShortcutsRoute, {
if (this.get('session.isAuthenticated')) { if (this.get('session.isAuthenticated')) {
this.set('appLoadTransition', transition); this.set('appLoadTransition', transition);
transition.send('loadServerNotifications'); transition.send('loadServerNotifications');
transition.send('checkForOutdatedDesktopApp');
let featurePromise = this.get('feature').fetch(); let featurePromise = this.get('feature').fetch();
let settingsPromise = this.get('settings').fetch(); let settingsPromise = this.get('settings').fetch();
@ -113,26 +111,6 @@ export default Route.extend(ApplicationRouteMixin, ShortcutsRoute, {
} }
}, },
checkForOutdatedDesktopApp() {
// Check if the user is running an older version of Ghost Desktop
// that needs to be manually updated
// (yes, the desktop team is deeply ashamed of these lines 😢)
let ua = navigator && navigator.userAgent ? navigator.userAgent : null;
if (ua && ua.includes && ua.includes('ghost-desktop')) {
let updateCheck = /ghost-desktop\/0\.((5\.0)|((4|2)\.0)|((3\.)(0|1)))/;
let link = '<a href="https://dev.ghost.org/ghost-desktop-manual-update" target="_blank">click here</a>';
let msg = `Your version of Ghost Desktop needs to be manually updated. Please ${link} to get started.`;
if (updateCheck.test(ua)) {
this.get('notifications').showAlert(htmlSafe(msg), {
type: 'warn',
key: 'desktop.manual.upgrade'
});
}
}
},
// noop default for unhandled save (used from shortcuts) // noop default for unhandled save (used from shortcuts)
save: K, save: K,

View file

@ -1,72 +0,0 @@
import destroyApp from '../helpers/destroy-app';
import startApp from '../helpers/start-app';
import {afterEach, beforeEach, describe, it} from 'mocha';
import {authenticateSession} from 'ghost-admin/tests/helpers/ember-simple-auth';
import {expect} from 'chai';
const originalAgent = window.navigator.userAgent;
const setUserAgent = function (userAgent) {
let userAgentProp = {
get() {
return userAgent;
},
configurable: true
};
try {
Object.defineProperty(window.navigator, 'userAgent', userAgentProp);
} catch (e) {
window.navigator = Object.create(window.navigator, {
userAgent: userAgentProp
});
}
};
const restoreUserAgent = function () {
setUserAgent(originalAgent);
};
describe('Acceptance: Ghost Desktop', function () {
let application;
beforeEach(function () {
application = startApp();
});
afterEach(function () {
destroyApp(application);
});
describe('update alerts for broken versions', function () {
beforeEach(function () {
let role = server.create('role', {name: 'Administrator'});
server.create('user', {roles: [role]});
return authenticateSession(application);
});
afterEach(function () {
restoreUserAgent();
});
it('displays alert for broken version', async function () {
setUserAgent('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) ghost-desktop/0.4.0 Chrome/51.0.2704.84 Electron/1.2.2 Safari/537.36');
await visit('/');
// has an alert with matching text
expect(find('.gh-alert-blue').length, 'number of warning alerts').to.equal(1);
expect(find('.gh-alert-blue').text().trim(), 'alert text').to.match(/Your version of Ghost Desktop needs to be manually updated/);
});
it('doesn\'t display alert for working version', async function () {
setUserAgent('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) ghost-desktop/0.5.1 Chrome/51.0.2704.84 Electron/1.2.2 Safari/537.36');
await visit('/');
// no alerts
expect(find('.gh-alert').length, 'number of alerts').to.equal(0);
});
});
});