added google sign-in functionality to the client, with minor model modifications

Этот коммит содержится в:
JoramWilander
2015-08-14 08:43:49 -04:00
родитель e27db2ed63
Коммит b704e9489b
11 изменённых файлов: 137 добавлений и 82 удалений

Просмотреть файл

@@ -4,6 +4,7 @@
var AppDispatcher = require('../dispatcher/app_dispatcher.jsx');
var EventEmitter = require('events').EventEmitter;
var assign = require('object-assign');
var client = require('../utils/client.jsx');
var Constants = require('../utils/constants.jsx');
var ActionTypes = Constants.ActionTypes;
@@ -72,7 +73,7 @@ var UserStore = assign({}, EventEmitter.prototype, {
BrowserStore.setGlobalItem('current_user_id', id);
}
},
getCurrentId: function() {
getCurrentId: function(skipFetch) {
var currentId = this.gCurrentId;
if (currentId == null) {
@@ -80,6 +81,17 @@ var UserStore = assign({}, EventEmitter.prototype, {
this.gCurrentId = currentId;
}
// this is a special case to force fetch the
// current user if it's missing
// it's synchronous to block rendering
if (currentId == null && !skipFetch) {
var me = client.getMeSynchronous();
if (me != null) {
this.setCurrentUser(me);
currentId = me.id;
}
}
return currentId;
},
getCurrentUser: function() {