コード例 #1
0
def queue_tabnav(context):
    """
    Returns tuple of tab navigation for the queue pages.

    Each tuple contains three elements: (url, tab_code, tab_text)

    """
    request = context['request']
    counts = context['queue_counts']
    apps_reviewing = AppsReviewing(request).get_apps()

    # Apps.
    if acl.action_allowed(request, 'Apps', 'Review'):
        rv = [
            (reverse('reviewers.apps.queue_pending'), 'pending',
             _('Apps ({0})', counts['pending']).format(counts['pending'])),
            (reverse('reviewers.apps.queue_rereview'), 'rereview',
             _('Re-reviews ({0})',
               counts['rereview']).format(counts['rereview'])),
            (reverse('reviewers.apps.queue_updates'), 'updates',
             _('Updates ({0})', counts['updates']).format(counts['updates'])),
        ]
        if acl.action_allowed(request, 'Apps', 'ReviewEscalated'):
            rv.append((reverse('reviewers.apps.queue_escalated'), 'escalated',
                       _('Escalations ({0})',
                         counts['escalated']).format(counts['escalated'])))
        rv.append((reverse('reviewers.apps.apps_reviewing'), 'reviewing',
                   _('Reviewing ({0})').format(len(apps_reviewing))), )
        if acl.action_allowed(request, 'Apps', 'ReviewRegionCN'):
            url_ = reverse('reviewers.apps.queue_region',
                           args=[mkt.regions.CHN.slug])
            rv.append(
                (url_, 'region', _('China ({0})').format(counts['region_cn'])))
        if acl.action_allowed(request, 'Apps', 'ReviewTarako'):
            url_ = reverse('reviewers.apps.additional_review',
                           args=[QUEUE_TARAKO])
            rv.append((url_, 'additional',
                       _('Tarako ({0})').format(counts['additional_tarako'])))
        rv.append((reverse('reviewers.apps.queue_homescreen'), 'homescreen',
                   _('Homescreens ({0})', counts['homescreen']).format(
                       counts['homescreen'])), )
    else:
        rv = []

    if acl.action_allowed(request, 'Apps', 'ModerateReview'):
        rv.append((reverse('reviewers.apps.queue_moderated'), 'moderated',
                   _('Moderated Reviews ({0})', counts['moderated']).format(
                       counts['moderated'])), )

    if acl.action_allowed(request, 'Apps', 'ReadAbuse'):
        rv.append((reverse('reviewers.apps.queue_abuse'), 'abuse',
                   _('Abuse Reports ({0})', counts['abuse']).format(
                       counts['abuse'])), )

    if acl.action_allowed(request, 'Websites', 'ReadAbuse'):
        rv.append(
            (reverse('reviewers.websites.queue_abuse'), 'abusewebsites',
             _('Website Abuse Reports ({0})', counts['abusewebsites']).format(
                 counts['abusewebsites'])), )
    return rv
コード例 #2
0
ファイル: views.py プロジェクト: j-barron/zamboni
def review_viewing(request):
    if 'addon_id' not in request.POST:
        return {}

    addon_id = request.POST['addon_id']
    user_id = request.user.id
    current_name = ''
    is_user = 0
    key = '%s:review_viewing:%s' % (settings.CACHE_PREFIX, addon_id)
    interval = amo.EDITOR_VIEWING_INTERVAL

    # Check who is viewing.
    currently_viewing = cache.get(key)

    # If nobody is viewing or current user is, set current user as viewing
    if not currently_viewing or currently_viewing == user_id:
        # We want to save it for twice as long as the ping interval,
        # just to account for latency and the like.
        cache.set(key, user_id, interval * 2)
        currently_viewing = user_id
        current_name = request.user.name
        is_user = 1
    else:
        current_name = UserProfile.objects.get(pk=currently_viewing).name

    AppsReviewing(request).add(addon_id)

    return {
        'current': currently_viewing,
        'current_name': current_name,
        'is_user': is_user,
        'interval_seconds': interval
    }
コード例 #3
0
ファイル: views.py プロジェクト: j-barron/zamboni
def apps_reviewing(request):
    return render(
        request, 'reviewers/apps_reviewing.html',
        context(
            request, **{
                'tab': 'reviewing',
                'apps': AppsReviewing(request).get_apps()
            }))
コード例 #4
0
def apps_reviewing(request):

    return jingo.render(
        request, 'reviewers/apps_reviewing.html',
        context(**{
            'apps': AppsReviewing(request).get_apps(),
            'tab': 'reviewing'
        }))
