示例#1
0
def shows_moderation_title(user, video):
    if video is None:
        return False
    team = version.video.moderated_by
    if team and _user_can_moderate(video, user):
        return _("Moderation")
    return ""
示例#2
0
def render_approve_all_button(video, user):
    """
    Renders a `approve all` button that when clicked, will approve all
    languages for the given video
    If the video not under moderation or the user does not have
    authorization to moderate, no button will be rendered.
    We pass the time this list was generated so that moderators do not
    moderate recently submitted content they haven't had a chance
    to view.
    """
    if not video.moderated_by or not _user_can_moderate(video, user):
        return {}
    pending = video.moderated_by.get_pending_moderation()
    if not pending.exists():
        return {}
    return {
        "url":
        reverse("moderation:approve-all-for-video",
                kwargs={
                    'team_id':
                    video.moderated_by.pk,
                    "video_id":
                    video.video_id,
                    "timestamp":
                    int(time.mktime(datetime.datetime.now().timetuple())),
                }),
        "label":
        _("Approve all"),
    }
示例#3
0
def shows_moderation_title( user, video):
    if video is None:
        return False
    team = version.video.moderated_by        
    if team and _user_can_moderate(video,  user):
        return _("Moderation")
    return ""
示例#4
0
def render_approval_toolbar(user, version):
    if version is None:
        return {}
    team = version.video.moderated_by
    can_moderate = _user_can_moderate(version.language.video, user)
    if not team or not can_moderate:
        return {}
    return {
        "version": version,
        "team": team,
    }
示例#5
0
def render_approval_toolbar( user, version):
    if version is None:
        return {}
    team = version.video.moderated_by        
    can_moderate = _user_can_moderate(version.language.video,  user)
    if not team or not  can_moderate:
        return {
            
        }
    return {
        "version":version,
        "team": team,
    }
示例#6
0
def render_approve_all_button(video, user):
    """
    Renders a `approve all` button that when clicked, will approve all
    languages for the given video
    If the video not under moderation or the user does not have
    authorization to moderate, no button will be rendered.
    We pass the time this list was generated so that moderators do not
    moderate recently submitted content they haven't had a chance
    to view.
    """
    if not video.moderated_by or not _user_can_moderate(video, user):
        return {}
    pending = video.moderated_by.get_pending_moderation()
    if not pending.exists():
        return {}
    return {
        "url": reverse("moderation:approve-all-for-video", kwargs={
                'team_id':video.moderated_by.pk,
                "video_id":video.video_id,
                "timestamp": int(time.mktime(datetime.datetime.now().timetuple())),
                }),
        "label": _("Approve all"),
        }
示例#7
0
def user_can_moderate( user, video, team):
    return _user_can_moderate(video,  user)
示例#8
0
def user_can_moderate(user, video, team):
    return _user_can_moderate(video, user)