Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Add support for Slack user groups in rotations #115

Closed
gabriel-loo opened this issue Mar 6, 2024 · 4 comments · Fixed by #116
Closed

[FEATURE] Add support for Slack user groups in rotations #115

gabriel-loo opened this issue Mar 6, 2024 · 4 comments · Fixed by #116
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@gabriel-loo
Copy link

Slack provides the ability to create user groups to group multiple people together under the same @ handle (e.g. @designers). In some cases, duty rotations apply to user groups rather than to individuals. For example, if I want to assign bug triaging responsibilities to a different team each week, I'd like set that up with the following command:

@dienstplan create bug-triaging @teamA @teamB @teamC
It is your team's turn this week to triage new bug tickets in the backlog.

I think the command currently fails because the formatting is different between mentioning user groups and individual users.

User group ID format: <!subteam^S123ABC456>
Individual user ID format: <@U123ABC456>

Could dienstplan be updated to support rotating Slack user groups in addition to individual users?

@gabriel-loo gabriel-loo added the enhancement New feature or request label Mar 6, 2024
@pilosus
Copy link
Owner

pilosus commented Mar 6, 2024

Hi @gabriel-loo!

I think we can support user groups.

There are a few things to consider:

  1. The Slack API endpoint for listing users of a user group usergroups.users.list says nothing about the order. Is it deterministic? Is it guaranteed that requesting the endpoint multiple times yields the same results as long as no user added or removed? If it's deterministic, then we can rely on the endpoint without saving user ids of the group to the database and be sure round-robin rotations work properly. If it's not, then we will need to save the users to the database and subscribe to the events of the usergroup changes (new user added, user removed, etc.). We can probably use one of these:
  1. What happens if a user of a usergroup gets removed from the usergroup while the user is a current duty in dienstplan rotation? Probably, it should be an equivalent of @dienstplan update that recreates the rota and assigns current duty to the first user in the usergroup.

@gabriel-loo
Copy link
Author

Hi @pilosus,

I was actually thinking of treating user groups handles the same way individual users are managed.

Using this example:

@dienstplan create bug-triaging @teamA @teamB @teamC
It is your team's turn this week to triage new bug tickets in the backlog.

This would first assign the rotation to @teamA (and not just the first user in team A).


@dienstplan rotate bug-triaging

This would set it to @teamB which is next in the rotation.


@dienstplan who bug-triaging

would show

Hey @teamB, you are an on-call person for `bug-triaging` rotation.
It is your team's turn this week to triage new bug tickets in the backlog.

(Note: we may have to switch it to "you are on call for..." rather than "you are the on-call person for...")

@pilosus
Copy link
Owner

pilosus commented Mar 7, 2024

@gabriel-loo ah, I see what you mean. Yes, it makes sense to support this kind of mention, i.e. dienstplan doesn't care if it's an individual user or a user group, it just uses the entity in rotation.

It should be probably easy to do: the regex here must be amended to something like:

(?s)(?<userid>\<(@|!subteam\^)[A-Z0-9]+\>)

but I haven't tested it myself.

Plus, the wording here.

If you want to draft a PR feel free to do so.
Otherwise, I'd be able to do it myself in a couple of weeks.

@pilosus pilosus added the help wanted Extra attention is needed label Mar 7, 2024
pilosus added a commit that referenced this issue May 25, 2024
Slack user groups (subteams) are supported.

Closes #115
pilosus added a commit that referenced this issue May 25, 2024
Slack user groups (subteams) are supported.

Closes #115
@pilosus
Copy link
Owner

pilosus commented May 25, 2024

@gabriel-loo done in release 1.1.109

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants