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:
@@ -42,6 +42,7 @@ from events.services.competitions import CompetitionFetchError, fetch_game_info
|
||||
from events.services.rbihf_import import RBIHFImportError, apply_plan, build_plan, extract_team_id, fetch_html
|
||||
from events.services.recurrence import cancel_occurrence, detach_occurrence, generate_occurrences, propagate_series
|
||||
from events.services.referees import RefereeAssignmentError, add_external_referee, assign_referee, conflicting_events, eligible_referees, needs_referee_management, remove_referee, set_referee_fee
|
||||
from events.tasks import notify_new_event
|
||||
from formbuilder.models import Form as FormBuilderForm
|
||||
from formbuilder.models import Submission
|
||||
from members.forms import ClaimRejectForm, ClaimReviewForm
|
||||
@@ -2795,6 +2796,10 @@ class EventCreateView(ClubStaffRequiredMixin, CreateView):
|
||||
response = super().form_valid(form)
|
||||
body = _("“%(event)s” created.") % {"event": self.object}
|
||||
notify(self.request, f"s|{_('Event created')}|{body}")
|
||||
# A deliberately-planned single event, not every Event row that ends up
|
||||
# created (see notify_new_event's own docstring for why a recurring
|
||||
# series' occurrences and bulk fixture imports aren't wired to this).
|
||||
notify_new_event.delay(str(self.object.pk))
|
||||
return response
|
||||
|
||||
def get_success_url(self):
|
||||
|
||||
Reference in New Issue
Block a user