app.comment_utils module

app.comment_utils.addComment(request: HttpRequest, comment_base, receiver=None, *, anonymous=False, notification_title=None) dict[源代码]

添加评论

Args:

  • request<WSGIRequest>: 传入的 request,其中 POST 参数至少应当包括:
    • comment_submit

    • comment

  • comment_base<Commentbase object>: 以 Commentbase 为基类的对象。
    • 目前的 Commentbase 对象只有四种:

      modifyposition,neworganization,activity,feedback。 - 2022.8.17加入Chat,用于学术地图问答

    • 添加 Commentbase 类型需要在 contentURL 中添加键值对。

    • 注意:该对象会被调用**`save`保存**

  • receiver<User object/iterable>:
    • 为User object时,只向一个user发布通知消息;

    • 为iterable时,向该可迭代对象中的所有user发布通知消息。

    • 注意:**不批量创建**通知,receiver个数应为常量级

returns:

继承自wrong/succeed, 成功时包含new_comment

rtype:

context<dict>

app.comment_utils.showComment(commentbase, anonymous_users=None) list[dict][源代码]

获取可展示的对象相关评论,返回以时间顺序展示的评论列表,应赋值为`comments`