コード例 #5
0
ファイル: helpers.py プロジェクト: j-barron/zamboni
def queue_tabnav(context):
    """
    Returns tuple of tab navigation for the queue pages.

    Each tuple contains three elements: (url, tab_code, tab_text)

    """
    request = context['request']
    counts = context['queue_counts']
    apps_reviewing = AppsReviewing(request).get_apps()

    # Apps.
    if acl.action_allowed(request, 'Apps', 'Review'):
        rv = [
            (reverse('reviewers.apps.queue_pending'), 'pending',
             _('Apps ({0})', counts['pending']).format(counts['pending'])),
            (reverse('reviewers.apps.queue_rereview'), 'rereview',
             _('Re-reviews ({0})',
               counts['rereview']).format(counts['rereview'])),
            (reverse('reviewers.apps.queue_updates'), 'updates',
             _('Updates ({0})', counts['updates']).format(counts['updates'])),
        ]
        if acl.action_allowed(request, 'Apps', 'ReviewEscalated'):
            rv.append((reverse('reviewers.apps.queue_escalated'), 'escalated',
                       _('Escalations ({0})',
                         counts['escalated']).format(counts['escalated'])))
        rv.extend([
            (reverse('reviewers.apps.queue_moderated'), 'moderated',
             _('Moderated Reviews ({0})',
               counts['moderated']).format(counts['moderated'])),
            (reverse('reviewers.apps.apps_reviewing'), 'reviewing',
             _('Reviewing ({0})').format(len(apps_reviewing))),
        ])
        if acl.action_allowed(request, 'Apps', 'ReviewRegionCN'):
            url_ = reverse('reviewers.apps.queue_region',
                           args=[mkt.regions.CN.slug])
            rv.append(
                (url_, 'region', _('China ({0})').format(counts['region_cn'])))
        if acl.action_allowed(request, 'Apps', 'ReviewTarako'):
            url_ = reverse('reviewers.apps.additional_review',
                           args=[QUEUE_TARAKO])
            rv.append((url_, 'additional',
                       _('Tarako ({0})').format(counts['additional_tarako'])))
    else:
        rv = []

    if 'pro' in request.GET:
        device_srch = device_queue_search(request)
        rv.append((
            reverse('reviewers.apps.queue_device'),
            'device',
            _('Device ({0})').format(device_srch.count()),
        ))

    return rv
コード例 #6
0
ファイル: helpers.py プロジェクト: wangeek/zamboni
def queue_tabnav(context):
    """
    Returns tuple of tab navigation for the queue pages.

    Each tuple contains three elements: (url, tab_code, tab_text)

    """
    request = context['request']
    counts = context['queue_counts']
    apps_reviewing = AppsReviewing(request).get_apps()

    # Apps.
    if acl.action_allowed(request, 'Apps', 'Review'):
        rv = [
            (reverse('reviewers.apps.queue_pending'), 'pending',
             pgettext(counts['pending'],
                      'Apps ({0})').format(counts['pending'])),
            (reverse('reviewers.apps.queue_rereview'), 'rereview',
             pgettext(counts['rereview'],
                      'Re-reviews ({0})').format(counts['rereview'])),
            (reverse('reviewers.apps.queue_updates'), 'updates',
             pgettext(counts['updates'],
                      'Updates ({0})').format(counts['updates'])),
        ]
        if acl.action_allowed(request, 'Apps', 'ReviewEscalated'):
            rv.append(
                (reverse('reviewers.apps.queue_escalated'), 'escalated',
                 pgettext(counts['escalated'],
                          'Escalations ({0})').format(counts['escalated'])))
        rv.append((reverse('reviewers.apps.apps_reviewing'), 'reviewing',
                   _('Reviewing ({0})').format(len(apps_reviewing))), )
        rv.append((reverse('reviewers.apps.queue_homescreen'), 'homescreen',
                   pgettext(counts['homescreen'], 'Homescreens ({0})').format(
                       counts['homescreen'])), )
    else:
        rv = []

    if acl.action_allowed(request, 'Apps', 'ModerateReview'):
        rv.append(
            (reverse('reviewers.apps.queue_moderated'), 'moderated',
             pgettext(counts['moderated'], 'Moderated Reviews ({0})').format(
                 counts['moderated'])), )

    if acl.action_allowed(request, 'Apps', 'ReadAbuse'):
        rv.append((reverse('reviewers.apps.queue_abuse'), 'abuse',
                   pgettext(counts['abuse'], 'Abuse Reports ({0})').format(
                       counts['abuse'])), )

    if acl.action_allowed(request, 'Websites', 'ReadAbuse'):
        rv.append((reverse('reviewers.websites.queue_abuse'), 'abusewebsites',
                   pgettext(counts['abusewebsites'],
                            'Website Abuse Reports ({0})').format(
                                counts['abusewebsites'])), )
    return rv
コード例 #7
0
ファイル: test_api.py プロジェクト: labibismaiel/zamboni
    def test_some(self):
        self.add_perms()

        # This feels rather brittle.
        cache.set('%s:review_viewing:%s' % (settings.CACHE_PREFIX, 337141),
                  2519, 50 * 2)
        AppsReviewing(self.req).add(337141)

        res = self.client.get(self.list_url)
        data = json.loads(res.content)
        eq_(data['objects'][0]['resource_uri'],
            reverse('app-detail', kwargs={'pk': 337141}))
コード例 #8
0
    def test_some(self):
        self.add_perms()

        # This feels rather brittle.
        cache.set('%s:review_viewing:%s' % (settings.CACHE_PREFIX, 337141),
                  2519, 50 * 2)
        AppsReviewing(self.req).add(337141)

        res = self.client.get(self.list_url)
        data = json.loads(res.content)
        eq_(data['objects'][0]['resource_uri'],
            get_absolute_url(get_url('app', '337141'), absolute=False))
コード例 #9
0
def queue_tabnav(context):
    """
    Returns tuple of tab navigation for the queue pages.

    Each tuple contains three elements: (named_url. tab_code, tab_text)
    """
    request = context['request']
    counts = context['queue_counts']
    apps_reviewing = AppsReviewing(request).get_apps()

    # Apps.
    if acl.action_allowed(request, 'Apps', 'Review'):
        rv = [
            ('reviewers.apps.queue_pending', 'pending',
             _('Apps ({0})', counts['pending']).format(counts['pending'])),
            ('reviewers.apps.queue_rereview', 'rereview',
             _('Re-reviews ({0})',
               counts['rereview']).format(counts['rereview'])),
            ('reviewers.apps.queue_updates', 'updates',
             _('Updates ({0})', counts['updates']).format(counts['updates'])),
        ]
        if acl.action_allowed(request, 'Apps', 'ReviewEscalated'):
            rv.append(('reviewers.apps.queue_escalated', 'escalated',
                       _('Escalations ({0})',
                         counts['escalated']).format(counts['escalated'])))
        rv.extend([
            ('reviewers.apps.queue_moderated', 'moderated',
             _('Moderated Reviews ({0})',
               counts['moderated']).format(counts['moderated'])),
            ('reviewers.apps.apps_reviewing', 'reviewing',
             _('Reviewing ({0})').format(len(apps_reviewing))),
        ])
    else:
        rv = []

    if waffle.switch_is_active('buchets') and 'pro' in request.GET:
        device_srch = device_queue_search(request)
        rv.append((
            'reviewers.apps.queue_device',
            'device',
            _('Device ({0})').format(device_srch.count()),
        ))

    return rv
コード例 #10
0
ファイル: helpers.py プロジェクト: zzdjk6/zamboni
def queue_tabnav(context):
    """
    Returns tuple of tab navigation for the queue pages.

    Each tuple contains three elements: (named_url. tab_code, tab_text)
    """
    counts = context['queue_counts']
    apps_reviewing = AppsReviewing(context['request']).get_apps()

    # Apps.
    if acl.action_allowed(context['request'], 'Apps', 'Review'):
        rv = [
            ('reviewers.apps.queue_pending', 'pending',
             _('Apps ({0})', counts['pending']).format(counts['pending'])),
            ('reviewers.apps.queue_rereview', 'rereview',
             _('Re-reviews ({0})',
               counts['rereview']).format(counts['rereview'])),
            ('reviewers.apps.queue_updates', 'updates',
             _('Updates ({0})', counts['updates']).format(counts['updates'])),
        ]
        if acl.action_allowed(context['request'], 'Apps', 'ReviewEscalated'):
            rv.append(('reviewers.apps.queue_escalated', 'escalated',
                       _('Escalations ({0})',
                         counts['escalated']).format(counts['escalated'])))
        rv.extend([
            ('reviewers.apps.queue_moderated', 'moderated',
             _('Moderated Reviews ({0})',
               counts['moderated']).format(counts['moderated'])),
            ('reviewers.apps.apps_reviewing', 'reviewing',
             _('Reviewing ({0})').format(len(apps_reviewing))),
        ])
    else:
        rv = []

    # Themes.
    if (acl.action_allowed(context['request'], 'Personas', 'Review')
            and waffle.switch_is_active('mkt-themes')):
        rv.append((
            'reviewers.themes.list',
            'themes',
            _('Themes ({0})').format(counts['themes']),
        ))
    return rv
コード例 #11
0
ファイル: views.py プロジェクト: j-barron/zamboni
 def get_queryset(self):
     return [row['app'] for row in AppsReviewing(self.request).get_apps()]
コード例 #12
0
 def obj_get_list(self, request, **kwargs):
     return [
         Wrapper(r['app'].pk) for r in AppsReviewing(request).get_apps()
     ]