fix: 员工删除后对话还存在的问题

This commit is contained in:
kuaifan 2022-06-13 15:53:58 +08:00
parent e2b2da8b46
commit 11308829a6
2 changed files with 20 additions and 4 deletions

View File

@ -84,16 +84,32 @@ class WebSocketDialog extends AbstractModel
if ($dialog_user->userid === 0) {
$dialog_user->userid = $userid;
}
$this->name = User::userid2nickname($dialog_user->userid);
$basic = User::userid2basic($dialog_user->userid);
if ($basic) {
$this->name = $basic->nickname;
} else {
$this->name = 'non-existent';
$this->dialog_delete = 1;
}
$this->dialog_user = $dialog_user;
break;
case "group":
if ($this->group_type === 'project') {
$this->group_info = Project::withTrashed()->select(['id', 'name', 'archived_at', 'deleted_at'])->whereDialogId($this->id)->first()?->cancelAppend()->cancelHidden();
$this->name = $this->group_info ? $this->group_info->name : '';
if ($this->group_info) {
$this->name = $this->group_info->name;
} else {
$this->name = '[Delete]';
$this->dialog_delete = 1;
}
} elseif ($this->group_type === 'task') {
$this->group_info = ProjectTask::withTrashed()->select(['id', 'name', 'complete_at', 'archived_at', 'deleted_at'])->whereDialogId($this->id)->first()?->cancelAppend()->cancelHidden();
$this->name = $this->group_info ? $this->group_info->name : '';
if ($this->group_info) {
$this->name = $this->group_info->name;
} else {
$this->name = '[Delete]';
$this->dialog_delete = 1;
}
}
break;
}

View File

@ -414,7 +414,7 @@ export default {
if ($A.getDialogUnread(dialog) > 0 || dialog.id == this.dialogId || dialog.top_at) {
return true
}
if (dialog.name === undefined) {
if (dialog.name === undefined || dialog.dialog_delete === 1) {
return false;
}
if (!dialog.last_at) {