Repository navigation
fix: chat user save button display #7927
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -229,7 +229,7 @@ onMounted(() => loadChatUserGroups()) | |
| </div> | ||
| </div> | ||
| <!-- 保存对话用户授权 --> | ||
| <el-button v-if="!isWorkspaceSharedResource() && knowledgeChatUserPermission('knowledgeChatUserEdit')" type="primary" :disabled="saveDisabled" @click="handleSave">保存</el-button> | ||
| <el-button v-if="!currentGroup.is_auth && !isWorkspaceSharedResource() && knowledgeChatUserPermission('knowledgeChatUserEdit')" type="primary" :disabled="saveDisabled" @click="handleSave">保存</el-button> | ||
| </div> | ||
|
|
||
| <MkTable | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here's my review of the diff: Issues & Observations
Suggested Improvement<el-button
v-if="currentGroup && !currentGroup.is_auth && !isWorkspaceSharedResource() && knowledgeChatUserPermission('knowledgeChatUserEdit')"
type="primary"
:disabled="saveDisabled"
@click="handleSave"
>
保存
</el-button>Or with optional chaining if a falsy v-if="!currentGroup?.is_auth && !isWorkspaceSharedResource() && ..."Optimization Suggestions
Bottom line: The primary risk is a null-access bug on |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changed line is syntactically valid, but I would not use it as-is without checking these points:
Null/undefined safety for
currentGroupcurrentGroupcan benullorundefinedduring loading,currentGroup.is_authcan cause a render error.!currentGroup?.is_authevaluates totruewhencurrentGroupisundefined, so the button may appear before data is loaded.Only show the button when the group is explicitly non-authorized
is_authcan beundefined,0,"0", etc.,!currentGroup.is_authmay behave unexpectedly.currentGroup.is_auth === falseif it is always boolean.Put the permission check first or guard
currentGroupConsider a computed property instead of a complex template expression
UX concern
Security concern
Recommended safer version, assuming
is_authis boolean: