From 2a355496312a6dc3a7ec73fff0fb84429a8a7796 Mon Sep 17 00:00:00 2001 From: Shaily Date: Jan 25 2018 08:19:59 +0000 Subject: [PATCH 1/2] Address private fields in FAS --- diff --git a/hubs/static/client/app/components/UserContact.js b/hubs/static/client/app/components/UserContact.js index 471d7e4..b1859ef 100644 --- a/hubs/static/client/app/components/UserContact.js +++ b/hubs/static/client/app/components/UserContact.js @@ -12,41 +12,51 @@ export default class UserContact extends React.Component { return (
-
- - + { this.props.hub.config.creation_date && +
+ + Member Since - -
+
+ }
); } diff --git a/hubs/utils/fas.py b/hubs/utils/fas.py index a992ebf..6805eb6 100644 --- a/hubs/utils/fas.py +++ b/hubs/utils/fas.py @@ -120,13 +120,14 @@ class FASClient(object): if fas_user[fas_attr] is None: continue hub.config[hub_attr] = fas_user[fas_attr] - country = pycountry.countries.get(alpha_2=fas_user["country_code"]) - hub.config["country"] = country.name - # Timezone - now = datetime.datetime.now() # does not really matter, legacy API - tz_offset = timezone(fas_user["timezone"]).utcoffset(now) - hub.config["timezone_offset"] = ( - tz_offset.days * 86400 + tz_offset.seconds) + if fas_user["country_code"] is not None: + country = pycountry.countries.get(alpha_2=fas_user["country_code"]) + hub.config["country"] = country.name + if fas_user["timezone"] is not None: + now = datetime.datetime.now() # does not really matter, legacy API + tz_offset = timezone(fas_user["timezone"]).utcoffset(now) + hub.config["timezone_offset"] = ( + tz_offset.days * 86400 + tz_offset.seconds) return fas_user def sync_user_roles(self, user, hub=None): From 2d8ca5c97c8f1cc0673f1027f45fc65c4efac5c8 Mon Sep 17 00:00:00 2001 From: Shaily Date: Jan 25 2018 08:19:59 +0000 Subject: [PATCH 2/2] FAS private fields: Changes from review --- diff --git a/hubs/utils/fas.py b/hubs/utils/fas.py index 6805eb6..98b782b 100644 --- a/hubs/utils/fas.py +++ b/hubs/utils/fas.py @@ -120,10 +120,10 @@ class FASClient(object): if fas_user[fas_attr] is None: continue hub.config[hub_attr] = fas_user[fas_attr] - if fas_user["country_code"] is not None: + if fas_user.get("country_code") is not None: country = pycountry.countries.get(alpha_2=fas_user["country_code"]) hub.config["country"] = country.name - if fas_user["timezone"] is not None: + if fas_user.get("timezone") is not None: now = datetime.datetime.now() # does not really matter, legacy API tz_offset = timezone(fas_user["timezone"]).utcoffset(now) hub.config["timezone_offset"] = (