Merge pull request '[gitea] week 2024-34 cherry pick (gitea/main -> forgejo)' (#4998) from earl-warren/wcp/2024-34 into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4998 Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
This commit is contained in:
commit
c76a73ad35
20 changed files with 273 additions and 38 deletions
|
@ -144,6 +144,21 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) {
|
|||
pager.AddParam(ctx, "topic", "TopicOnly")
|
||||
pager.AddParam(ctx, "language", "Language")
|
||||
pager.AddParamString(relevantReposOnlyParam, fmt.Sprint(opts.OnlyShowRelevant))
|
||||
if archived.Has() {
|
||||
pager.AddParamString("archived", fmt.Sprint(archived.Value()))
|
||||
}
|
||||
if fork.Has() {
|
||||
pager.AddParamString("fork", fmt.Sprint(fork.Value()))
|
||||
}
|
||||
if mirror.Has() {
|
||||
pager.AddParamString("mirror", fmt.Sprint(mirror.Value()))
|
||||
}
|
||||
if template.Has() {
|
||||
pager.AddParamString("template", fmt.Sprint(template.Value()))
|
||||
}
|
||||
if private.Has() {
|
||||
pager.AddParamString("private", fmt.Sprint(private.Value()))
|
||||
}
|
||||
ctx.Data["Page"] = pager
|
||||
|
||||
ctx.HTML(http.StatusOK, opts.TplName)
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
package org
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"path"
|
||||
"strings"
|
||||
|
@ -154,7 +155,22 @@ func Home(ctx *context.Context) {
|
|||
|
||||
pager := context.NewPagination(int(count), setting.UI.User.RepoPagingNum, page, 5)
|
||||
pager.SetDefaultParams(ctx)
|
||||
pager.AddParam(ctx, "language", "Language")
|
||||
pager.AddParamString("language", language)
|
||||
if archived.Has() {
|
||||
pager.AddParamString("archived", fmt.Sprint(archived.Value()))
|
||||
}
|
||||
if fork.Has() {
|
||||
pager.AddParamString("fork", fmt.Sprint(fork.Value()))
|
||||
}
|
||||
if mirror.Has() {
|
||||
pager.AddParamString("mirror", fmt.Sprint(mirror.Value()))
|
||||
}
|
||||
if template.Has() {
|
||||
pager.AddParamString("template", fmt.Sprint(template.Value()))
|
||||
}
|
||||
if private.Has() {
|
||||
pager.AddParamString("private", fmt.Sprint(private.Value()))
|
||||
}
|
||||
ctx.Data["Page"] = pager
|
||||
|
||||
ctx.Data["ShowMemberAndTeamTab"] = ctx.Org.IsMember || len(members) > 0
|
||||
|
|
|
@ -1524,13 +1524,12 @@ func CompareAndPullRequestPost(ctx *context.Context) {
|
|||
// instead of 500.
|
||||
|
||||
if err := pull_service.NewPullRequest(ctx, repo, pullIssue, labelIDs, attachments, pullRequest, assigneeIDs); err != nil {
|
||||
if errors.Is(err, user_model.ErrBlockedByUser) {
|
||||
switch {
|
||||
case errors.Is(err, user_model.ErrBlockedByUser):
|
||||
ctx.JSONError(ctx.Tr("repo.pulls.blocked_by_user"))
|
||||
return
|
||||
} else if repo_model.IsErrUserDoesNotHaveAccessToRepo(err) {
|
||||
case repo_model.IsErrUserDoesNotHaveAccessToRepo(err):
|
||||
ctx.Error(http.StatusBadRequest, "UserDoesNotHaveAccessToRepo", err.Error())
|
||||
return
|
||||
} else if git.IsErrPushRejected(err) {
|
||||
case git.IsErrPushRejected(err):
|
||||
pushrejErr := err.(*git.ErrPushRejected)
|
||||
message := pushrejErr.Message
|
||||
if len(message) == 0 {
|
||||
|
@ -1547,7 +1546,11 @@ func CompareAndPullRequestPost(ctx *context.Context) {
|
|||
return
|
||||
}
|
||||
ctx.JSONError(flashError)
|
||||
return
|
||||
default:
|
||||
// It's an unexpected error.
|
||||
// If it happens, we should add another case to handle it.
|
||||
log.Error("Unexpected error of NewPullRequest: %T %s", err, err)
|
||||
ctx.ServerError("CompareAndPullRequest", err)
|
||||
}
|
||||
ctx.ServerError("NewPullRequest", err)
|
||||
return
|
||||
|
|
|
@ -95,6 +95,11 @@ func LFSLocks(ctx *context.Context) {
|
|||
ctx.ServerError("LFSLocks", err)
|
||||
return
|
||||
}
|
||||
if err := lfsLocks.LoadAttributes(ctx); err != nil {
|
||||
ctx.ServerError("LFSLocks", err)
|
||||
return
|
||||
}
|
||||
|
||||
ctx.Data["LFSLocks"] = lfsLocks
|
||||
|
||||
if len(lfsLocks) == 0 {
|
||||
|
|
|
@ -240,14 +240,12 @@ func getFileReader(ctx gocontext.Context, repoID int64, blob *git.Blob) ([]byte,
|
|||
}
|
||||
|
||||
meta, err := git_model.GetLFSMetaObjectByOid(ctx, repoID, pointer.Oid)
|
||||
if err != nil && err != git_model.ErrLFSObjectNotExist { // fallback to plain file
|
||||
if err != nil { // fallback to plain file
|
||||
log.Warn("Unable to access LFS pointer %s in repo %d: %v", pointer.Oid, repoID, err)
|
||||
return buf, dataRc, &fileInfo{isTextFile, false, blob.Size(), nil, st}, nil
|
||||
}
|
||||
|
||||
dataRc.Close()
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
|
||||
dataRc, err = lfs.ReadMetaObject(pointer)
|
||||
if err != nil {
|
||||
|
|
|
@ -446,6 +446,21 @@ func NotificationWatching(ctx *context.Context) {
|
|||
// redirect to last page if request page is more than total pages
|
||||
pager := context.NewPagination(total, setting.UI.User.RepoPagingNum, page, 5)
|
||||
pager.SetDefaultParams(ctx)
|
||||
if archived.Has() {
|
||||
pager.AddParamString("archived", fmt.Sprint(archived.Value()))
|
||||
}
|
||||
if fork.Has() {
|
||||
pager.AddParamString("fork", fmt.Sprint(fork.Value()))
|
||||
}
|
||||
if mirror.Has() {
|
||||
pager.AddParamString("mirror", fmt.Sprint(mirror.Value()))
|
||||
}
|
||||
if template.Has() {
|
||||
pager.AddParamString("template", fmt.Sprint(template.Value()))
|
||||
}
|
||||
if private.Has() {
|
||||
pager.AddParamString("private", fmt.Sprint(private.Value()))
|
||||
}
|
||||
ctx.Data["Page"] = pager
|
||||
|
||||
ctx.Data["Status"] = 2
|
||||
|
|
|
@ -335,6 +335,21 @@ func prepareUserProfileTabData(ctx *context.Context, showPrivate bool, profileDb
|
|||
if tab == "activity" {
|
||||
pager.AddParam(ctx, "date", "Date")
|
||||
}
|
||||
if archived.Has() {
|
||||
pager.AddParamString("archived", fmt.Sprint(archived.Value()))
|
||||
}
|
||||
if fork.Has() {
|
||||
pager.AddParamString("fork", fmt.Sprint(fork.Value()))
|
||||
}
|
||||
if mirror.Has() {
|
||||
pager.AddParamString("mirror", fmt.Sprint(mirror.Value()))
|
||||
}
|
||||
if template.Has() {
|
||||
pager.AddParamString("template", fmt.Sprint(template.Value()))
|
||||
}
|
||||
if private.Has() {
|
||||
pager.AddParamString("private", fmt.Sprint(private.Value()))
|
||||
}
|
||||
ctx.Data["Page"] = pager
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue