phone: get mellon username in all zone views (#9598 fix)
This commit is contained in:
parent
e6536f2091
commit
467f7bb9a0
|
@ -47,16 +47,13 @@ class Home(object):
|
|||
class PhoneZone(TemplateView):
|
||||
template_name = 'welco/phone_home.html'
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
username = request.session.get('mellon_session', {}).get('username')
|
||||
def get_context_data(self, **kwargs):
|
||||
username = self.request.session.get('mellon_session', {}).get('username')
|
||||
if username:
|
||||
# user is from SSO, username is a phone line (callee), create a link to it
|
||||
username = username[0].split('@', 1)[0][:80] # remove realm
|
||||
if username:
|
||||
PhoneLine.take(callee=username, user=self.request.user)
|
||||
return super(PhoneZone, self).get(request, *args, **kwargs)
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(PhoneZone, self).get_context_data(**kwargs)
|
||||
context['source_type'] = ContentType.objects.get_for_model(PhoneCall)
|
||||
context['phonelines'] = PhoneLine.objects.filter(users__id=self.request.user.id)
|
||||
|
|
Loading…
Reference in New Issue