mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-30 10:58:31 -05:00
ad082cea70
- Support for a popup that shows similar topics - Cleaned up a lot of Javascript - Cleaned up use of Promises
33 lines
No EOL
976 B
JavaScript
33 lines
No EOL
976 B
JavaScript
/**
|
|
Our data model for determining whether there's a new version of Discourse
|
|
|
|
@class VersionCheck
|
|
@extends Discourse.Model
|
|
@namespace Discourse
|
|
@module Discourse
|
|
**/
|
|
Discourse.VersionCheck = Discourse.Model.extend({
|
|
upToDate: function() {
|
|
return this.get('latest_version') === this.get('installed_version');
|
|
}.property('latest_version', 'installed_version'),
|
|
|
|
behindByOneVersion: function() {
|
|
return this.get('missing_versions_count') === 1;
|
|
}.property('missing_versions_count'),
|
|
|
|
gitLink: function() {
|
|
return "https://github.com/discourse/discourse/tree/" + this.get('installed_sha');
|
|
}.property('installed_sha'),
|
|
|
|
shortSha: function() {
|
|
return this.get('installed_sha').substr(0,10);
|
|
}.property('installed_sha')
|
|
});
|
|
|
|
Discourse.VersionCheck.reopenClass({
|
|
find: function() {
|
|
return $.ajax({ url: '/admin/version_check', dataType: 'json' }).then(function(json) {
|
|
return Discourse.VersionCheck.create(json);
|
|
});
|
|
}
|
|
}); |