提交 97c8cb02 编写于 作者: Huan (李卓桓)'s avatar Huan (李卓桓)

use .id instead of .get("id") for better compatible

上级 ec4f62af
......@@ -19,7 +19,7 @@ class Contact {
this.obj = {}
}
toString() { return this.id }
toString() { return this.id }
toStringEx() { return `Contact(${this.obj.name}[${this.id}])` }
parse(rawObj) {
......@@ -40,7 +40,7 @@ class Contact {
, stranger: !!rawObj.stranger // assign by injectio.js
}
}
name() { return UtilLib.plainText(this.obj.name) }
remark() { return this.obj.remark }
stranger() { return this.obj.stranger }
......@@ -53,7 +53,7 @@ class Contact {
log.warn('Contact', 'ready() call on an un-inited contact')
return Promise.resolve(this)
}
if (this.obj.id) { // already ready
return Promise.resolve(this)
}
......@@ -86,7 +86,7 @@ class Contact {
static find() {
return new Contact('-1')
}
static findAll() {
return [
new Contact ('-2')
......
......@@ -164,6 +164,8 @@ class Bridge {
}
roomAddMember(roomId, contactId) {
log.verbose('PuppetWebBridge', 'roomAddMember(%s, %s)', roomId, contactId)
if (!roomId || !contactId) {
throw new Error('no roomId or contactId')
}
......
......@@ -356,8 +356,8 @@ class PuppetWeb extends Puppet {
if (!this.bridge) {
return Promise.reject(new Error('roomDelMember fail: no bridge(yet)!'))
}
const roomId = room.get('id')
const contactId = contact.get('id')
const roomId = room.id
const contactId = contact.id
return this.bridge.roomDelMember(roomId, contactId)
.catch(e => {
log.warn('PuppetWeb', 'roomDelMember(%s) rejected: %s', contact, e.message)
......@@ -369,8 +369,8 @@ class PuppetWeb extends Puppet {
if (!this.bridge) {
return Promise.reject(new Error('fail: no bridge(yet)!'))
}
const roomId = room.get('id')
const contactId = contact.get('id')
const roomId = room.id
const contactId = contact.id
return this.bridge.roomAddMember(roomId, contactId)
.catch(e => {
log.warn('PuppetWeb', 'roomAddMember(%s) rejected: %s', contact, e.message)
......@@ -382,7 +382,7 @@ class PuppetWeb extends Puppet {
if (!this.bridge) {
return Promise.reject(new Error('fail: no bridge(yet)!'))
}
const roomId = room.get('id')
const roomId = room.id
return this.bridge.roomModTopic(roomId, topic)
.catch(e => {
log.warn('PuppetWeb', 'roomModTopic(%s) rejected: %s', topic, e.message)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册