feat(lored,user): "pinned" repositories feature on user profile overview

This commit is contained in:
Guz
2025-09-30 21:35:12 -03:00
parent ca2a695a64
commit 6b8ecf8381
5 changed files with 169 additions and 1 deletions

View File

@@ -229,6 +229,31 @@ func prepareUserProfileTabData(ctx *context.Context, profileDbRepo *repo_model.R
}
}
// HACK(contact@guz.one): "Pinned" repositories feature.
//
// Pinned user repositories is based with whether or not the owner starred their
// own repository. This method was choose so we don't have any incompatibility
// with upstream's database, since making something similar with GitHub's pinned
// repositories feature would need a new column or table to store said information.
//
// Maybe we could in the future properly implement this feature, if upstream wants
// this feature also, if not, it is not worth it.
repos, count, err = repo_model.SearchRepository(ctx, repo_model.SearchRepoOptions{
ListOptions: db.ListOptions{
PageSize: 6,
Page: 0,
},
Actor: ctx.Doer,
OwnerID: ctx.ContextUser.ID,
OrderBy: db.SearchOrderBy(fmt.Sprintf("%s, %s", db.SearchOrderByStarsReverse, db.SearchOrderByRecentUpdated)),
Private: ctx.IsSigned,
StarredByID: ctx.ContextUser.ID,
})
if err != nil {
ctx.ServerError("SearchRepository", err)
return
}
// prepare heatmap data
if setting.Service.EnableUserHeatmap {
data, err := activities_model.GetUserHeatmapDataByUser(ctx, ctx.ContextUser, ctx.Doer)