Move subteam created/updated functions
@@ -2762,27 +2762,6 @@ def process_message(message_json, eventrouter, store=True, download=True, **kwar
if download:
download_files(message_json, **kwargs)
-def process_subteam_created(subteam_json, eventrouter, **kwargs):
- team = kwargs['team']
- subteam_json_info = subteam_json['subteam']
- subteam = SlackSubteam(team.identifier, **subteam_json_info)
- team.subteams[subteam_json_info['id']] = subteam
-
-def process_subteam_updated(subteam_json, eventrouter, **kwargs):
- team = kwargs['team']
- usergroups = team.generate_usergroup_map()
- new_subteam_info = subteam_json['subteam']
-
- current_subteam_info = team.subteams[new_subteam_info.get('id')]
-
- if config.notify_usergroup_handle_updated and current_subteam_info.handle != new_subteam_info['handle']:
- usergroups[new_subteam_info['handle']] = new_subteam_info.get('id')
- template = 'User group @{old_handle} has updated its handle to @{new_handle} in team {team}'
- message = template.format(old_handle=current_subteam_info.handle, new_handle=new_subteam_info['handle'],
- team=team.preferred_name)
- team.buffer_prnt(message, message=True)
-
- team.subteams[new_subteam_info.get('id')] = SlackSubteam(team.identifier, **new_subteam_info)
def download_files(message_json, **kwargs):
team = kwargs["team"]
@@ -3029,6 +3008,30 @@ def process_reaction_removed(message_json, eventrouter, **kwargs):
dbg("Reaction to item type not supported: " + str(message_json))
+def process_subteam_created(subteam_json, eventrouter, **kwargs):
+ team = kwargs['team']
+ subteam_json_info = subteam_json['subteam']
+ subteam = SlackSubteam(team.identifier, **subteam_json_info)
+ team.subteams[subteam_json_info['id']] = subteam
+
+
+def process_subteam_updated(subteam_json, eventrouter, **kwargs):
+ team = kwargs['team']
+ usergroups = team.generate_usergroup_map()
+ new_subteam_info = subteam_json['subteam']
+
+ current_subteam_info = team.subteams[new_subteam_info.get('id')]
+
+ if config.notify_usergroup_handle_updated and current_subteam_info.handle != new_subteam_info['handle']:
+ usergroups[new_subteam_info['handle']] = new_subteam_info.get('id')
+ template = 'User group @{old_handle} has updated its handle to @{new_handle} in team {team}'
+ message = template.format(old_handle=current_subteam_info.handle, new_handle=new_subteam_info['handle'],
+ team=team.preferred_name)
+ team.buffer_prnt(message, message=True)
+
+ team.subteams[new_subteam_info.get('id')] = SlackSubteam(team.identifier, **new_subteam_info)
+
+
def process_emoji_changed(message_json, eventrouter, **kwargs):
team = kwargs['team']
team.load_emoji_completions()
