예제 #1
0
def approve(id, actor: user_id):
    comment = get(id)
    delete(id)
    commentactionloglib.create(comment=id,
                               action=comment_actions.approved.value,
                               actor=actor)
    ret = commentlib.create(**comment)
    signals.comment_approved.send('approved', comment=comment)
    return ret
예제 #2
0
def revert(id, actor: user_id):
    rejected_comment = get(id)
    delete(id)
    commentactionloglib.create(comment=id,
                               action=comment_actions.reverted.value,
                               actor=actor)
    del (rejected_comment['note'])
    del (rejected_comment['reason'])
    del (rejected_comment['commenter'])
    return pendingcommentlib.create(**rejected_comment)
예제 #3
0
def update(id, actor: user_id, **mod_data):
    updatables = ('editors_pick', 'content')
    update_dict = dict(
        (k, v) for (k, v) in list(mod_data.items()) if k in updatables)
    PendingComment.update(**update_dict).where(
        PendingComment.id == id).execute()
    if update_dict.get('editors_pick'):
        commentactionloglib.create(comment=id,
                                   action=comment_actions.picked.value,
                                   actor=actor)
예제 #4
0
def reject(id, actor: user_id, note='', reason=None):
    pending_comment = get(id)
    delete(id)
    commentactionloglib.create(comment=id,
                               action=comment_actions.rejected.value,
                               actor=actor)
    return rejectedcommentlib.create(**pending_comment,
                                     note=note,
                                     reason=reason
                                     or rejection_reasons.other.value)
예제 #5
0
파일: comment.py 프로젝트: rayandas/tuesday
def update(id, actor: user_id, **mod_data):
    updatables = ('editors_pick', )
    update_dict = dict(
        (k, v) for (k, v) in list(mod_data.items()) if k in updatables)
    Comment.update(**update_dict).where(Comment.id == id).execute()
    if update_dict.get('editors_pick'):
        commentactionloglib.create(comment=id,
                                   action=comment_actions.picked.value,
                                   actor=actor)
        comment = get(id)
        signals.comment_featured.send('featured', comment=comment)
예제 #6
0
파일: comment.py 프로젝트: rayandas/tuesday
def reject(id, actor: user_id, note='', reason=None):
    for child_comment in get_by_parent(id):
        reject(child_comment['id'],
               actor,
               reason=rejection_reasons.parent_rejected.value)
    comment = get(id)
    delete(id)

    commentactionloglib.create(comment=id,
                               action=comment_actions.rejected.value,
                               actor=actor)
    return rejectedcommentlib.create(**comment,
                                     note=note,
                                     reason=reason
                                     or rejection_reasons.other.value)