feat: 管理员/高级编辑可直接添加到公共库 + 已添加确认
Some checks failed
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 4s
Test / build-check (push) Successful in 3s
PR Preview / test (pull_request) Successful in 4s
PR Preview / deploy-preview (pull_request) Successful in 13s
Test / e2e-test (push) Failing after 55s
Some checks failed
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 4s
Test / build-check (push) Successful in 3s
PR Preview / test (pull_request) Successful in 4s
PR Preview / deploy-preview (pull_request) Successful in 13s
Test / e2e-test (push) Failing after 55s
- 管理员和高级编辑新增配方时弹出选择:公共配方库/个人配方 - 直接添加到公共库不走审核流程 - 普通用户仍然只能添加到个人配方 - "已添加"按钮点击前先确认 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -141,6 +141,9 @@ function isReviewable(n) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function markAdded(n) {
|
async function markAdded(n) {
|
||||||
|
const { showConfirm: confirm } = await import('../composables/useDialog')
|
||||||
|
const ok = await confirm('确认已添加该配方?将通知其他编辑者和搜索用户。')
|
||||||
|
if (!ok) return
|
||||||
try {
|
try {
|
||||||
await api(`/api/notifications/${n.id}/added`, { method: 'POST' })
|
await api(`/api/notifications/${n.id}/added`, { method: 'POST' })
|
||||||
n.is_read = 1
|
n.is_read = 1
|
||||||
|
|||||||
@@ -996,7 +996,26 @@ async function saveCurrentRecipe() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// New recipe: always save to diary (personal)
|
// New recipe: admin/senior_editor can choose public or personal
|
||||||
|
if (auth.canManage) {
|
||||||
|
const toPublic = await showConfirm('保存到哪里?', { okText: '公共配方库', cancelText: '个人配方' })
|
||||||
|
if (toPublic) {
|
||||||
|
try {
|
||||||
|
const pubPayload = {
|
||||||
|
name: formName.value.trim(),
|
||||||
|
ingredients: cleanIngs.map(i => ({ oil_name: i.oil, drops: i.drops })),
|
||||||
|
note: formNote.value,
|
||||||
|
tags: formTags.value,
|
||||||
|
}
|
||||||
|
await recipeStore.saveRecipe(pubPayload)
|
||||||
|
ui.showToast('已添加到公共配方库')
|
||||||
|
closeOverlay()
|
||||||
|
} catch (e) {
|
||||||
|
ui.showToast('保存失败: ' + (e.message || '未知错误'))
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
await diaryStore.createDiary(diaryPayload)
|
await diaryStore.createDiary(diaryPayload)
|
||||||
ui.showToast('已添加到我的配方')
|
ui.showToast('已添加到我的配方')
|
||||||
|
|||||||
Reference in New Issue
Block a user