Skip to content

Don't send community event invites to users already attending#9310

Open
nabramow wants to merge 2 commits into
developfrom
na/backend/dont-send-notif-to-attending
Open

Don't send community event invites to users already attending#9310
nabramow wants to merge 2 commits into
developfrom
na/backend/dont-send-notif-to-attending

Conversation

@nabramow

Copy link
Copy Markdown
Member

Closes Couchers-org/bugs#99.

When an editor approves a community invite for an event, the notification fan-out (generate_event_create_notifications) notified every visible community member, including people who had already RSVP'd and the event's organizers.

Now attendees of the occurrence and organizers of the event are excluded; subscribers (followers who haven't RSVP'd) still receive the invite. Added a test covering the reported scenario (RSVP before the invite is approved).

Testing

Explain how you tested this PR and give clear steps so the reviewer can replicate.

  • Kinda hard to test as we need to trigger the however many days before notif, so mostly code review and tests passing

Backend checklist

  • Added tests for any new code or added a regression test if fixing a bug
  • Run the backend locally and it works
  • Added migrations if there are any database changes, rebased onto develop if necessary for linear migration history

For maintainers

  • Maintainers can push commits to my branch
  • Maintainers can merge this PR for me

@CouchersBot

CouchersBot commented Jul 22, 2026

Copy link
Copy Markdown
Member

Mobile

Install the Dev Tool (iOS via TestFlight, iOS Simulator, or Android .apk) here.

Scan the QR with your phone camera, or tap Open in Dev Tool on the device, to open this branch in the installed Dev Tool dev client.

    iOS         Android    
    QR to open the iOS build         QR to open the Android build    
    Open in Dev Tool         Open in Dev Tool    
Deep links

iOS

couchers-devtool://expo-development-client/?url=https%3A%2F%2Fdd423839--ota.preview.couchershq.org%2Fios%2Fmanifest

Android

couchers-devtool://expo-development-client/?url=https%3A%2F%2Fdd423839--ota.preview.couchershq.org%2Fandroid%2Fmanifest

Web (Vercel)

View the Vercel web preview for this branch.

Backend

Schema Schema diff Sample emails

Other

Protos Backend coverage Web coverage

@aapeliv aapeliv 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.

i think when we made this, we were thinking it would be helpful for the organizer to see what the email looked like

logger.error(f"Inviting user {payload.inviting_user_id} is gone while trying to send event notification?")
return

# people already attending or organizing the event don't need an invite to it

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.

let's move this into get_users_to_notify_for_new_event; and do it in that single SQL query; instead of adding two more

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.

3 participants