feat: 共享配方审核完整流程
- 新增 /api/recipes/{id}/reject 端点:拒绝配方并通知提交者(含原因)
- 采纳配方时通知提交者"配方已采纳"
- 管理员拒绝配方时输入原因
- 贡献统计改为统计被采纳的配方数(含 audit_log 记录)
- 完整流程测试:共享→通知→拒绝(带原因)→通知→重新共享→采纳→通知
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -534,20 +534,28 @@ async function removeRecipe(recipe) {
|
||||
|
||||
async function approveRecipe(recipe) {
|
||||
try {
|
||||
await api('/api/recipes/' + recipe._id + '/adopt', { method: 'POST' })
|
||||
ui.showToast('已采纳')
|
||||
await recipeStore.loadRecipes()
|
||||
const res = await api('/api/recipes/' + recipe._id + '/adopt', { method: 'POST' })
|
||||
if (res.ok) {
|
||||
ui.showToast('已采纳并通知提交者')
|
||||
await recipeStore.loadRecipes()
|
||||
}
|
||||
} catch {
|
||||
ui.showToast('操作失败')
|
||||
}
|
||||
}
|
||||
|
||||
async function rejectRecipe(recipe) {
|
||||
const ok = await showConfirm(`确定删除「${recipe.name}」?`)
|
||||
if (!ok) return
|
||||
const reason = await showPrompt(`拒绝「${recipe.name}」的原因(选填):`)
|
||||
if (reason === null) return
|
||||
try {
|
||||
await recipeStore.deleteRecipe(recipe._id)
|
||||
ui.showToast('已删除')
|
||||
const res = await api(`/api/recipes/${recipe._id}/reject`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ reason: reason || '' }),
|
||||
})
|
||||
if (res.ok) {
|
||||
await recipeStore.loadRecipes()
|
||||
ui.showToast('已拒绝并通知提交者')
|
||||
}
|
||||
} catch {
|
||||
ui.showToast('操作失败')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user