Skip to content

fix: support invited by in waitlist invite#17

Merged
shavonn merged 2 commits into
mainfrom
fix/support-invited-by
May 9, 2026
Merged

fix: support invited by in waitlist invite#17
shavonn merged 2 commits into
mainfrom
fix/support-invited-by

Conversation

@shavonn
Copy link
Copy Markdown
Contributor

@shavonn shavonn commented May 9, 2026

Allow invited_by (and other options) to be passed through Waitlist::invite()

WaitlistService::invite() now accepts an optional array $options = [] second argument that's forwarded to InviteOnly::invite(). This unblocks setting invited_by (the field was always being written as null) and also exposes role, metadata, and expires_at to callers without changing existing call sites.

Why

Inviting from the waitlist always resulted in invitations.invited_by = null, since the service had no parameter for it and never consulted auth(). The fix belongs in the package — every consumer benefits, and no app-side wrapper is needed.

Behavior

  • Caller-supplied options override config-derived defaults from resolveInvitationMetadata().
  • If invited_by is not provided, it falls back to auth()->user().
  • If no user is authenticated and none is passed, invited_by stays null (prior behavior).
  • Backward compatible — Waitlist::invite($entry) still works unchanged.

Copilot AI review requested due to automatic review settings May 9, 2026 20:49
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the waitlist invitation flow so callers can pass invitation options (notably invited_by) through Waitlist::invite() / WaitlistService::invite(), enabling correct attribution and exposing additional invitation fields while keeping existing call sites backwards compatible.

Changes:

  • Added optional $options = [] argument to WaitlistService::invite() and forwarded/merged it into InviteOnly::invite(...).
  • Added feature tests validating invited_by pass-through and authenticated-user fallback behavior.
  • Updated README to document the new Waitlist::invite($entry, $options) usage and signature.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/WaitlistService.php Accepts and forwards invitation options; introduces invited_by fallback behavior.
tests/Feature/WaitlistTest.php Adds regression tests for invited_by being passed and defaulted.
README.md Documents new invite(..., $options) capability and updates the public API signature.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/WaitlistService.php
Comment thread tests/Feature/WaitlistTest.php
@shavonn shavonn merged commit e4177e5 into main May 9, 2026
20 checks passed
@shavonn shavonn deleted the fix/support-invited-by branch May 9, 2026 21:03
@github-actions github-actions Bot mentioned this pull request May 9, 2026
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