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

chore(name): code clean

上级 fa6e0652
......@@ -474,8 +474,8 @@ export class Message implements Sayable {
log.verbose('Message', 'mentioned(%s),get mentionList: %s', this.content(), JSON.stringify(mentionList))
contactList = [].concat.apply([],
mentionList.map(member => {
room.memberAll(member)
mentionList.map(nameStr => {
room.memberAll(nameStr)
})
.filter(contact => !!contact),
)
......
......@@ -438,7 +438,7 @@ export class Room extends EventEmitter implements Sayable {
/**
* We got filter parameter
*/
log.silly('Room', 'member({ %s })',
log.silly('Room', 'memberAll({ %s })',
Object.keys(queryArg)
.map(k => `${k}: ${queryArg[k]}`)
.join(', '),
......@@ -452,7 +452,7 @@ export class Room extends EventEmitter implements Sayable {
log.warn('Room', 'member() not ready')
return []
}
let filterKey = Object.keys(queryArg)[0]
const filterKey = Object.keys(queryArg)[0]
/**
* ISSUE #64 emoji need to be striped
*/
......@@ -465,20 +465,20 @@ export class Room extends EventEmitter implements Sayable {
roomAlias: 'roomAliasMap',
}
filterKey = keyMap[filterKey]
if (!filterKey) {
throw new Error('unsupport filter key')
const filterMapName = keyMap[filterKey]
if (!filterMapName) {
throw new Error('unsupport filter key: ' + filterKey)
}
if (!filterValue) {
throw new Error('filterValue not found')
}
const filterMap = this.obj[filterKey]
const filterMap = this.obj[filterMapName]
const idList = Object.keys(filterMap)
.filter(k => filterMap[k] === filterValue)
.filter(id => filterMap[id] === filterValue)
log.silly('Room', 'member() check %s from %s: %s', filterValue, filterKey, JSON.stringify(filterMap))
log.silly('Room', 'memberAll() check %s from %s: %s', filterValue, filterKey, JSON.stringify(filterMap))
if (idList.length) {
return idList.map(id => Contact.load(id))
......@@ -499,7 +499,7 @@ export class Room extends EventEmitter implements Sayable {
}
if (memberList.length > 1) {
log.warn('Room', 'function member(%s) get %d contacts, use the first one by default', JSON.stringify(queryArg), memberList.length)
log.warn('Room', 'member(%s) get %d contacts, use the first one by default', JSON.stringify(queryArg), memberList.length)
}
return memberList[0]
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册