Class SetupSectionSlackChannelsJob
java.lang.Object
edu.ucsb.cs156.frontiers.jobs.SetupSectionSlackChannelsJob
- All Implemented Interfaces:
edu.ucsb.cs156.jobs.services.JobContextConsumer
public class SetupSectionSlackChannelsJob
extends Object
implements edu.ucsb.cs156.jobs.services.JobContextConsumer
Makes the public Slack channels of a course's sections match the roster.
- For each row of the sections table that has a Slack channel name, creates a public channel with that name, unless it already exists. (Several sections may share a channel.)
- Adds each roster student (status ROSTER or MANUAL) to the channel of their section, unless they are already in it. Students are matched to Slack users by email; students without an active Slack account cannot be added, and are only counted, by reason (invited but not accepted yet, account deactivated, or not in the workspace).
- Removes from each of those channels every person who is neither a roster student of one of the channel's sections, nor a member of the course staff, nor the instructor. Bots (including the bot this job acts as) and members that are not users of the workspace are never removed. Whether the bot may remove members from public channels is a workspace setting; if Slack refuses (restricted_action), the log says how to change the setting and no further removals are attempted in that run.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final List<RosterStatus> Only these roster students are considered: in particular, not dropped students. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(edu.ucsb.cs156.jobs.services.JobContext ctx) static StringnormalizeChannelName(String name) Slack channel names are lowercase, and are written with a leading # that is not part of the name.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
-
ENROLLED_STATUSES
Only these roster students are considered: in particular, not dropped students.
-
-
Constructor Details
-
SetupSectionSlackChannelsJob
public SetupSectionSlackChannelsJob()
-
-
Method Details
-
getScopeType
- Specified by:
getScopeTypein interfaceedu.ucsb.cs156.jobs.services.JobContextConsumer
-
getScopeId
- Specified by:
getScopeIdin interfaceedu.ucsb.cs156.jobs.services.JobContextConsumer
-
accept
-
normalizeChannelName
Slack channel names are lowercase, and are written with a leading # that is not part of the name.- Parameters:
name- the name as entered for the section; may be null- Returns:
- the name to use with the Slack API, or an empty string if there is none
-