perf: 优化与离职账号聊天

This commit is contained in:
kuaifan 2024-12-02 09:11:25 +08:00
parent aa1ea41c5d
commit 4f57b195a8
3 changed files with 13 additions and 1 deletions

View File

@ -222,10 +222,14 @@ class User extends AbstractModel
/** /**
* 返回是否禁用帐号(离职) * 返回是否禁用帐号(离职)
* @param bool $incAt 是否包含禁用时间
* @return bool * @return bool
*/ */
public function isDisable() public function isDisable($incAt = false)
{ {
if ($incAt) {
return in_array('disable', $this->identity) || $this->disable_at;
}
return in_array('disable', $this->identity); return in_array('disable', $this->identity);
} }

View File

@ -291,6 +291,7 @@ class WebSocketDialog extends AbstractModel
$data['email'] = $basic->email; $data['email'] = $basic->email;
$data['userimg'] = $basic->userimg; $data['userimg'] = $basic->userimg;
$data['bot'] = $basic->getBotOwner(); $data['bot'] = $basic->getBotOwner();
$data['is_disable'] = $basic->isDisable(true);
$data['quick_msgs'] = UserBot::quickMsgs($basic->email); $data['quick_msgs'] = UserBot::quickMsgs($basic->email);
} else { } else {
$data['name'] = 'non-existent'; $data['name'] = 'non-existent';

View File

@ -260,6 +260,9 @@
<div v-if="isMute" class="chat-mute"> <div v-if="isMute" class="chat-mute">
{{$L('禁言发言')}} {{$L('禁言发言')}}
</div> </div>
<div v-else-if="isDisable" class="chat-mute">
{{$L('此账号已停用')}}
</div>
<ChatInput <ChatInput
v-else v-else
ref="input" ref="input"
@ -1126,6 +1129,10 @@ export default {
return false return false
}, },
isDisable() {
return this.dialogData.is_disable ?? false
},
quoteId() { quoteId() {
if (this.msgId > 0) { if (this.msgId > 0) {
return this.msgId return this.msgId