mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 08:38:42 +08:00
35 lines
1.0 KiB
JavaScript
35 lines
1.0 KiB
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() {
|
|
console.log(this);
|
|
return this.get('missing_versions_count') === 0 || this.get('missing_versions_count') === null;
|
|
}.property('missing_versions_count'),
|
|
|
|
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 Discourse.ajax({ url: Discourse.getURL('/admin/version_check'), dataType: 'json' }).then(function(json) {
|
|
return Discourse.VersionCheck.create(json);
|
|
});
|
|
}
|
|
});
|