Fixes full_name -> name.

That's embarrassing.
This commit is contained in:
skoczen 2014-04-30 16:27:57 -07:00
parent 7751777b4e
commit f24f03c3f8
2 changed files with 8 additions and 8 deletions

View file

@ -59,8 +59,8 @@ class IntercomNode(Node):
user = get_user_from_context(context)
if user is not None and user.is_authenticated():
if 'full_name' not in vars:
vars['full_name'] = get_identity(context, 'intercom', self._identify, user)
if 'name' not in vars:
vars['name'] = get_identity(context, 'intercom', self._identify, user)
if 'email' not in vars and user.email:
vars['email'] = user.email

View file

@ -36,7 +36,7 @@ class IntercomTagTestCase(TagTestCase):
# Because the json isn't predictably ordered, we can't just test the whole thing verbatim.
self.assertEquals("""
<script id="IntercomSettingsScriptTag">
window.intercomSettings = {"app_id": "1234567890abcdef0123456789", "created_at": 1397074500, "email": "test@example.com", "full_name": "Firstname Lastname"};
window.intercomSettings = {"app_id": "1234567890abcdef0123456789", "created_at": 1397074500, "email": "test@example.com", "name": "Firstname Lastname"};
</script>
<script>(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',intercomSettings);}else{var d=document;var i=function(){i.c(arguments)};i.q=[];i.c=function(args){i.q.push(args)};w.Intercom=i;function l(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src='https://static.intercomcdn.com/intercom.v1.js';var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);}if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})()</script>
""", rendered_tag)
@ -55,7 +55,7 @@ class IntercomTagTestCase(TagTestCase):
first_name='Firstname', last_name='Lastname',
email="test@example.com", date_joined=now)}))
self.assertTrue(
"""window.intercomSettings = {"app_id": "1234567890abcdef0123456789", "created_at": 1397074500, "email": "test@example.com", "full_name": "Firstname Lastname"};"""\
"""window.intercomSettings = {"app_id": "1234567890abcdef0123456789", "created_at": 1397074500, "email": "test@example.com", "name": "Firstname Lastname"};"""\
in r
)
@ -73,16 +73,16 @@ class IntercomTagTestCase(TagTestCase):
last_name='Lastname',
email="test@example.com")
}))
self.assertTrue('"email": "test@example.com", "full_name": "Firstname Lastname"' in r)
self.assertTrue('"email": "test@example.com", "name": "Firstname Lastname"' in r)
def test_identify_username_no_email(self):
r = IntercomNode().render(Context({'user': User(username='test')}))
self.assertTrue('"full_name": "test"' in r, r)
self.assertTrue('"name": "test"' in r, r)
def test_no_identify_when_explicit_name(self):
r = IntercomNode().render(Context({'intercom_full_name': 'explicit',
r = IntercomNode().render(Context({'intercom_name': 'explicit',
'user': User(username='implicit')}))
self.assertTrue('"full_name": "explicit"' in r, r)
self.assertTrue('"name": "explicit"' in r, r)
def test_no_identify_when_explicit_email(self):
r = IntercomNode().render(Context({'intercom_email': 'explicit',