summaryrefslogtreecommitdiffstats
path: root/sandstorm.js
diff options
context:
space:
mode:
authorDavid Renshaw <david@sandstorm.io>2016-10-09 18:55:51 -0400
committerDavid Renshaw <david@sandstorm.io>2016-11-03 23:42:00 -0400
commit43c180c247a82ed20b2bc9e2de493305f7f5a43b (patch)
tree2aed5026ed3e91832623ee1055a9591aa05ebe55 /sandstorm.js
parent349cdd4bf9b08f07a00d0576c78a3e71a18c1eb3 (diff)
downloadwekan-43c180c247a82ed20b2bc9e2de493305f7f5a43b.tar.gz
wekan-43c180c247a82ed20b2bc9e2de493305f7f5a43b.tar.bz2
wekan-43c180c247a82ed20b2bc9e2de493305f7f5a43b.zip
Make sure identities resolve before sending them to activity().
Diffstat (limited to 'sandstorm.js')
-rw-r--r--sandstorm.js17
1 files changed, 11 insertions, 6 deletions
diff --git a/sandstorm.js b/sandstorm.js
index dc4a0796..5a800b24 100644
--- a/sandstorm.js
+++ b/sandstorm.js
@@ -108,12 +108,17 @@ if (isSandstorm && Meteor.isServer) {
Meteor.wrapAsync((done) => {
return Promise.all(users.map((user) => {
return httpBridge.getSavedIdentity(user.id).then((response) => {
- return { identity: response.identity,
- mentioned: !!user.mentioned,
- subscribed: !!user.subscribed,
- };
- }).catch(() => {
- // Ignore identities that fail to restore. Probably they have lost access to the board.
+ // Call getProfile() to make sure that the identity successfully resolves.
+ // (In C++ we would instead call whenResolved() here.)
+ const identity = response.identity;
+ return identity.getProfile().then(() => {
+ return { identity,
+ mentioned: !!user.mentioned,
+ subscribed: !!user.subscribed,
+ };
+ }).catch(() => {
+ // Ignore identities that fail to resolve. Probably they have lost access to the board.
+ });
});
})).then((maybeUsers) => {
const users = maybeUsers.filter((u) => !!u);