Пример #1
0
def flag_queue(request):
    ctx = {
        'comments':
        QuestComment.unjudged_flagged().order_by('id')
        [:knobs.WHITELIST_COMMENTS_PER_PAGE],
    }
    return r2r_jinja('whitelisting/flagged.html', ctx, request)
Пример #2
0
def flag_queue_paginated(request, after_id=None):
    ctx = {
        'comments': QuestComment.unjudged_flagged().filter(
            id__gt=after_id,
        ).order_by('id')[:knobs.WHITELIST_COMMENTS_PER_PAGE],
    }
    return r2r_jinja('whitelisting/whitelist_items.html', ctx, request)
Пример #3
0
def flag_queue_paginated(request, after_id=None):
    ctx = {
        'comments':
        QuestComment.unjudged_flagged().filter(id__gt=after_id, ).order_by(
            'id')[:knobs.WHITELIST_COMMENTS_PER_PAGE],
    }
    return r2r_jinja('whitelisting/whitelist_items.html', ctx, request)
Пример #4
0
def flag_queue(request):
    ctx = {
        'comments': QuestComment.unjudged_flagged().order_by('id')[:knobs.WHITELIST_COMMENTS_PER_PAGE],
        'body_class': 'flag_queue',
        'unjudged_count': QuestComment.objects.filter(judged=False).count(),
    }
    return r2r_jinja('whitelisting/flagged.html', ctx, request)
Пример #5
0
def moderation_queue():
    sections = [
        QuestComment.unjudged_flagged().order_by('-id'),
        QuestComment.by_unknown_users().order_by('-id').exclude(flags__undone=False),
        QuestComment.by_distrusted_users().order_by('-id').exclude(flags__undone=False),
    ]

    return chain(*sections)
Пример #6
0
def moderation_queue():
    sections = [
        QuestComment.unjudged_flagged().order_by('-id'),
        QuestComment.by_unknown_users().order_by('-id').exclude(
            flags__undone=False),
        QuestComment.by_distrusted_users().order_by('-id').exclude(
            flags__undone=False),
    ]

    return chain(*sections)
Пример #7
0
def flag_queue(request):
    ctx = {
        'comments':
        QuestComment.unjudged_flagged().order_by('id')
        [:knobs.WHITELIST_COMMENTS_PER_PAGE],
        'body_class':
        'flag_queue',
        'unjudged_count':
        QuestComment.objects.filter(judged=False).count(),
    }
    return r2r_jinja('whitelisting/flagged.html', ctx, request)
Пример #8
0
    def test_auto_moderation_from_flags(self):
        cmt = create_quest_comment()

        for i in range(1, settings.AUTO_MODERATE_FLAGGED_COMMENTS_THRESHOLD + 1):
            resp = self.api_post('/api/comment/flag', {'comment_id': cmt.id})

            cmt = QuestComment.all_objects.get(pk=cmt.pk)
            getattr(self, 'assert' + str(i == settings.AUTO_MODERATE_FLAGGED_COMMENTS_THRESHOLD))(
                cmt.visibility == Visibility.DISABLED)

        self.assertTrue(cmt.id in [qc.id for qc in QuestComment.unjudged_flagged()])
Пример #9
0
def moderation(request, id_range=None):
    flagged = QuestComment.unjudged_flagged().order_by('-id')
    unknown = QuestComment.by_unknown_users().order_by('-id').exclude(flags__undone=False)
    #distrusted = QuestComment.by_distrusted_users().order_by('-id').exclude(flags__undone=False)
    #trusted = QuestComment.by_trusted_users().order_by('-id').exclude(flags__undone=False)

    ctx = _moderation_context([flagged, unknown], id_range=id_range)

    ctx.update({
        'flagged_count': flagged.count(),
        'trusted_user_count': UserInfo.objects.filter(trusted=True).count(),
    })

    return r2r_jinja('whitelisting/moderation.html', ctx, request)
Пример #10
0
    def test_auto_moderation_from_flags(self):
        cmt = create_quest_comment()

        for i in range(1, knobs.AUTO_DISABLE_FLAGGED_COMMENTS_THRESHOLD[None] +
                       1):
            resp = self.api_post('/api/comment/flag', {'comment_id': cmt.id})

            cmt = QuestComment.all_objects.get(pk=cmt.pk)
            getattr(
                self, 'assert' +
                str(i == knobs.AUTO_DISABLE_FLAGGED_COMMENTS_THRESHOLD[None]))(
                    cmt.visibility == Visibility.DISABLED)

        self.assertTrue(
            cmt.id in [qc.id for qc in QuestComment.unjudged_flagged()])
Пример #11
0
def moderation(request, id_range=None):
    flagged = QuestComment.unjudged_flagged().order_by('-id')
    unknown = QuestComment.by_unknown_users().order_by('-id').exclude(
        flags__undone=False)
    #distrusted = QuestComment.by_distrusted_users().order_by('-id').exclude(flags__undone=False)
    #trusted = QuestComment.by_trusted_users().order_by('-id').exclude(flags__undone=False)

    ctx = _moderation_context([flagged, unknown], id_range=id_range)

    ctx.update({
        'flagged_count':
        flagged.count(),
        'trusted_user_count':
        UserInfo.objects.filter(trusted=True).count(),
    })

    return r2r_jinja('whitelisting/moderation.html', ctx, request)
Пример #12
0
def flag_queue(request):
    ctx = {
        'comments': QuestComment.unjudged_flagged().order_by('id')[:knobs.WHITELIST_COMMENTS_PER_PAGE],
    }
    return r2r_jinja('whitelisting/flagged.html', ctx, request)