diff options
author | Christopher Speller <crspeller@gmail.com> | 2015-08-18 08:47:35 -0400 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2015-08-18 08:47:35 -0400 |
commit | 2f1dcf6f5267ecf85d14c8a36a9d3059a5d41218 (patch) | |
tree | 1de5578c9050a33635960fc046fdf97339254be0 /web/react/stores/user_store.jsx | |
parent | 96d1eb1c800a427e31e63970e57d0824a3bc91e3 (diff) | |
parent | a7f09be9783f3354ab38d4fb4fb82085241d018f (diff) | |
download | chat-2f1dcf6f5267ecf85d14c8a36a9d3059a5d41218.tar.gz chat-2f1dcf6f5267ecf85d14c8a36a9d3059a5d41218.tar.bz2 chat-2f1dcf6f5267ecf85d14c8a36a9d3059a5d41218.zip |
Merge pull request #381 from mattermost/mm-1705
MM-1705 add google as an oauth single-sign-on service
Diffstat (limited to 'web/react/stores/user_store.jsx')
-rw-r--r-- | web/react/stores/user_store.jsx | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/web/react/stores/user_store.jsx b/web/react/stores/user_store.jsx index f8616c6ab..248495dac 100644 --- a/web/react/stores/user_store.jsx +++ b/web/react/stores/user_store.jsx @@ -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() { |