Skip to content

Let a team reminder skip members of chosen teams - #152

Open
wayx112 wants to merge 2 commits into
Team6083:mainfrom
wayx112:feat/reminder-exempt-teams
Open

wayx112 wants to merge 2 commits into
Team6083:mainfrom
wayx112:feat/reminder-exempt-teams

Conversation

@wayx112

@wayx112 wayx112 commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Some members, such as mentors, don't need to fill in availability, but a team's reminder tags everyone in the team and its sub-teams who hasn't, every day. This lets a reminder skip members of chosen teams.

team admin page   Fill-in reminder → "Don't remind members of": toggle any other team (e.g. Mentor)
rule config       unanswered: { weekdays, daysAhead, exemptTeamIds? }
sending           members in an exempt team or its sub-teams are left out of the list and the count
  • Who is exempt is decided by teams: OverHours doesn't keep members' Keycloak roles, only the teams they joined by role, so the reminder can't filter by role when the scheduler runs. A team can, and a team can join people by Keycloak role through its auto-join roles. So who is a mentor stays in Keycloak: make a Mentor team that joins them by role, and pick it in each team's reminder.
  • Storage: exemptTeamIds is an optional field in the "unanswered" rule's config (ObjectIds, deduped, at most 50), so rules saved before keep working and there is no schema change.
  • Preview: "If it went out now" leaves the exempt members out too.
  • UI: one toggle button per team, like the weekday buttons, with a help line on how to use it for mentors. The team itself and its ancestors aren't offered, since exempting them would leave nobody to remind.

Evidence

On a local preview with a real MongoDB, a Mentor team (one member of 機械組 also in it), and the parent team's reminder:

before picking Mentor   preview lists 一般成員, 測試成員丁 (in Mentor), 測試成員壬, 測試成員戊
after picking Mentor    preview lists 一般成員, 測試成員壬, 測試成員戊
phone width (375 px)    the team buttons wrap; no horizontal scroll
Test Files  25 passed (25)
     Tests  336 passed (336)

New tests:

  • Members of an exempt team and of its sub-teams aren't tagged or counted.
  • A reminder with everyone left exempt sends nothing.
  • Saving stores the exempt teams, and a saved rule without them reads as none.
  • Exempt team ids that aren't ObjectIds are rejected, and duplicates are dropped.

tsc --noEmit, ESLint on the changed files and npm run build pass.

Merge danger

Door: two-way. An optional config field; no schema change.

Blast radius: the team reminder settings and who gets reminded.

  • A deleted team left in a rule's list does nothing (no member is in it). It is dropped the next time an admin toggles a team button on that page and saves, and not before.

🤖 Generated with Claude Code

Some members, such as mentors, don't need to fill in availability, but the reminder tagged them every day. The
"unanswered" rule takes an optional list of exempt teams: anyone in one of them, or in its sub-teams, is never
reminded and isn't counted. Who is a mentor stays in Keycloak: a mentors team can join them by role (auto-join
roles), and each team's reminder picks it on the admin page. The field is optional in the rule's config, so saved
rules keep working and no schema change is needed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@kennhung kennhung left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Using teams (joined by Keycloak role) to decide who is exempt fits keeping the member system as the source of truth. Two minor notes inline.

This PR, #150 and #151 all touch team-reminder-dto.ts and its test, so expect a conflict resolution on whichever merges later. Suggested order: #150, #152, #151.

});
const exempt = settings.exemptTeamIds ?? [];
const toggleExempt = (id: string) => set({
exemptTeamIds: teams.map(team => team.id).filter(teamId => (teamId === id) !== exempt.includes(teamId)),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two small things, neither blocking:

  1. Rebuilding the list from teams.map(...) drops ids of deleted teams the first time any button is toggled. That is nice, but the PR description says they are not cleaned up, so the two should agree.
  2. A team can pick its own parent here, which exempts every member of this team, so the reminder is always empty. Consider a hint or filtering ancestors out of the buttons.

Exempting this team or one of its ancestors makes every member exempt, so the reminder is always empty. The
buttons now leave out the team itself and its ancestors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wayx112

wayx112 commented Nov 15, 2026

Copy link
Copy Markdown
Contributor Author

Thanks, both handled in 2ee245f.

  1. Deleted teams: the description now matches the behaviour. A deleted team's id does nothing, and it's dropped the next time an admin toggles a team button on that page and saves.
  2. Own parents: the buttons now leave out the team itself and all its ancestors (getTeamAncestors), since exempting them would leave nobody to remind. Checked on the preview: on 機械組 (under 公關組 under 機器人隊) only the other teams are offered.

Tests (336), tsc --noEmit and ESLint pass.

@wayx112
wayx112 requested a review from kennhung November 15, 2026 23:51

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants