Ejemplo n.º 1
0
def actions_verify(comment_id):
    if g.user is None or g.user.role != "moderator":
        abort(404)

    if request.args.get("is_rude", None) is None:
        abort(404)

    is_rude = json.loads(request.args.get("is_rude").lower())

    comment = SiteComment.by_comment_id(comment_id)
    if comment is None:
        abort(404)

    adder = DBModelAdder()
    adder.start()

    comment.verified = datetime.datetime.now()
    comment.is_rude = is_rude
    comment.verified_user_id = g.user.user_id
    comment.skipped = None

    adder.add(comment)
    adder.done()

    resp = {
        "status": True,
        "msg": "OK",
        "comment_id": comment_id,
        "is_rude": is_rude,
        "verified_user_id": g.user.user_id
    }

    return jsonify(**resp)
Ejemplo n.º 2
0
def actions_skipp(comment_id):
    if g.user is None or g.user.role != "moderator":
        abort(404)

    comment = SiteComment.by_comment_id(comment_id)
    if comment is None:
        abort(404)

    adder = DBModelAdder()
    adder.start()

    comment.skipped = datetime.datetime.now()
    comment.verified = None
    comment.verified_user_id = -1

    adder.add(comment)
    adder.done()

    resp = {"status": True, "msg": "OK", "comment_id": comment_id}

    return jsonify(**resp)