feat: Add avatar stacks#37594
Conversation
|
|
for commit list it is done see screenshot |
|
Ok, ensure it also works on:
|
|
Basically any place that renders avatar + sha. Some places render 16px avatars, unify all to 20px |
yes just saw It - kinda interesting how it is different on many places |
|
Could probably extract a shared template for avatar+sha but doesn't have to be in this PR. Templates have a ton of duplication that should be reduced. |
maybe at the end if all fits we could decide if we do it here or somewhere else |
|
Regarding naming, this how Github does it, would suggest to align: 2 users = |
|
will continue tomorrow - too late for today |
|
Yes I will test this later. I was already planning to implement this but you were faster 😆. |
|
cleaning up a bit |
Extract and harden co-author trailer parsing, add reusable co-author avatar templates, and wire commit/repo views to render co-author metadata.
Show co-author avatar stacks on commit SHA surfaces including commits list rows, graph, blame, and dashboard feeds, with repository-level data propagation and tests. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
37438a1 to
10461b2
Compare
…d functions Addresses review feedback: wxiaoguang requested a backend render function (like RenderLabels) instead of templates; silverwind requested template consolidation. Moving logic to Go satisfies both — two templates are deleted and replaced by RenderUtils.CoAuthorAvatarStack / CoAuthorAvatars. Also removes vertical-align (no-op in flexbox), redundant z-index:0, and hardcoded font-size:10px from co-author CSS rules. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@silverwind can you have a look? |
…thor * origin/main: [skip ci] Updated translations via Crowdin fix: snap build (main branch) (go-gitea#37685) chore: introduce HTMLBuilder (go-gitea#37688) chore: clean up "contrib" dir (go-gitea#37690) feat(api): add sort and order query parameters to job list endpoints (go-gitea#37672) fix: Sort action run jobs by JobID and Name with matrix examples (go-gitea#37046) fix: catch and fix more lint problems (go-gitea#37674) docs(agents): update AGENTS.md (go-gitea#37684) fix(actions): run `TransferLogs` on `UpdateLog{Rows:[], NoMore:true}` (go-gitea#37631)
Address review on 977f311 and clean up several leftover rough edges: - Use util.NormalizeStringEOL and container.Set in the trailer parser - Switch util_render to htmlutil.HTMLBuilder - Move avatar/avatar-stack CSS to its own avatar.css - Drop the inline `--n` CSS-var trick and the 11 explicit z-index rules: emit children reversed and use flex-direction: row-reverse so the author lands leftmost AND last-painted (on top) - Drop dead additionalClasses param from AvatarStack; let .author-wrapper gap carry inter-item spacing - Collapse coAuthorsParsed+coAuthors cache pair into *[]*Signature - Extract git.CoAuthoredByTrailer, reuse in merge_squash, pull, temp_repo - Cache RepoLink/RefTypeNameSubURL on RenderUtils once instead of reading ctx.Data per call - Restore matched-user avatars on dashboard feed via PushCommit.AuthorUser (was a regression of the original AvatarStack switch) - Guard empty-href case in participantRowHTML; align authorNameLinkHTML email precedence with authorHref Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
…feature/display-co-author * bircni/feature/display-co-author:
|
all addressed in d6c2e4e. |
GetWithContextCache only stores on success, so unmatched author emails re-queried the DB on every PushCommit render across a feed. Drop the helper and use the ephemeral cache directly so the nil result is cached for the rest of the request. Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
- RenderUtils is constructed before the repo middleware runs, so caching RepoLink/RefTypeNameSubURL in the constructor snapshotted empty values and commitAuthorSearchURL never produced a search link on repo pages. Read them lazily from ctx.Data inside the helper. - AvatarStack short-circuited the single-author case to a bare <img>, regressing click-through on call sites that use it directly (commits_list_small, blame, dashboard feeds). Drop the short-circuit so the avatar is always wrapped via appendAvatarStackChild. - Narrow integration selector to a.muted now that .author-wrapper holds both the avatar link and the name link. - Drop a redundant u = nil reset in PushCommit.AuthorUser: GetUserByEmail already returns (nil, err) on every error path. Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
This comment was marked as resolved.
This comment was marked as resolved.
|
thanks for the help @silverwind lgtm! |
- 1px masking border (was 2px); drop forced circular `border-radius: 50%` so avatars keep their natural shape - on hover, transition border-color and background-color of `.avatar` to transparent since stacked avatars no longer overlap when spread - chip uses `var(--border-radius)`, hidden idle via `opacity: 0`, fades in on `.avatar-stack:hover` - move overflow/ellipsis from `.author-wrapper` onto its name children so the hover-spread is no longer clipped with 10+ authors - vary devtest scenarios so the author avatar isn't always u0/first Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
`Co-authored-by: <jane@example.com>` is a valid trailer that `mail.ParseAddress` accepts with `Name == ""`, which downstream renders an empty `<a class="muted" href="mailto:...">` with no visible text. Use the address as the display name when no name is given. Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
`opacity: 0` left the chip's 20px flex slot in the layout, widening the collapsed stack by ~4px. Collapse width, margin and border in the unhovered state and transition them alongside opacity so the chip materializes on hover without affecting baseline layout. Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com>
| } | ||
|
|
||
| // CoAuthorAvatars renders the avatar stack plus a label: `name` / `a and b` / `N people` (opens popup). | ||
| func (ut *RenderUtils) CoAuthorAvatars(authorUser *user_model.User, authorSig *git.Signature, coAuthors []*user_model.CoAuthorUser) template.HTML { |
There was a problem hiding this comment.
After reading the related code, I think the CoAuthorAvatars func should accept a single "PushCommit" argument (let the caller backend code prepare the struct), but not receiving the dynamic variables from template.
| AuthorName string | ||
| CommitterEmail string | ||
| CommitterName string | ||
| CoAuthors []*git.Signature `json:",omitempty"` |
There was a problem hiding this comment.
Where is the PushCommit marshalled as JSON?
Introduces user_model.CoAuthorAvatarData and helper methods on UserCommit and gitgraph.Commit so templates pass a single backend-prepared value instead of three loose fields. Also drops the unused json tag from PushCommit.CoAuthors. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>



Parse
Co-authored-by:trailers from commit messages and surface contributors as an avatar stack across the commit page, commits list, PR commits tab, latest-commit row, blame, graph, and dashboard feed.+Nchip for the rest.<a> and <b>; 3+ →<N> peopleopens a Tippy popup with all participants.mailto:.net/mail.ParseAddress, scans only the trailing paragraph, filters out the commit's own author/committer.Co-committed-by:emission on squash merge and web edits.Devtest:
/devtest/coauthor-avatars.Fixes #25521