slack: Do minor fixes.
Minor fixes in zerver_userprofile mapping. Remove TODO from REALM_ID task.
This commit is contained in:
parent
7198aab1a9
commit
9ce064b2c1
|
@ -51,6 +51,12 @@ def users2zerver_userprofile(slack_dir: str, realm_id: int, timestamp: Any,
|
||||||
# use the avatar from gravatar
|
# use the avatar from gravatar
|
||||||
avatar_source = 'G'
|
avatar_source = 'G'
|
||||||
|
|
||||||
|
# timezone
|
||||||
|
_default_timezone = "America/New_York"
|
||||||
|
timezone = user.get("tz", _default_timezone)
|
||||||
|
if timezone is None or '/' not in timezone:
|
||||||
|
timezone = _default_timezone
|
||||||
|
|
||||||
# userprofile's quota is hardcoded as per
|
# userprofile's quota is hardcoded as per
|
||||||
# https://github.com/zulip/zulip/blob/e1498988d9094961e6f9988fb308b3e7310a8e74/zerver/migrations/0059_userprofile_quota.py#L18
|
# https://github.com/zulip/zulip/blob/e1498988d9094961e6f9988fb308b3e7310a8e74/zerver/migrations/0059_userprofile_quota.py#L18
|
||||||
userprofile = dict(
|
userprofile = dict(
|
||||||
|
@ -61,7 +67,7 @@ def users2zerver_userprofile(slack_dir: str, realm_id: int, timestamp: Any,
|
||||||
avatar_version=1,
|
avatar_version=1,
|
||||||
autoscroll_forever=False,
|
autoscroll_forever=False,
|
||||||
default_desktop_notifications=True,
|
default_desktop_notifications=True,
|
||||||
timezone=user.get("tz", ""),
|
timezone=timezone,
|
||||||
default_sending_stream=None,
|
default_sending_stream=None,
|
||||||
enable_offline_email_notifications=True,
|
enable_offline_email_notifications=True,
|
||||||
user_permissions=[], # This is Zulip-specific
|
user_permissions=[], # This is Zulip-specific
|
||||||
|
@ -69,7 +75,7 @@ def users2zerver_userprofile(slack_dir: str, realm_id: int, timestamp: Any,
|
||||||
pointer=-1,
|
pointer=-1,
|
||||||
default_events_register_stream=None,
|
default_events_register_stream=None,
|
||||||
is_realm_admin=user.get('is_owner', False),
|
is_realm_admin=user.get('is_owner', False),
|
||||||
#invites_granted=0,
|
# invites_granted=0, # TODO
|
||||||
enter_sends=True,
|
enter_sends=True,
|
||||||
bot_type=1 if user.get('is_bot', False) else None,
|
bot_type=1 if user.get('is_bot', False) else None,
|
||||||
enable_stream_sounds=False,
|
enable_stream_sounds=False,
|
||||||
|
@ -104,7 +110,7 @@ def users2zerver_userprofile(slack_dir: str, realm_id: int, timestamp: Any,
|
||||||
emoji_alt_code=False,
|
emoji_alt_code=False,
|
||||||
realm=realm_id,
|
realm=realm_id,
|
||||||
quota=1073741824,
|
quota=1073741824,
|
||||||
#invites_used=0,
|
# invites_used=0, # TODO
|
||||||
id=user_id_count)
|
id=user_id_count)
|
||||||
|
|
||||||
# TODO map the avatar
|
# TODO map the avatar
|
||||||
|
@ -321,7 +327,9 @@ def main(slack_zip_file: str) -> None:
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
# TODO fetch realm config from zulip config
|
# TODO fetch realm config from zulip config
|
||||||
DOMAIN_NAME = "zulipchat.com"
|
DOMAIN_NAME = "zulipchat.com"
|
||||||
REALM_ID = 1 # TODO how to find this
|
# Hardcode this to 1, will implement later for zulipchat.com's case where it
|
||||||
|
# has multiple realms
|
||||||
|
REALM_ID = 1
|
||||||
REALM_NAME = "FleshEatingBatswithFangs"
|
REALM_NAME = "FleshEatingBatswithFangs"
|
||||||
NOW = float(datetime.utcnow().timestamp())
|
NOW = float(datetime.utcnow().timestamp())
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue