Phase 3: Organization Public Profile Page - Pinned repositories with groups - Public members display with roles - API endpoints for pinned repos and groups Phase 4: Gitea Pages Foundation - Landing page templates (simple, docs, product, portfolio) - Custom domain support with verification - YAML configuration parser (.gitea/landing.yaml) - Repository settings UI for pages Phase 5: Enhanced Wiki System with V2 API - Full CRUD operations via v2 API - Full-text search with WikiIndex table - Link graph visualization - Wiki health metrics (orphaned, dead links, outdated) - Designed for external AI plugin integration - Developer guide for .NET integration 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
78 lines
1.8 KiB
Go
78 lines
1.8 KiB
Go
// Copyright 2026 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package org
|
|
|
|
import (
|
|
"context"
|
|
|
|
"code.gitea.io/gitea/models/organization"
|
|
repo_model "code.gitea.io/gitea/models/repo"
|
|
"code.gitea.io/gitea/modules/optional"
|
|
)
|
|
|
|
// GetOrgPinnedReposWithDetails returns all pinned repos with repo and group details loaded
|
|
func GetOrgPinnedReposWithDetails(ctx context.Context, orgID int64) ([]*organization.OrgPinnedRepo, error) {
|
|
pinnedRepos, err := organization.GetOrgPinnedRepos(ctx, orgID)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
if len(pinnedRepos) == 0 {
|
|
return pinnedRepos, nil
|
|
}
|
|
|
|
// Load repos
|
|
repoIDs := make([]int64, len(pinnedRepos))
|
|
for i, p := range pinnedRepos {
|
|
repoIDs[i] = p.RepoID
|
|
}
|
|
|
|
repos, err := repo_model.GetRepositoriesMapByIDs(ctx, repoIDs)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
// Load groups
|
|
if err := organization.LoadPinnedRepoGroups(ctx, pinnedRepos, orgID); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
// Attach repos
|
|
for _, p := range pinnedRepos {
|
|
p.Repo = repos[p.RepoID]
|
|
}
|
|
|
|
return pinnedRepos, nil
|
|
}
|
|
|
|
// GetOrgOverviewStats returns statistics for the organization overview page
|
|
func GetOrgOverviewStats(ctx context.Context, orgID int64) (*organization.OrgOverviewStats, error) {
|
|
stats := &organization.OrgOverviewStats{}
|
|
|
|
memberCount, teamCount, err := organization.GetOrgMemberAndTeamCounts(ctx, orgID)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
stats.MemberCount = memberCount
|
|
stats.TeamCount = teamCount
|
|
|
|
// Repo counts
|
|
stats.RepoCount, err = repo_model.CountRepositories(ctx, repo_model.CountRepositoryOptions{
|
|
OwnerID: orgID,
|
|
})
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
stats.PublicRepoCount, err = repo_model.CountRepositories(ctx, repo_model.CountRepositoryOptions{
|
|
OwnerID: orgID,
|
|
Private: optional.Some(false),
|
|
})
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return stats, nil
|
|
}
|