🔒 (notes): 新想法默认私有,设置里可改可见范围

公开和仅关注只对新想法生效。已有想法沿用原来记下的范围。
This commit is contained in:
Garfield committed 2026-12-01 15:37:10 +08:00
1 parent 352ee1bd99
commit 338e2d2d3c
10 files changed
+207 -61

No files matched your search

+27 -1
View File
@@ -357,7 +357,8 @@ do
Assert.eq(review_body.abstract, "原文")
Assert.eq(review_body.range, "0-5")
Assert.eq(review_body.chapterUid, 9)
Assert.eq(review_body.isPrivate, 0, "非私密阅读的新想法明确公开")
Assert.eq(review_body.isPrivate, 1, "没选过时新想法默认私有")
Assert.eq(review_body.friendship, 0)
local secret_body = Notes.toReviewBody("1", 9, {
note = "想法", text = "原文", wr_range = "0-5",
}, 1)
@@ -374,7 +375,24 @@ do
note = "想法", text = "原文", wr_range = "0-5", wr_review_id = "rv1", wr_private = 1,
}, 0)
Assert.eq(edit_private.isPrivate, 1)
Assert.is_nil(edit_private.friendship, "只记过私有时不改关注范围")
Assert.eq(edit_private.reviewId, "rv1")
local chosen_public = Notes.toReviewBody("1", 9, {
note = "想法", text = "原文", wr_range = "0-5",
}, 1, "public")
Assert.eq(chosen_public.isPrivate, 0)
Assert.eq(chosen_public.friendship, 0)
local chosen_follow = Notes.toReviewBody("1", 9, {
note = "想法", text = "原文", wr_range = "0-5",
}, 0, "follow")
Assert.eq(chosen_follow.isPrivate, 0)
Assert.eq(chosen_follow.friendship, 1)
local kept_follow = Notes.toReviewEditBody("1", 9, {
note = "想法", text = "原文", wr_range = "0-5", wr_review_id = "rv1",
wr_private = 0, wr_friendship = 1,
}, 0, "public")
Assert.eq(kept_follow.friendship, 1, "已有想法的范围不被设置项改掉")
Assert.eq(kept_follow.isPrivate, 0)
local pulled_private = Notes.toAnnotations({ updated = {} }, "9", {
reviews = { { review = {
reviewId = "rv-p", chapterUid = "9", range = "0-1",
@@ -382,6 +400,14 @@ do
} } },
})
Assert.eq(pulled_private[1].wr_private, 1)
local pulled_follow = Notes.toAnnotations({ updated = {} }, "9", {
reviews = { { review = {
reviewId = "rv-f", chapterUid = "9", range = "0-1",
abstract = "原文", content = "关注", isPrivate = 0, friendship = 1,
} } },
})
Assert.eq(pulled_follow[1].wr_friendship, 1)
Assert.eq(pulled_follow[1].wr_private, 0)
local reconciled = { note = "想法", text = "原文", wr_range = "0-5", wr_review_id = "rv1" }
Notes.reconcileReviews({ reconciled }, {
reviews = { { review = { reviewId = "rv1", isPrivate = 1, range = "0-5", abstract = "原文", content = "想法" } } },