koishi-plugin-foxy-daily 0.2.4 → 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 +11 -2
- package/package.json +1 -1
package/lib/comments.js
CHANGED
|
@@ -144,8 +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
|
-
|
|
148
|
-
|
|
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
|
|
151
|
+
// Qzone can reuse a raw comment id for a root comment and a nested reply.
|
|
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')
|
|
156
|
+
if (replySibling) return replySibling === comment ? legacy : undefined
|
|
157
|
+
return nonSelf[0] === comment ? legacy : undefined
|
|
149
158
|
}
|
|
150
159
|
|
|
151
160
|
async listComments(postId) {
|
package/package.json
CHANGED