Skip to content

Conversation

@ILoveScratch2
Copy link
Member

Description / 描述

在删除用户时同步删除分享

Motivation and Context / 背景

在用户删除但分享存在的情况下,获取用户访问无效

Closes #1491

How Has This Been Tested? / 测试

Checklist / 检查清单

  • I have read the CONTRIBUTING document.
    我已阅读 CONTRIBUTING 文档。
  • I have formatted my code with go fmt or prettier.
    我已使用 go fmtprettier 格式化提交的代码。
  • I have added appropriate labels to this PR (or mentioned needed labels in the description if lacking permissions).
    我已为此 PR 添加了适当的标签(如无权限或需要的标签不存在,请在描述中说明,管理员将后续处理)。
  • I have requested review from relevant code authors using the "Request review" feature when applicable.
    我已在适当情况下使用"Request review"功能请求相关代码作者进行审查。
  • I have updated the repository accordingly (If it’s needed).
    我已相应更新了相关仓库(若适用)。

@ILoveScratch2 ILoveScratch2 requested a review from Copilot October 18, 2025 15:26
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a data consistency issue by ensuring that when a user is deleted, all their associated shares are also deleted to prevent accessing invalid user data.

  • Adds cascading deletion of shares when a user is deleted
  • Adds null-safe check in sharing validation
  • Implements new database and operation layer functions for bulk share deletion

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
internal/op/user.go Adds call to delete user's shares before user deletion and imports errors package
internal/op/sharing.go Adds new function to delete shares by creator ID
internal/model/sharing.go Adds null check for Creator field in validation
internal/db/sharing.go Implements database function to delete shares by creator ID

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@jyxjjj jyxjjj merged commit 15f2765 into OpenListTeam:main Oct 19, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] 在存在分享条目的情况下删除创建条目的用户将导致管理员角色的分享菜单报错500

2 participants