You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat: preview organizations when hovering their commits' author - #1451
Hovering a person's avatar or name on a commit opens their hover card, but an organization's commits had none. They now open one too, with the organization's bio, how many commits it has published, how many follow it, and a Follow button.
Changes
New GET /mentions/organizations/{organization}/preview (OrganizationPreviewController, throttle:people like the user preview) returning commitsCount, followersCount and isFollowing. Commits count approved ones, like a user's card; followers and isFollowing use the same queries as the organization page.
UserPreview no longer skips organization authors: it fetches that endpoint and renders an organization card (square avatar, lane ring, "Organization" badge) in the same popover. Every place that hovers a commit's author gets it.
One sentence in KNOWLEDGE_BASE.md.
Validation
New OrganizationPreviewControllerTest (counts, follow state for a follower, a member and a guest, pending and deleted commits left out, 404) and a case in AuthorHover.test.tsx.
pest --no-tia on tests/Feature/Controllers, ArchTest and RateLimitTest: 2901 passed. vp test run --config tests/draft-images.config.ts: 883 passed.
Coverage could not be measured locally (no coverage driver); left to CI.
Visual evidence
Latest log as a guest, mouse resting on the Laravel organization's avatar for 1.5 s. Chrome, 1440 px wide, local app with seeded data. Before is production at 9c74e97d, after is this branch at 734b6952.
Before: nothing opens
After, dark
After, light
Device verification
Not applicable: hover cards only open with a mouse on devices that can hover, so nothing changes on touch screens.
Independent review
Reviewed by a separate read-only agent on base 9c74e97d, head 734b6952: CODE: PASS and VISUAL: PASS on the three captures above. Two of its findings were fixed before publishing (the endpoint returned an unused copy of the organization; a redundant null check).
Limitations
Following from the card refreshes only auth, as on the organization's page, so the Following log shows the organization's commits on the next visit rather than at once.
Captured as a guest at desktop width only; no capture of the followed state.
Summary by CodeRabbit
New Features
Organization mentions can display a hover card with follower and approved commit counts, plus a Follow control.
Organization previews report whether the viewer follows the organization.
Documentation
Clarified organization-owned commit visibility and interactions, member notifications and access to pending or rejected commits, and cancellation of scheduled posts when membership ends.
Documented API posting with the organization handle as the author.
No actionable comments were generated in the recent review.
Walkthrough
The change adds an organization preview endpoint and enables organization hover cards. The cards show organization details, follow controls, commit counts, and follower counts. Documentation describes organization commit interactions and API submissions.
Changes: Organization Author Previews
Layer / File(s)
Summary
Preview endpoint and route app/Http/Controllers/OrganizationPreviewController.php, routes/web.php, tests/Feature/Controllers/OrganizationPreviewControllerTest.php
The endpoint returns approved commit and follower counts, plus whether the current user follows the organization. The route applies the people throttle and UUID constraint. Feature tests cover response data, follow states, and unknown organizations.
The preview cache supports user and organization data. UserPreview selects the organization route for organization authors and schedules their previews on hover.
Organization hover card and supporting coverage resources/js/components/user-preview.tsx, tests/Unit/AuthorHover.test.tsx, KNOWLEDGE_BASE.md
The card displays organization details, a follow control, and commit and follower counts. The unit test checks its accessible label. The documentation describes organization commit interactions and API submissions.
sequenceDiagram
participant UserPreview
participant OrganizationPreviewController
participant OrganizationPreviewContent
UserPreview->>OrganizationPreviewController: Request organization preview data
OrganizationPreviewController-->>UserPreview: Return counts and follow state
UserPreview->>OrganizationPreviewContent: Render organization details and preview data
Loading
Possibly related issues
Issue 1363: This change adds previews for organization authors, including organization-authored commits described in the issue.
Issue 1520: The organization card displays bio, approved commit count, and follower count. It does not add the requested repository links or organization README.
Suggested reviewers:mnapoli, xheaven, nunomaduro
Merge Risk: Minimal · up to c4d86
This adds organization hover cards to commit authors, with a throttled preview endpoint and feature and unit tests. No concrete merge-blocking risk was found.
Security architecture risk: Low · up to 734b6
The new endpoint provides bounded summary data using existing visibility, identity, and throttling controls. Follow actions retain server-side authentication. No material security regression was established, although generated client routing and all browser-session transition behavior were not verified end to end.
Retained concerns
No architecture-level concerns identified.
Security review details
Security Blast Radius
observed — Unauthenticated callers can request summary counts for organizations whose UUIDs they supply. The endpoint shares the existing people throttle: 120 requests per minute, keyed by authenticated user or guest IP. It introduces no write operation or follower-identity enumeration in its response.
Trust Boundaries and Controls
observed — The client does not choose the acting user's identity. Preview relationship state comes from CurrentUser, and follow mutations remain inside the authenticated route group with a separate follows throttle. Their controllers apply actions to the authenticated user and bound organization.
Resilience and Maintainability Implications
observed — Server follow creation uses syncWithoutDetaching and deletion uses detach, limiting repeated operations to the requesting user's relationship with one organization. The shared-state hook reads an initial value without storing it, so the card's loading fallback alone does not establish persistent false follow state.
Hardening Proposals
proposed — Consider explicitly scoping viewer-sensitive preview and shared follow caches to the authenticated identity, or clearing them on identity changes. This is lifecycle hardening, not a verified cross-user disclosure or authorization bypass; normal sign-in already performs a full-page navigation.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title "feat: preview organizations when hovering their commits' author" matches the main change. The changeset adds an organization preview endpoint (OrganizationPreviewController, route in routes…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title "feat: preview organizations when hovering their commits' author" matches the main change. The changeset adds an organization preview endpoint (OrganizationPreviewController, route in routes/web.php), extends user-preview.tsx to render organization hover cards with commit count, follower count, and a Follow button, and adds tests for both the endpoint and the hover component. The title is specific and concise, and it describes the primary change from the developer's perspective.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: defaults
Review profile: CHILL
Plan: Advanced
Run ID: 94adfc51-2598-4543-9548-9abc1bf53391
Commits
Reviewing files that changed from the base of the PR and between 734b695 and c4d8668.
Files selected for processing: 3
KNOWLEDGE_BASE.md
resources/js/components/user-preview.tsx
routes/web.php
Files skipped from review as they are similar to previous changes: 1
KNOWLEDGE_BASE.md
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.
This message is generated by an AI agent on behalf of @jubianchi. It may contain errors—verify important details.
Now that UserPreview handles organizations too, ProfilePreview (profile-preview.tsx) would be a better name, matching the profiles table and ProfileType. It isn't renamed here, on purpose:
The rename touches 16 files (12 components and pages, 4 tests), plus the user-previewdata-test values two tests rely on. It would bury this change in the diff.
The frontend already has a Profile type (resources/js/types/auth.ts), but it means a user with their counts, never an organization, and this file uses it for the user card's data. Inside a ProfilePreview that also previews organizations, "profile" would then mean two different things, so a clean rename should rename that type too (e.g. UserWithCounts).
Five other open PRs edit user-preview.tsx (#1249, #1126, #732, #699, #690), so moving the file now would force them to rebase.
If it's welcome, I can open a separate refactor: PR for it once this one is settled, whenever suits the PRs above.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Hovering a person's avatar or name on a commit opens their hover card, but an organization's commits had none. They now open one too, with the organization's bio, how many commits it has published, how many follow it, and a Follow button.
Changes
GET /mentions/organizations/{organization}/preview(OrganizationPreviewController,throttle:peoplelike the user preview) returningcommitsCount,followersCountandisFollowing. Commits count approved ones, like a user's card; followers andisFollowinguse the same queries as the organization page.UserPreviewno longer skips organization authors: it fetches that endpoint and renders an organization card (square avatar, lane ring, "Organization" badge) in the same popover. Every place that hovers a commit's author gets it.KNOWLEDGE_BASE.md.Validation
OrganizationPreviewControllerTest(counts, follow state for a follower, a member and a guest, pending and deleted commits left out, 404) and a case inAuthorHover.test.tsx.pest --no-tiaontests/Feature/Controllers,ArchTestandRateLimitTest: 2901 passed.vp test run --config tests/draft-images.config.ts: 883 passed.phpstan,pint --test,rector --dry-run,tsc,vp fmt --check,vp lint: passed.Visual evidence
Latest log as a guest, mouse resting on the Laravel organization's avatar for 1.5 s. Chrome, 1440 px wide, local app with seeded data. Before is
productionat9c74e97d, after is this branch at734b6952.Device verification
Not applicable: hover cards only open with a mouse on devices that can hover, so nothing changes on touch screens.
Independent review
Reviewed by a separate read-only agent on base
9c74e97d, head734b6952: CODE: PASS and VISUAL: PASS on the three captures above. Two of its findings were fixed before publishing (the endpoint returned an unused copy of the organization; a redundant null check).Limitations
auth, as on the organization's page, so the Following log shows the organization's commits on the next visit rather than at once.Summary by CodeRabbit