Skip to content

chore: Sync main with dev - #22

Merged
nfebe merged 4 commits into
mainfrom
chore/sync-main-with-dev
Jun 14, 2026
Merged

nfebe merged 4 commits into
mainfrom
chore/sync-main-with-dev

Conversation

@nfebe

@nfebe nfebe commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

No description provided.

nfebe added 4 commits June 13, 2026 19:37
Invited users can now accept or decline a workspace invitation through
the API, completing the invitation lifecycle that previously supported
only creating and cancelling invites.

The invite and join moments now emit events, so a host application can
react to them, for example to deliver the invitation email.
Member, owner, and admin lists came back empty for any app that uses its
own Workspace subclass: the lookups compared against the base package
class while the stored role assignments reference the configured model.
They now resolve against the actual model, so members appear as expected.
Reconcile the diverged branches: bring dev's outstanding change (the
workspace-subclass member-lookup fix) onto main and align the version and
changelog to 1.1.1. Resolves the only conflicts, which were the version
and changelog entries.
@sourceant

sourceant Bot commented Jun 14, 2026

Copy link
Copy Markdown

Code Review Summary

This PR updates the Workspace model to support Late Static Binding for polymorphic role assignments. This fixes a bug where members and owners could not be retrieved if the host application extended the Workspace model.

🚀 Key Improvements

  • Switched from self::class to static::class in src/Models/Workspace.php to support model inheritance.
  • Added a comprehensive feature test tests/Feature/SubclassedWorkspaceTest.php to prevent regressions for subclassed workspaces.

💡 Minor Suggestions

  • Use firstOrFail() in tests when fetching the owner role to provide better error messaging if the role is missing.

@sourceant sourceant Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review complete. See the overview comment for a summary.

RoleAssignment::create([
'assignable_type' => User::class,
'assignable_id' => $user->id,
'role_id' => Role::where('slug', 'owner')->first()->id,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Relying on first() without checking for null can lead to errors if the database state is unexpected. While likely seeded in tests, using firstOrFail() or a explicit check is safer.

Suggested change
'role_id' => Role::where('slug', 'owner')->first()->id,
'role_id' => Role::where('slug', 'owner')->firstOrFail()->id,

@nfebe
nfebe merged commit 043e29d into main Jun 14, 2026
3 checks passed
@nfebe
nfebe deleted the chore/sync-main-with-dev branch June 14, 2026 11:55
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.

1 participant