Class SetupTeamSlackChannelsJob
java.lang.Object
edu.ucsb.cs156.frontiers.jobs.SetupTeamSlackChannelsJob
- All Implemented Interfaces:
edu.ucsb.cs156.jobs.services.JobContextConsumer
public class SetupTeamSlackChannelsJob
extends Object
implements edu.ucsb.cs156.jobs.services.JobContextConsumer
Makes the public Slack channels of a course's teams match the teams.
- For each team, works out a channel name: "team-" followed by the team name in the form
Slack requires (see
sanitizeChannelName(String)). If two teams end up with the same channel name, the job stops with an error naming them, before touching Slack. - Creates each channel, unless it already exists.
- Adds each member of each team, and the instructor of the course, to the team's channel, unless they are already in it. People are matched to Slack users by email; those without an active Slack account cannot be added, and are only counted.
- Removes from each channel every person who is neither a member of the team, nor the instructor, nor a member of the course staff. Bots (including the bot this job acts as) and members that are not users of the workspace are never removed.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(edu.ucsb.cs156.jobs.services.JobContext ctx) static StringchannelNameFor(String teamName) static StringsanitizeChannelName(String teamName) Turns a team name into the form Slack requires of channel names: all lowercase, spaces replaced by hyphens, and every character other than letters, numbers, hyphens and underscores replaced by a hyphen.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface edu.ucsb.cs156.jobs.services.JobContextConsumer
getJobName
-
Field Details
-
CHANNEL_PREFIX
- See Also:
-
-
Constructor Details
-
SetupTeamSlackChannelsJob
public SetupTeamSlackChannelsJob()
-
-
Method Details
-
getScopeType
- Specified by:
getScopeTypein interfaceedu.ucsb.cs156.jobs.services.JobContextConsumer
-
getScopeId
- Specified by:
getScopeIdin interfaceedu.ucsb.cs156.jobs.services.JobContextConsumer
-
sanitizeChannelName
Turns a team name into the form Slack requires of channel names: all lowercase, spaces replaced by hyphens, and every character other than letters, numbers, hyphens and underscores replaced by a hyphen.- Parameters:
teamName- the team name; may be null- Returns:
- the sanitized name (without the "team-" prefix)
-
channelNameFor
-
accept
-