fix: 贡献统计去重 + 已共享内容变更可重新共享
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 16s
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 16s
Test / e2e-test (push) Failing after 55s
贡献统计: - 按配方名去重(拒绝后重新申请不重复计数) - 已采纳+待审核+被拒绝的唯一配方名总数 已共享状态: - 已共享配方修改内容后,对比公共库版本 - 内容不同时"已共享"消失,可重新共享 - 内容相同时保持"已共享" Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1181,8 +1181,21 @@ function openRecipeDetail(recipe) {
|
||||
}
|
||||
|
||||
function getDiaryShareStatus(d) {
|
||||
if (sharedCount.value.adoptedNames.includes(d.name)) return 'shared'
|
||||
// Check pending first (exact name match in public library owned by user)
|
||||
if (sharedCount.value.pendingNames.includes(d.name)) return 'pending'
|
||||
// Check adopted — but if diary content was modified, allow re-sharing
|
||||
if (sharedCount.value.adoptedNames.includes(d.name)) {
|
||||
// Compare with the public recipe to see if content changed
|
||||
const pub = recipeStore.recipes.find(r => r.name === d.name)
|
||||
if (pub) {
|
||||
const dIngs = (d.ingredients || []).filter(i => i.oil).sort((a, b) => a.oil.localeCompare(b.oil))
|
||||
const pIngs = (pub.ingredients || []).filter(i => i.oil).sort((a, b) => a.oil.localeCompare(b.oil))
|
||||
const same = dIngs.length === pIngs.length && dIngs.every((ing, i) => ing.oil === pIngs[i].oil && ing.drops === pIngs[i].drops)
|
||||
if (same) return 'shared'
|
||||
}
|
||||
// Content changed or public recipe not found — can re-share
|
||||
return null
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user