refactor: 重寫 Chat 成員邏輯
* 不再區分 user_a/b, 直接使用 members_list 雙成員模式 * 爲以後群聊打下基礎
This commit is contained in:
@@ -13,8 +13,10 @@ export default class ChatPrivate extends Chat {
|
||||
|
||||
static createForPrivate(userA: User, userB: User) {
|
||||
const chat = this.create(this.getChatIdByUsersId(userA.bean.id, userB.bean.id), 'private')
|
||||
chat.setAttr('user_a_id', userA.bean.id)
|
||||
chat.setAttr('user_b_id', userB.bean.id)
|
||||
chat.setMembers([
|
||||
userA.bean.id,
|
||||
userB.bean.id
|
||||
])
|
||||
}
|
||||
static findByUsersForPrivate(userA: User, userB: User) {
|
||||
const chat = this.findById(this.getChatIdByUsersId(userA.bean.id, userB.bean.id))
|
||||
|
||||
Reference in New Issue
Block a user