feat: 操作日志共享配方统一显示,移除用户删除撤销
All checks were successful
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 5s
Test / build-check (push) Successful in 3s
PR Preview / test (pull_request) Successful in 4s
PR Preview / deploy-preview (pull_request) Successful in 15s
Test / e2e-test (push) Successful in 49s

share_recipe/adopt_recipe 统一显示为"共享配方"。
删除用户不可撤销,回退软删除方案。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-11 22:08:02 +00:00
parent ad636f2df6
commit 9f627bbef9
2 changed files with 9 additions and 7 deletions

View File

@@ -800,7 +800,9 @@ def create_recipe(recipe: RecipeIn, user=Depends(get_current_user)):
for tag in recipe.tags:
c.execute("INSERT OR IGNORE INTO tags (name) VALUES (?)", (tag,))
c.execute("INSERT OR IGNORE INTO recipe_tags (recipe_id, tag_name) VALUES (?, ?)", (rid, tag))
log_audit(conn, user["id"], "create_recipe", "recipe", rid, recipe.name)
# Only log for admin/senior_editor direct adds (share); others wait for adopt
if user["role"] in ("admin", "senior_editor"):
log_audit(conn, user["id"], "share_recipe", "recipe", rid, recipe.name)
who = user.get("display_name") or user["username"]
if user["role"] == "senior_editor":
# Senior editor adds directly — just inform admin