SukkaW / DisqusJS

:speech_balloon: Render Disqus comments in Mainland China using Disqus API
https://disqusjs.skk.moe
MIT License
641 stars 55 forks source link

评论删除后,子评论不显示 #6

Closed imlonghao closed 5 years ago

imlonghao commented 5 years ago

复现步骤

  1. 发一条评论A
  2. 回复评论A
  3. 删除评论A

Disqus 官方表现

image

DisqusJS 表现

image

预期现象

image

SukkaW commented 5 years ago

Disqus API 返回的数据并不是嵌套的,而是对子评论添加一个 parent 字段用来表明其归属的父评论; 如果父评论被删除,那么子评论就不知道归属在哪里了。

SukkaW commented 5 years ago

image

Disqus API 返回的 JSON 是这样的

imlonghao commented 5 years ago

我看了一下 API 的文档,有一个参数叫 include,默认传入 approved 提取已通过审核的评论,如果同时传入 approveddeleted 的话就可以取出来被删除的评论和正常的评论,这样子的话子评论就可以找到相对应的父评论了。

image

SukkaW commented 5 years ago

OK~我明天试试写下对 deleted 评论的处理 (话说 Disqus API &inclue=approved&include=deleted 这种设计还真的有些不合常规2333)