misc: present self with a "portal-agent" slug in menu.json (#28105)

This commit is contained in:
Frédéric Péters 2018-11-17 15:52:47 +01:00
parent 58f76bcd39
commit 377208ce68
1 changed files with 10 additions and 1 deletions

View File

@ -485,8 +485,17 @@ def menu_json(request):
label = _('Editing "%(site_title)s"') % settings.TEMPLATE_VARS
else:
label = _('Content Management')
slug = 'portal'
if getattr(settings, 'KNOWN_SERVICES') and 'combo' in settings.KNOWN_SERVICES:
# switch to custom slug if the site is the portal agent.
for service_slug, service in settings.KNOWN_SERVICES['combo'].items():
if service.get('is-portal-agent') and not service.get('secret'):
slug = 'portal-agent'
break
json_str = json.dumps([{'label': force_text(label),
'slug': 'portal',
'slug': slug,
'url': request.build_absolute_uri(reverse('combo-manager-homepage'))
}])
content_type = 'application/json'