Notify members when a new event is planned
New events.tasks.notify_new_event, scheduled from management.views.EventCreateView.form_valid -- the deliberate "a staff member planned one new event" action, not every Event row that happens to get created. A recurring series' rolling-horizon extension (extend_event_series) and bulk fixture imports are NOT wired to this on purpose: either would flood everyone with one push per occurrence instead of the single, deliberate action this is meant to catch. Notifies whoever is still NO_RESPONSE right after creation -- exactly "everyone who needs to respond", using the existing notify_members() -> Notification -> mobile.signals push chain already in place, so this is in-app (visible in the M7 inbox, mark read/mark-all-read) and a push notification both, with no new plumbing needed there. Generalized mobile.views.NotificationsView's News-only "tap to open the source" handling (previously isinstance(source, News)) into _notification_source_link, covering Event sources too -- tapping an "new event" notification now marks it read and opens the event's answer screen, the same way a news notification already opened the article. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ECGMEwrc2k4D8VQuwjstj9
This commit is contained in:
@@ -5158,6 +5158,18 @@ class EventManagementTests(ManagementTestBase):
|
||||
self.assertRedirects(response, reverse("management:event_detail", args=[event.pk]))
|
||||
self.assertIn(self.own_team, event.teams.all())
|
||||
|
||||
def test_creating_an_event_notifies_the_invited_roster(self):
|
||||
position = Position.objects.create(club=self.club, name="Forward", short_name="F")
|
||||
player = Member.objects.create(first_name="Poul", last_name="Player")
|
||||
TeamMembership.objects.create(team=self.own_team, member=player, season=self.season, position=position)
|
||||
self.client.force_login(self.own_team_coach)
|
||||
|
||||
self.club_post("event_create", self.event_data())
|
||||
|
||||
event = Event.objects.get(title="Training")
|
||||
notification = Notification.objects.get(member=player, content_type__model="event", object_id=str(event.pk))
|
||||
self.assertEqual(notification.title, "Training")
|
||||
|
||||
def test_creating_an_event_with_a_same_club_location_does_not_raise_a_cross_club_error(self):
|
||||
# Regression: Event.clean() rejects a location from another club by
|
||||
# comparing against self.club_id, which was still None on a brand-new
|
||||
|
||||
Reference in New Issue
Block a user