- adjust for new undefined return value of new cookies package - add some error handling in case we think we're logged in, but really aren't
This commit is contained in:
parent
ff0b81e0f0
commit
8b459d69e3
@ -35,7 +35,7 @@ var GdataExtension = {};
|
||||
|
||||
GdataExtension.isAuthorized = function() {
|
||||
// TODO: Unreliable - just means that we were authorized at one point
|
||||
return Cookies.get('oauth2_token') !== null;
|
||||
return Cookies.get('oauth2_token') != null;
|
||||
};
|
||||
|
||||
GdataExtension.showAuthorizationDialog = function(onAuthorized, onNotAuthorized) {
|
||||
|
@ -128,10 +128,6 @@ Refine.GDataSourceUI.prototype._listDocuments = function() {
|
||||
Refine.GDataSourceUI.prototype._renderDocuments = function(o) {
|
||||
var self = this;
|
||||
|
||||
if (!o.documents) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._elmts.listingContainer.empty();
|
||||
|
||||
var table = $(
|
||||
@ -186,17 +182,23 @@ Refine.GDataSourceUI.prototype._renderDocuments = function(o) {
|
||||
.appendTo(td);
|
||||
};
|
||||
|
||||
var docs = o.documents;
|
||||
$.each(docs, function() {
|
||||
this.updatedDate = (this.updated) ? new Date(this.updated) : null;
|
||||
this.updatedDateTime = (this.updatedDate) ? this.updatedDate.getTime() : 0;
|
||||
});
|
||||
docs.sort(function(a, b) { return b.updatedDateTime - a.updatedDateTime; });
|
||||
|
||||
for (var i = 0; i < docs.length; i++) {
|
||||
renderDocument(docs[i]);
|
||||
if (o.status === 'error') {
|
||||
// We're probably not logged in, even though we thought we were. Show signin page
|
||||
this._body.find('.gdata-page').hide();
|
||||
this._elmts.signinPage.show();
|
||||
} else {
|
||||
var docs = o.documents;
|
||||
$.each(docs, function() {
|
||||
this.updatedDate = (this.updated) ? new Date(this.updated) : null;
|
||||
this.updatedDateTime = (this.updatedDate) ? this.updatedDate.getTime() : 0;
|
||||
});
|
||||
docs.sort(function(a, b) { return b.updatedDateTime - a.updatedDateTime; });
|
||||
|
||||
for (var i = 0; i < docs.length; i++) {
|
||||
renderDocument(docs[i]);
|
||||
}
|
||||
|
||||
this._body.find('.gdata-page').hide();
|
||||
this._elmts.listingPage.show();
|
||||
}
|
||||
|
||||
this._body.find('.gdata-page').hide();
|
||||
this._elmts.listingPage.show();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user