feat: add group duty pin notification feature
All checks were successful
CI / lint-and-test (push) Successful in 23s

- Introduced a new configuration option `DUTY_PIN_NOTIFY` to control whether the bot re-pins the duty message when updated, providing notifications to group members.
- Updated the architecture documentation to reflect the new functionality of re-pinning duty messages.
- Enhanced the `.env.example` file to include the new configuration option with a description.
- Added tests to verify the behavior of the new refresh pin command and its integration with the existing group duty pin functionality.
- Updated internationalization messages to include help text for the new `/refresh_pin` command.
This commit is contained in:
2026-02-23 10:51:47 +03:00
parent 77a94fa91b
commit 8091c608e8
14 changed files with 270 additions and 24 deletions

View File

@@ -46,7 +46,7 @@ def test_build_personal_ics_one_duty():
def test_build_team_ics_vevent_has_description_with_full_name():
"""Team ICS VEVENT includes DESCRIPTION with the duty holder's full_name."""
"""Team ICS VEVENT has SUMMARY=full_name and DESCRIPTION=full_name."""
duties = [
_duty(1, "2025-02-20T09:00:00Z", "2025-02-20T18:00:00Z", "duty"),
]
@@ -56,11 +56,28 @@ def test_build_team_ics_vevent_has_description_with_full_name():
events = [c for c in cal.walk() if c.name == "VEVENT"]
assert len(events) == 1
ev = events[0]
assert ev.get("summary") == "Duty"
assert ev.get("summary") == "Test User"
assert ev.get("description") == "Test User"
assert b"Team Calendar" in ics or "Team Calendar" in ics.decode("utf-8")
def test_build_team_ics_empty_full_name_summary_fallback():
"""When full_name is empty or missing, SUMMARY is 'Duty'."""
duty_ns = SimpleNamespace(
id=1,
start_at="2025-02-20T09:00:00Z",
end_at="2025-02-20T18:00:00Z",
event_type="duty",
)
for empty_name in ("", " ", None):
duties = [(duty_ns, empty_name)]
ics = build_team_ics(duties)
cal = ICalendar.from_ical(ics)
events = [c for c in cal.walk() if c.name == "VEVENT"]
assert len(events) == 1
assert events[0].get("summary") == "Duty"
def test_build_personal_ics_event_types():
"""Unavailable and vacation get correct SUMMARY."""
duties = [