491
494
subscriber = subscription.subscriber
492
495
for filter in subscription.bug_filters:
493
496
is_team = subscriber.isTeam()
494
user_is_team_admin = (is_team and
495
subscriber in administered_teams)
497
user_is_team_admin = (
498
is_team and subscriber in administered_teams)
499
team_has_contact_address = (
500
is_team and subscriber.preferredemail is not None)
501
mailing_list = subscriber.mailing_list
502
user_is_on_team_mailing_list = (
503
team_has_contact_address and
504
mailing_list is not None and
505
mailing_list.is_usable and
506
mailing_list.getSubscription(subscriber) is not None)
496
507
record['filters'].append(dict(
498
509
subscriber_link=absoluteURL(subscriber, api_request),
499
subscriber_url = canonical_url(
510
subscriber_url=canonical_url(
500
511
subscriber, rootsite='mainsite'),
512
target_bugs_url=canonical_url(
513
target, rootsite='bugs'),
501
514
subscriber_title=subscriber.title,
502
515
subscriber_is_team=is_team,
503
516
user_is_team_admin=user_is_team_admin,
517
team_has_contact_address=team_has_contact_address,
518
user_is_on_team_mailing_list=user_is_on_team_mailing_list,
504
519
can_mute=filter.isMuteAllowed(user),
505
is_muted=filter.muted(user) is not None))
520
is_muted=filter.muted(user) is not None,
521
target_title=target.title))
506
522
info = info.values()
507
info.sort(key=lambda item: item['target_url'])
523
info.sort(key=itemgetter('target_url'))
508
524
IJSONRequestCache(request).objects['subscription_info'] = info