2013-02-23 04:41:12 +08:00
|
|
|
/**
|
|
|
|
Our data model for determining whether there's a new version of Discourse
|
2013-02-21 02:15:50 +08:00
|
|
|
|
2013-02-23 04:41:12 +08:00
|
|
|
@class VersionCheck
|
|
|
|
@extends Discourse.Model
|
|
|
|
@namespace Discourse
|
|
|
|
@module Discourse
|
|
|
|
**/
|
|
|
|
Discourse.VersionCheck = Discourse.Model.extend({
|
|
|
|
upToDate: function() {
|
2013-04-18 23:45:10 +08:00
|
|
|
return this.get('missing_versions_count') === 0 || this.get('missing_versions_count') === null;
|
2013-04-15 23:00:29 +08:00
|
|
|
}.property('missing_versions_count'),
|
2013-03-06 07:14:51 +08:00
|
|
|
|
|
|
|
behindByOneVersion: function() {
|
|
|
|
return this.get('missing_versions_count') === 1;
|
|
|
|
}.property('missing_versions_count'),
|
2013-02-22 03:09:28 +08:00
|
|
|
|
2013-02-23 04:41:12 +08:00
|
|
|
gitLink: function() {
|
|
|
|
return "https://github.com/discourse/discourse/tree/" + this.get('installed_sha');
|
|
|
|
}.property('installed_sha'),
|
2013-02-22 04:03:43 +08:00
|
|
|
|
2013-02-23 04:41:12 +08:00
|
|
|
shortSha: function() {
|
|
|
|
return this.get('installed_sha').substr(0,10);
|
|
|
|
}.property('installed_sha')
|
|
|
|
});
|
2013-02-22 04:03:43 +08:00
|
|
|
|
2013-02-23 04:41:12 +08:00
|
|
|
Discourse.VersionCheck.reopenClass({
|
|
|
|
find: function() {
|
2013-05-08 01:30:12 +08:00
|
|
|
return Discourse.ajax('/admin/version_check').then(function(json) {
|
2013-03-15 02:45:29 +08:00
|
|
|
return Discourse.VersionCheck.create(json);
|
2013-02-23 04:41:12 +08:00
|
|
|
});
|
|
|
|
}
|
2013-03-14 20:01:52 +08:00
|
|
|
});
|