Attempt to fix startPM

This commit is contained in:
abalabahaha
2016-03-11 22:12:15 -08:00
parent d2a9f15e82
commit ea80677a79
4 changed files with 4 additions and 16 deletions

View File

@@ -433,7 +433,7 @@ export default class InternalClient {
return Promise.reject(new Error("Unable to resolve resUser to a User"));
}
// start the PM
return this.apiRequest("post", Endpoints.USER_CHANNELS(user.id), true, {
return this.apiRequest("post", Endpoints.USER_CHANNELS(this.user.id), true, {
recipient_id: user.id
})
.then(res => {

View File

@@ -220,18 +220,12 @@ export default class Resolver {
}
if (resource instanceof User) {
// see if a PM exists
var chatFound = false;
for (var pmchat of this.internal.private_channels) {
if (pmchat.recipient.equals(resource)) {
chatFound = pmchat;
break;
return Promise.resolve(pmchat);
}
}
if (chatFound) {
// a PM already exists!
return Promise.resolve(chatFound);
}
// PM does not exist :\
return this.internal.startPM(resource);
}