chore: 重命名易混淆的 ChatPrivate findFor 方法

This commit is contained in:
CrescentLeaf
2025-09-20 20:58:44 +08:00
parent dd88e8d1b8
commit 212c2fa5dc

View File

@@ -14,14 +14,14 @@ export default class ChatPrivate extends Chat {
static createForPrivate(userA: User, userB: User) { static createForPrivate(userA: User, userB: User) {
return this.create(this.getChatIdByUsersId(userA.bean.id, userB.bean.id), 'private') return this.create(this.getChatIdByUsersId(userA.bean.id, userB.bean.id), 'private')
} }
static findForPrivate(userA: User, userB: User) { static findByUsersForPrivate(userA: User, userB: User) {
return this.fromChat(this.findById(this.getChatIdByUsersId(userA.bean.id, userB.bean.id)) as Chat) return this.fromChat(this.findById(this.getChatIdByUsersId(userA.bean.id, userB.bean.id)) as Chat)
} }
static findOrCreateForPrivate(userA: User, userB: User) { static findOrCreateForPrivate(userA: User, userB: User) {
let a = this.findForPrivate(userA, userB) let a = this.findByUsersForPrivate(userA, userB)
if (a == null) { if (a == null) {
this.createForPrivate(userA, userB) this.createForPrivate(userA, userB)
a = this.findForPrivate(userA, userB) as ChatPrivate a = this.findByUsersForPrivate(userA, userB) as ChatPrivate
} }
return a return a
} }