2
0

feat(repo): add owner display name field for repositories

Add OwnerDisplayName field to Repository model to allow custom display name for repository owner (e.g., "John Smith" instead of username). Used in license generation, social cards, and other public-facing contexts. Includes migration v368 to add column, UI in repository settings, and updates to license creation and social card rendering to use display name when available.
This commit is contained in:
2026-03-15 22:19:20 -04:00
parent 56fd71ad6b
commit 123eb78b54
12 changed files with 49 additions and 3 deletions

View File

@@ -159,8 +159,12 @@ func getOrCreateProfileRepo(ctx *context.Context, org *organization.Organization
// createOrgLicenseFile creates a LICENSE.md file in the profile repo
func createOrgLicenseFile(ctx *context.Context, repo *repo_model.Repository, licenseType string) error {
// Get license content from templates
ownerName := repo.OwnerDisplayName
if ownerName == "" {
ownerName = repo.OwnerName
}
licenseContent, err := repo_module.GetLicense(licenseType, &repo_module.LicenseValues{
Owner: repo.OwnerName,
Owner: ownerName,
Email: ctx.Doer.Email,
Repo: repo.Name,
Year: time.Now().Format("2006"),

View File

@@ -169,8 +169,12 @@ func LicenseCreate(ctx *context.Context) {
func createLicenseFile(ctx *context.Context, repo *repo_model.Repository, licenseType string) error {
// Get license content from templates
ownerName := repo.OwnerDisplayName
if ownerName == "" {
ownerName = repo.OwnerName
}
licenseContent, err := repo_module.GetLicense(licenseType, &repo_module.LicenseValues{
Owner: repo.OwnerName,
Owner: ownerName,
Email: ctx.Doer.Email,
Repo: repo.Name,
Year: time.Now().Format("2006"),

View File

@@ -206,6 +206,7 @@ func handleSettingsPostUpdate(ctx *context.Context) {
repo.Description = form.Description
repo.DisplayTitle = form.DisplayTitle
repo.GroupHeader = form.GroupHeader
repo.OwnerDisplayName = form.OwnerDisplayName
repo.Website = form.Website
repo.IsTemplate = form.Template

View File

@@ -31,11 +31,16 @@ func SocialPreview(ctx *context.Context) {
title = repo.Name
}
repoFullName := repo.FullName()
if repo.OwnerDisplayName != "" {
repoFullName = repo.OwnerDisplayName + "/" + repo.Name
}
data := socialcard.CardData{
Title: title,
Description: repo.Description,
RepoAvatarURL: repo.AvatarLink(ctx),
RepoFullName: repo.FullName(),
RepoFullName: repoFullName,
SolidColor: repo.SocialCardColor,
UnsplashAuthor: repo.SocialCardUnsplashAuthor,
}