fix: viewer只能看到和管理自己个人配方的标签,不显示公共库标签
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 4s
PR Preview / test (pull_request) Successful in 5s
PR Preview / deploy-preview (pull_request) Successful in 13s
Test / e2e-test (push) Successful in 49s

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-13 13:36:09 +00:00
parent 36862a4dbe
commit 1790ab3b44

View File

@@ -83,7 +83,7 @@
</div> </div>
<div class="candidate-tags"> <div class="candidate-tags">
<span <span
v-for="tag in recipeStore.allTags.filter(t => !batchTagsSelected.includes(t))" v-for="tag in visibleAllTags.filter(t => !batchTagsSelected.includes(t))"
:key="tag" :key="tag"
class="candidate-tag" class="candidate-tag"
@click="batchTagsSelected.push(tag)" @click="batchTagsSelected.push(tag)"
@@ -1308,9 +1308,13 @@ const previewRecipeIndex = ref(null)
const previewRecipeData = ref(null) const previewRecipeData = ref(null)
const showBatchMenu = ref(false) const showBatchMenu = ref(false)
const visibleAllTags = computed(() => { const visibleAllTags = computed(() => {
const tags = recipeStore.allTags if (auth.canEdit) return recipeStore.allTags
if (auth.canEdit) return tags // Viewer: only show tags from their own diary recipes
return tags.filter(t => !EDITOR_ONLY_TAGS.includes(t)) const myTags = new Set()
for (const d of diaryStore.userDiary) {
for (const t of (d.tags || [])) myTags.add(t)
}
return [...myTags].sort((a, b) => a.localeCompare(b, 'zh'))
}) })
const showBatchTagPicker = ref(false) const showBatchTagPicker = ref(false)
const batchTagsSelected = ref([]) const batchTagsSelected = ref([])