2323 create_teams_in_view , update_team_participants ,
2424 calculate_timezone_offset )
2525from teams .forms import HackProjectForm , EditTeamName
26- # from teams.tasks import remove_admin_from_channel
2726
2827SLACK_CHANNEL_ENDPOINT = 'https://slack.com/api/conversations.create'
2928SLACK_CHANNEL_INVITE_ENDPOINT = 'https://slack.com/api/conversations.invite'
@@ -47,8 +46,13 @@ def change_teams(request, hackathon_id):
4746 team_size = hackathon .team_size
4847 team_sizes = sorted (choose_team_sizes (participants , team_size ))
4948 if len (team_sizes ) == 0 :
50- return render (request , 'change_teams.html' ,
51- {'num_participants' : len (participants )})
49+ return render (request , 'change_teams.html' , {
50+ 'num_participants' : len (participants ),
51+ 'hackathon_id' : hackathon_id ,
52+ 'teams' : [],
53+ 'leftover_participants' : [],
54+ 'edit' : edit ,
55+ })
5256 grouped_participants , hackathon_level = group_participants (
5357 participants , len (team_sizes ))
5458 team_levels = sorted (choose_team_levels (len (team_sizes ), hackathon_level ))
@@ -279,7 +283,10 @@ def create_private_channel(request, team_id):
279283 users .append (team .mentor .username )
280284
281285 # Add admins to channel for administration purposes
282- for admin in slack_site_settings .slack_admins .all ():
286+ slack_admins = (team .hackathon .channel_admins .all ()
287+ if slack_site_settings .use_hackathon_slack_admins
288+ else slack_site_settings .slack_admins .all ())
289+ for admin in slack_admins :
283290 users .append (admin .username )
284291 # First need to add Slack Bot to then add users to channel
285292 response = admin_client .invite_users_to_slack_channel (
@@ -311,10 +318,9 @@ def create_private_channel(request, team_id):
311318 f'Please add the missing users manually.' ))
312319 else :
313320 messages .success (request , 'Private Slack Channel successfully created' )
314-
321+
315322 if slack_site_settings .remove_admin_from_channel :
316- # remove_admin_from_channel.apply_async(args=[users_to_invite, channel])
317- pass
323+ admin_client .leave_channel (channel )
318324
319325 return redirect (reverse ('view_team' , kwargs = {'team_id' : team_id }))
320326
0 commit comments