koishi-plugin-foxy-daily 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/comments.js +9 -5
- package/package.json +1 -1
package/lib/comments.js
CHANGED
|
@@ -144,13 +144,17 @@ class CommentRunner {
|
|
|
144
144
|
const legacy = this.state.commentState(post.id, String(comment.id))
|
|
145
145
|
if (!legacy) return undefined
|
|
146
146
|
const siblings = comments.filter((item) => String(item.id) === String(comment.id))
|
|
147
|
-
|
|
147
|
+
const nonSelf = this.accountId
|
|
148
|
+
? siblings.filter((item) => String(item.author?.id) !== String(this.accountId))
|
|
149
|
+
: siblings
|
|
150
|
+
if (nonSelf.length <= 1) return nonSelf[0] === comment ? legacy : undefined
|
|
148
151
|
// Qzone can reuse a raw comment id for a root comment and a nested reply.
|
|
149
|
-
// Legacy state has only the raw id; prefer the reply sibling because
|
|
150
|
-
// flows usually consumed the nested reply first.
|
|
151
|
-
|
|
152
|
+
// Legacy state has only the raw id; prefer the user's reply sibling because
|
|
153
|
+
// old flows usually consumed the nested reply first. Never assign legacy
|
|
154
|
+
// state to Foxy's own reply, which can share the same id.
|
|
155
|
+
const replySibling = nonSelf.find((item) => item.kind === 'reply')
|
|
152
156
|
if (replySibling) return replySibling === comment ? legacy : undefined
|
|
153
|
-
return
|
|
157
|
+
return nonSelf[0] === comment ? legacy : undefined
|
|
154
158
|
}
|
|
155
159
|
|
|
156
160
|
async listComments(postId) {
|
package/package.json
CHANGED