mirror of
https://github.com/go-gitea/gitea
synced 2025-07-31 22:58:35 +00:00
Replace interface{}
with any
(#25686)
Result of running `perl -p -i -e 's#interface\{\}#any#g' **/*` and `make fmt`.
Basically the same [as golang did](2580d0e08d
).
This commit is contained in:
@@ -162,7 +162,7 @@ func RestoreBranchPost(ctx *context.Context) {
|
||||
}
|
||||
|
||||
func redirect(ctx *context.Context) {
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"redirect": ctx.Repo.RepoLink + "/branches?page=" + url.QueryEscape(ctx.FormString("page")),
|
||||
})
|
||||
}
|
||||
@@ -223,7 +223,7 @@ func CreateBranch(ctx *context.Context) {
|
||||
if len(e.Message) == 0 {
|
||||
ctx.Flash.Error(ctx.Tr("repo.editor.push_rejected_no_message"))
|
||||
} else {
|
||||
flashError, err := ctx.RenderToString(tplAlertDetails, map[string]interface{}{
|
||||
flashError, err := ctx.RenderToString(tplAlertDetails, map[string]any{
|
||||
"Message": ctx.Tr("repo.editor.push_rejected"),
|
||||
"Summary": ctx.Tr("repo.editor.push_rejected_summary"),
|
||||
"Details": utils.SanitizeFlashErrorString(e.Message),
|
||||
|
@@ -344,7 +344,7 @@ func editFilePost(ctx *context.Context, form forms.EditRepoFileForm, isNewFile b
|
||||
if len(errPushRej.Message) == 0 {
|
||||
ctx.RenderWithErr(ctx.Tr("repo.editor.push_rejected_no_message"), tplEditFile, &form)
|
||||
} else {
|
||||
flashError, err := ctx.RenderToString(tplAlertDetails, map[string]interface{}{
|
||||
flashError, err := ctx.RenderToString(tplAlertDetails, map[string]any{
|
||||
"Message": ctx.Tr("repo.editor.push_rejected"),
|
||||
"Summary": ctx.Tr("repo.editor.push_rejected_summary"),
|
||||
"Details": utils.SanitizeFlashErrorString(errPushRej.Message),
|
||||
@@ -356,7 +356,7 @@ func editFilePost(ctx *context.Context, form forms.EditRepoFileForm, isNewFile b
|
||||
ctx.RenderWithErr(flashError, tplEditFile, &form)
|
||||
}
|
||||
} else {
|
||||
flashError, err := ctx.RenderToString(tplAlertDetails, map[string]interface{}{
|
||||
flashError, err := ctx.RenderToString(tplAlertDetails, map[string]any{
|
||||
"Message": ctx.Tr("repo.editor.fail_to_update_file", form.TreePath),
|
||||
"Summary": ctx.Tr("repo.editor.fail_to_update_file_summary"),
|
||||
"Details": utils.SanitizeFlashErrorString(err.Error()),
|
||||
@@ -543,7 +543,7 @@ func DeleteFilePost(ctx *context.Context) {
|
||||
if len(errPushRej.Message) == 0 {
|
||||
ctx.RenderWithErr(ctx.Tr("repo.editor.push_rejected_no_message"), tplDeleteFile, &form)
|
||||
} else {
|
||||
flashError, err := ctx.RenderToString(tplAlertDetails, map[string]interface{}{
|
||||
flashError, err := ctx.RenderToString(tplAlertDetails, map[string]any{
|
||||
"Message": ctx.Tr("repo.editor.push_rejected"),
|
||||
"Summary": ctx.Tr("repo.editor.push_rejected_summary"),
|
||||
"Details": utils.SanitizeFlashErrorString(errPushRej.Message),
|
||||
@@ -743,7 +743,7 @@ func UploadFilePost(ctx *context.Context) {
|
||||
if len(errPushRej.Message) == 0 {
|
||||
ctx.RenderWithErr(ctx.Tr("repo.editor.push_rejected_no_message"), tplUploadFile, &form)
|
||||
} else {
|
||||
flashError, err := ctx.RenderToString(tplAlertDetails, map[string]interface{}{
|
||||
flashError, err := ctx.RenderToString(tplAlertDetails, map[string]any{
|
||||
"Message": ctx.Tr("repo.editor.push_rejected"),
|
||||
"Summary": ctx.Tr("repo.editor.push_rejected_summary"),
|
||||
"Details": utils.SanitizeFlashErrorString(errPushRej.Message),
|
||||
|
@@ -952,7 +952,7 @@ func renderErrorOfTemplates(ctx *context.Context, errs map[string]error) string
|
||||
lines = append(lines, fmt.Sprintf("%s: %v", file, errs[file]))
|
||||
}
|
||||
|
||||
flashError, err := ctx.RenderToString(tplAlertDetails, map[string]interface{}{
|
||||
flashError, err := ctx.RenderToString(tplAlertDetails, map[string]any{
|
||||
"Message": ctx.Tr("repo.issues.choose.ignore_invalid_templates"),
|
||||
"Summary": ctx.Tr("repo.issues.choose.invalid_templates", len(errs)),
|
||||
"Details": utils.SanitizeFlashErrorString(strings.Join(lines, "\n")),
|
||||
@@ -2081,7 +2081,7 @@ func UpdateIssueTitle(ctx *context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"title": issue.Title,
|
||||
})
|
||||
}
|
||||
@@ -2105,7 +2105,7 @@ func UpdateIssueRef(ctx *context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"ref": ref,
|
||||
})
|
||||
}
|
||||
@@ -2146,7 +2146,7 @@ func UpdateIssueContent(ctx *context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"content": content,
|
||||
"attachments": attachmentsHTML(ctx, issue.Attachments, issue.Content),
|
||||
})
|
||||
@@ -2206,7 +2206,7 @@ func UpdateIssueMilestone(ctx *context.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"ok": true,
|
||||
})
|
||||
}
|
||||
@@ -2252,7 +2252,7 @@ func UpdateIssueAssignee(ctx *context.Context) {
|
||||
}
|
||||
}
|
||||
}
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"ok": true,
|
||||
})
|
||||
}
|
||||
@@ -2377,7 +2377,7 @@ func UpdatePullReviewRequest(ctx *context.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"ok": true,
|
||||
})
|
||||
}
|
||||
@@ -2763,7 +2763,7 @@ func UpdateIssueStatus(ctx *context.Context) {
|
||||
if issue.IsClosed != isClosed {
|
||||
if err := issue_service.ChangeStatus(issue, ctx.Doer, "", isClosed); err != nil {
|
||||
if issues_model.IsErrDependenciesLeft(err) {
|
||||
ctx.JSON(http.StatusPreconditionFailed, map[string]interface{}{
|
||||
ctx.JSON(http.StatusPreconditionFailed, map[string]any{
|
||||
"error": ctx.Tr("repo.issues.dependency.issue_batch_close_blocked", issue.Index),
|
||||
})
|
||||
return
|
||||
@@ -2978,7 +2978,7 @@ func UpdateCommentContent(ctx *context.Context) {
|
||||
oldContent := comment.Content
|
||||
comment.Content = ctx.FormString("content")
|
||||
if len(comment.Content) == 0 {
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"content": "",
|
||||
})
|
||||
return
|
||||
@@ -3012,7 +3012,7 @@ func UpdateCommentContent(ctx *context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"content": content,
|
||||
"attachments": attachmentsHTML(ctx, comment.Attachments, comment.Content),
|
||||
})
|
||||
@@ -3122,14 +3122,14 @@ func ChangeIssueReaction(ctx *context.Context) {
|
||||
}
|
||||
|
||||
if len(issue.Reactions) == 0 {
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"empty": true,
|
||||
"html": "",
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
html, err := ctx.RenderToString(tplReactions, map[string]interface{}{
|
||||
html, err := ctx.RenderToString(tplReactions, map[string]any{
|
||||
"ctxData": ctx.Data,
|
||||
"ActionURL": fmt.Sprintf("%s/issues/%d/reactions", ctx.Repo.RepoLink, issue.Index),
|
||||
"Reactions": issue.Reactions.GroupByType(),
|
||||
@@ -3138,7 +3138,7 @@ func ChangeIssueReaction(ctx *context.Context) {
|
||||
ctx.ServerError("ChangeIssueReaction.HTMLString", err)
|
||||
return
|
||||
}
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"html": html,
|
||||
})
|
||||
}
|
||||
@@ -3224,14 +3224,14 @@ func ChangeCommentReaction(ctx *context.Context) {
|
||||
}
|
||||
|
||||
if len(comment.Reactions) == 0 {
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"empty": true,
|
||||
"html": "",
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
html, err := ctx.RenderToString(tplReactions, map[string]interface{}{
|
||||
html, err := ctx.RenderToString(tplReactions, map[string]any{
|
||||
"ctxData": ctx.Data,
|
||||
"ActionURL": fmt.Sprintf("%s/comments/%d/reactions", ctx.Repo.RepoLink, comment.ID),
|
||||
"Reactions": comment.Reactions.GroupByType(),
|
||||
@@ -3240,7 +3240,7 @@ func ChangeCommentReaction(ctx *context.Context) {
|
||||
ctx.ServerError("ChangeCommentReaction.HTMLString", err)
|
||||
return
|
||||
}
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"html": html,
|
||||
})
|
||||
}
|
||||
@@ -3313,7 +3313,7 @@ func GetCommentAttachments(ctx *context.Context) {
|
||||
ctx.JSON(http.StatusOK, attachments)
|
||||
}
|
||||
|
||||
func updateAttachments(ctx *context.Context, item interface{}, files []string) error {
|
||||
func updateAttachments(ctx *context.Context, item any, files []string) error {
|
||||
var attachments []*repo_model.Attachment
|
||||
switch content := item.(type) {
|
||||
case *issues_model.Issue:
|
||||
@@ -3357,7 +3357,7 @@ func updateAttachments(ctx *context.Context, item interface{}, files []string) e
|
||||
}
|
||||
|
||||
func attachmentsHTML(ctx *context.Context, attachments []*repo_model.Attachment, content string) string {
|
||||
attachHTML, err := ctx.RenderToString(tplAttachment, map[string]interface{}{
|
||||
attachHTML, err := ctx.RenderToString(tplAttachment, map[string]any{
|
||||
"ctxData": ctx.Data,
|
||||
"Attachments": attachments,
|
||||
"Content": content,
|
||||
|
@@ -29,8 +29,8 @@ func GetContentHistoryOverview(ctx *context.Context) {
|
||||
}
|
||||
|
||||
editedHistoryCountMap, _ := issues_model.QueryIssueContentHistoryEditedCountMap(ctx, issue.ID)
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
"i18n": map[string]interface{}{
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"i18n": map[string]any{
|
||||
"textEdited": ctx.Tr("repo.issues.content_history.edited"),
|
||||
"textDeleteFromHistory": ctx.Tr("repo.issues.content_history.delete_from_history"),
|
||||
"textDeleteFromHistoryConfirm": ctx.Tr("repo.issues.content_history.delete_from_history_confirm"),
|
||||
@@ -53,7 +53,7 @@ func GetContentHistoryList(ctx *context.Context) {
|
||||
// render history list to HTML for frontend dropdown items: (name, value)
|
||||
// name is HTML of "avatar + userName + userAction + timeSince"
|
||||
// value is historyId
|
||||
var results []map[string]interface{}
|
||||
var results []map[string]any
|
||||
for _, item := range items {
|
||||
var actionText string
|
||||
if item.IsDeleted {
|
||||
@@ -76,13 +76,13 @@ func GetContentHistoryList(ctx *context.Context) {
|
||||
avatarHTML := string(templates.AvatarHTML(src, 28, class, username))
|
||||
timeSinceText := string(timeutil.TimeSinceUnix(item.EditedUnix, ctx.Locale))
|
||||
|
||||
results = append(results, map[string]interface{}{
|
||||
results = append(results, map[string]any{
|
||||
"name": avatarHTML + "<strong>" + name + "</strong> " + actionText + " " + timeSinceText,
|
||||
"value": item.HistoryID,
|
||||
})
|
||||
}
|
||||
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"results": results,
|
||||
})
|
||||
}
|
||||
@@ -120,7 +120,7 @@ func GetContentHistoryDetail(ctx *context.Context) {
|
||||
historyID := ctx.FormInt64("history_id")
|
||||
history, prevHistory, err := issues_model.GetIssueContentHistoryAndPrev(ctx, historyID)
|
||||
if err != nil {
|
||||
ctx.JSON(http.StatusNotFound, map[string]interface{}{
|
||||
ctx.JSON(http.StatusNotFound, map[string]any{
|
||||
"message": "Can not find the content history",
|
||||
})
|
||||
return
|
||||
@@ -168,7 +168,7 @@ func GetContentHistoryDetail(ctx *context.Context) {
|
||||
}
|
||||
diffHTMLBuf.WriteString("</pre>")
|
||||
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"canSoftDelete": canSoftDeleteContentHistory(ctx, issue, comment, history),
|
||||
"historyId": historyID,
|
||||
"prevHistoryId": prevHistoryID,
|
||||
@@ -202,7 +202,7 @@ func SoftDeleteContentHistory(ctx *context.Context) {
|
||||
|
||||
canSoftDelete := canSoftDeleteContentHistory(ctx, issue, comment, history)
|
||||
if !canSoftDelete {
|
||||
ctx.JSON(http.StatusForbidden, map[string]interface{}{
|
||||
ctx.JSON(http.StatusForbidden, map[string]any{
|
||||
"message": "Can not delete the content history",
|
||||
})
|
||||
return
|
||||
@@ -210,7 +210,7 @@ func SoftDeleteContentHistory(ctx *context.Context) {
|
||||
|
||||
err = issues_model.SoftDeleteIssueContentHistory(ctx, historyID)
|
||||
log.Debug("soft delete issue content history. issue=%d, comment=%d, history=%d", issue.ID, commentID, historyID)
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"ok": err == nil,
|
||||
})
|
||||
}
|
||||
|
@@ -157,7 +157,7 @@ func DeleteLabel(ctx *context.Context) {
|
||||
ctx.Flash.Success(ctx.Tr("repo.issues.label_deletion_success"))
|
||||
}
|
||||
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"redirect": ctx.Repo.RepoLink + "/labels",
|
||||
})
|
||||
}
|
||||
@@ -226,7 +226,7 @@ func UpdateIssueLabel(ctx *context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"ok": true,
|
||||
})
|
||||
}
|
||||
|
@@ -256,7 +256,7 @@ func DeleteMilestone(ctx *context.Context) {
|
||||
ctx.Flash.Success(ctx.Tr("repo.milestones.deletion_success"))
|
||||
}
|
||||
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"redirect": ctx.Repo.RepoLink + "/milestones",
|
||||
})
|
||||
}
|
||||
|
@@ -203,7 +203,7 @@ func DeleteProject(ctx *context.Context) {
|
||||
ctx.Flash.Success(ctx.Tr("repo.projects.deletion_success"))
|
||||
}
|
||||
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"redirect": ctx.Repo.RepoLink + "/projects",
|
||||
})
|
||||
}
|
||||
@@ -398,7 +398,7 @@ func UpdateIssueProject(ctx *context.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"ok": true,
|
||||
})
|
||||
}
|
||||
@@ -453,7 +453,7 @@ func DeleteProjectBoard(ctx *context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"ok": true,
|
||||
})
|
||||
}
|
||||
@@ -488,7 +488,7 @@ func AddBoardToProjectPost(ctx *context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"ok": true,
|
||||
})
|
||||
}
|
||||
@@ -562,7 +562,7 @@ func EditProjectBoard(ctx *context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"ok": true,
|
||||
})
|
||||
}
|
||||
@@ -579,7 +579,7 @@ func SetDefaultProjectBoard(ctx *context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"ok": true,
|
||||
})
|
||||
}
|
||||
@@ -596,7 +596,7 @@ func UnSetDefaultProjectBoard(ctx *context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"ok": true,
|
||||
})
|
||||
}
|
||||
@@ -700,7 +700,7 @@ func MoveIssues(ctx *context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"ok": true,
|
||||
})
|
||||
}
|
||||
|
@@ -802,7 +802,7 @@ func ViewPullFiles(ctx *context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
ctx.PageData["prReview"] = map[string]interface{}{
|
||||
ctx.PageData["prReview"] = map[string]any{
|
||||
"numberOfFiles": diff.NumFiles,
|
||||
"numberOfViewedFiles": diff.NumViewedFiles,
|
||||
}
|
||||
@@ -937,7 +937,7 @@ func UpdatePullRequest(ctx *context.Context) {
|
||||
if err = pull_service.Update(ctx, issue.PullRequest, ctx.Doer, message, rebase); err != nil {
|
||||
if models.IsErrMergeConflicts(err) {
|
||||
conflictError := err.(models.ErrMergeConflicts)
|
||||
flashError, err := ctx.RenderToString(tplAlertDetails, map[string]interface{}{
|
||||
flashError, err := ctx.RenderToString(tplAlertDetails, map[string]any{
|
||||
"Message": ctx.Tr("repo.pulls.merge_conflict"),
|
||||
"Summary": ctx.Tr("repo.pulls.merge_conflict_summary"),
|
||||
"Details": utils.SanitizeFlashErrorString(conflictError.StdErr) + "<br>" + utils.SanitizeFlashErrorString(conflictError.StdOut),
|
||||
@@ -951,7 +951,7 @@ func UpdatePullRequest(ctx *context.Context) {
|
||||
return
|
||||
} else if models.IsErrRebaseConflicts(err) {
|
||||
conflictError := err.(models.ErrRebaseConflicts)
|
||||
flashError, err := ctx.RenderToString(tplAlertDetails, map[string]interface{}{
|
||||
flashError, err := ctx.RenderToString(tplAlertDetails, map[string]any{
|
||||
"Message": ctx.Tr("repo.pulls.rebase_conflict", utils.SanitizeFlashErrorString(conflictError.CommitSHA)),
|
||||
"Summary": ctx.Tr("repo.pulls.rebase_conflict_summary"),
|
||||
"Details": utils.SanitizeFlashErrorString(conflictError.StdErr) + "<br>" + utils.SanitizeFlashErrorString(conflictError.StdOut),
|
||||
@@ -1086,7 +1086,7 @@ func MergePullRequest(ctx *context.Context) {
|
||||
ctx.Redirect(issue.Link())
|
||||
} else if models.IsErrMergeConflicts(err) {
|
||||
conflictError := err.(models.ErrMergeConflicts)
|
||||
flashError, err := ctx.RenderToString(tplAlertDetails, map[string]interface{}{
|
||||
flashError, err := ctx.RenderToString(tplAlertDetails, map[string]any{
|
||||
"Message": ctx.Tr("repo.editor.merge_conflict"),
|
||||
"Summary": ctx.Tr("repo.editor.merge_conflict_summary"),
|
||||
"Details": utils.SanitizeFlashErrorString(conflictError.StdErr) + "<br>" + utils.SanitizeFlashErrorString(conflictError.StdOut),
|
||||
@@ -1099,7 +1099,7 @@ func MergePullRequest(ctx *context.Context) {
|
||||
ctx.Redirect(issue.Link())
|
||||
} else if models.IsErrRebaseConflicts(err) {
|
||||
conflictError := err.(models.ErrRebaseConflicts)
|
||||
flashError, err := ctx.RenderToString(tplAlertDetails, map[string]interface{}{
|
||||
flashError, err := ctx.RenderToString(tplAlertDetails, map[string]any{
|
||||
"Message": ctx.Tr("repo.pulls.rebase_conflict", utils.SanitizeFlashErrorString(conflictError.CommitSHA)),
|
||||
"Summary": ctx.Tr("repo.pulls.rebase_conflict_summary"),
|
||||
"Details": utils.SanitizeFlashErrorString(conflictError.StdErr) + "<br>" + utils.SanitizeFlashErrorString(conflictError.StdOut),
|
||||
@@ -1129,7 +1129,7 @@ func MergePullRequest(ctx *context.Context) {
|
||||
if len(message) == 0 {
|
||||
ctx.Flash.Error(ctx.Tr("repo.pulls.push_rejected_no_message"))
|
||||
} else {
|
||||
flashError, err := ctx.RenderToString(tplAlertDetails, map[string]interface{}{
|
||||
flashError, err := ctx.RenderToString(tplAlertDetails, map[string]any{
|
||||
"Message": ctx.Tr("repo.pulls.push_rejected"),
|
||||
"Summary": ctx.Tr("repo.pulls.push_rejected_summary"),
|
||||
"Details": utils.SanitizeFlashErrorString(pushrejErr.Message),
|
||||
@@ -1302,7 +1302,7 @@ func CompareAndPullRequestPost(ctx *context.Context) {
|
||||
ctx.JSONError(ctx.Tr("repo.pulls.push_rejected_no_message"))
|
||||
return
|
||||
}
|
||||
flashError, err := ctx.RenderToString(tplAlertDetails, map[string]interface{}{
|
||||
flashError, err := ctx.RenderToString(tplAlertDetails, map[string]any{
|
||||
"Message": ctx.Tr("repo.pulls.push_rejected"),
|
||||
"Summary": ctx.Tr("repo.pulls.push_rejected_summary"),
|
||||
"Details": utils.SanitizeFlashErrorString(pushrejErr.Message),
|
||||
@@ -1407,7 +1407,7 @@ func CleanUpPullRequest(ctx *context.Context) {
|
||||
}
|
||||
|
||||
defer func() {
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"redirect": issue.Link(),
|
||||
})
|
||||
}()
|
||||
@@ -1519,7 +1519,7 @@ func UpdatePullRequestTarget(ctx *context.Context) {
|
||||
errorMessage := ctx.Tr("repo.pulls.has_pull_request", html.EscapeString(ctx.Repo.RepoLink+"/pulls/"+strconv.FormatInt(err.IssueID, 10)), html.EscapeString(RepoRelPath), err.IssueID) // FIXME: Creates url inside locale string
|
||||
|
||||
ctx.Flash.Error(errorMessage)
|
||||
ctx.JSON(http.StatusConflict, map[string]interface{}{
|
||||
ctx.JSON(http.StatusConflict, map[string]any{
|
||||
"error": err.Error(),
|
||||
"user_error": errorMessage,
|
||||
})
|
||||
@@ -1527,7 +1527,7 @@ func UpdatePullRequestTarget(ctx *context.Context) {
|
||||
errorMessage := ctx.Tr("repo.pulls.is_closed")
|
||||
|
||||
ctx.Flash.Error(errorMessage)
|
||||
ctx.JSON(http.StatusConflict, map[string]interface{}{
|
||||
ctx.JSON(http.StatusConflict, map[string]any{
|
||||
"error": err.Error(),
|
||||
"user_error": errorMessage,
|
||||
})
|
||||
@@ -1535,7 +1535,7 @@ func UpdatePullRequestTarget(ctx *context.Context) {
|
||||
errorMessage := ctx.Tr("repo.pulls.has_merged")
|
||||
|
||||
ctx.Flash.Error(errorMessage)
|
||||
ctx.JSON(http.StatusConflict, map[string]interface{}{
|
||||
ctx.JSON(http.StatusConflict, map[string]any{
|
||||
"error": err.Error(),
|
||||
"user_error": errorMessage,
|
||||
})
|
||||
@@ -1543,7 +1543,7 @@ func UpdatePullRequestTarget(ctx *context.Context) {
|
||||
errorMessage := ctx.Tr("repo.pulls.nothing_to_compare")
|
||||
|
||||
ctx.Flash.Error(errorMessage)
|
||||
ctx.JSON(http.StatusBadRequest, map[string]interface{}{
|
||||
ctx.JSON(http.StatusBadRequest, map[string]any{
|
||||
"error": err.Error(),
|
||||
"user_error": errorMessage,
|
||||
})
|
||||
@@ -1554,7 +1554,7 @@ func UpdatePullRequestTarget(ctx *context.Context) {
|
||||
}
|
||||
notification.NotifyPullRequestChangeTargetBranch(ctx, ctx.Doer, pr, targetBranch)
|
||||
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"base_branch": pr.BaseBranch,
|
||||
})
|
||||
}
|
||||
@@ -1582,7 +1582,7 @@ func SetAllowEdits(ctx *context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"allow_maintainer_edit": pr.AllowMaintainerEdit,
|
||||
})
|
||||
}
|
||||
|
@@ -153,7 +153,7 @@ func UpdateResolveConversation(ctx *context.Context) {
|
||||
renderConversation(ctx, comment)
|
||||
return
|
||||
}
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"ok": true,
|
||||
})
|
||||
}
|
||||
|
@@ -607,13 +607,13 @@ func deleteReleaseOrTag(ctx *context.Context, isDelTag bool) {
|
||||
}
|
||||
|
||||
if isDelTag {
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"redirect": ctx.Repo.RepoLink + "/tags",
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"redirect": ctx.Repo.RepoLink + "/releases",
|
||||
})
|
||||
}
|
||||
|
@@ -181,7 +181,7 @@ func Create(ctx *context.Context) {
|
||||
ctx.HTML(http.StatusOK, tplCreate)
|
||||
}
|
||||
|
||||
func handleCreateError(ctx *context.Context, owner *user_model.User, err error, name string, tpl base.TplName, form interface{}) {
|
||||
func handleCreateError(ctx *context.Context, owner *user_model.User, err error, name string, tpl base.TplName, form any) {
|
||||
switch {
|
||||
case repo_model.IsErrReachLimitOfRepo(err):
|
||||
maxCreationLimit := owner.MaxCreationLimit()
|
||||
@@ -482,7 +482,7 @@ func InitiateDownload(ctx *context.Context) {
|
||||
completed = true
|
||||
}
|
||||
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"complete": completed,
|
||||
})
|
||||
}
|
||||
|
@@ -133,7 +133,7 @@ func DeleteCollaboration(ctx *context.Context) {
|
||||
ctx.Flash.Success(ctx.Tr("repo.settings.remove_collaborator_success"))
|
||||
}
|
||||
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"redirect": ctx.Repo.RepoLink + "/settings/collaboration",
|
||||
})
|
||||
}
|
||||
@@ -204,7 +204,7 @@ func DeleteTeam(ctx *context.Context) {
|
||||
}
|
||||
|
||||
ctx.Flash.Success(ctx.Tr("repo.settings.remove_team_success"))
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"redirect": ctx.Repo.RepoLink + "/settings/collaboration",
|
||||
})
|
||||
}
|
||||
|
@@ -105,7 +105,7 @@ func DeleteDeployKey(ctx *context.Context) {
|
||||
ctx.Flash.Success(ctx.Tr("repo.settings.deploy_key_deletion_success"))
|
||||
}
|
||||
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"redirect": ctx.Repo.RepoLink + "/settings/keys",
|
||||
})
|
||||
}
|
||||
|
@@ -307,7 +307,7 @@ func DeleteProtectedBranchRulePost(ctx *context.Context) {
|
||||
ruleID := ctx.ParamsInt64("id")
|
||||
if ruleID <= 0 {
|
||||
ctx.Flash.Error(ctx.Tr("repo.settings.remove_protected_branch_failed", fmt.Sprintf("%d", ruleID)))
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"redirect": fmt.Sprintf("%s/settings/branches", ctx.Repo.RepoLink),
|
||||
})
|
||||
return
|
||||
@@ -316,7 +316,7 @@ func DeleteProtectedBranchRulePost(ctx *context.Context) {
|
||||
rule, err := git_model.GetProtectedBranchRuleByID(ctx, ctx.Repo.Repository.ID, ruleID)
|
||||
if err != nil {
|
||||
ctx.Flash.Error(ctx.Tr("repo.settings.remove_protected_branch_failed", fmt.Sprintf("%d", ruleID)))
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"redirect": fmt.Sprintf("%s/settings/branches", ctx.Repo.RepoLink),
|
||||
})
|
||||
return
|
||||
@@ -324,7 +324,7 @@ func DeleteProtectedBranchRulePost(ctx *context.Context) {
|
||||
|
||||
if rule == nil {
|
||||
ctx.Flash.Error(ctx.Tr("repo.settings.remove_protected_branch_failed", fmt.Sprintf("%d", ruleID)))
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"redirect": fmt.Sprintf("%s/settings/branches", ctx.Repo.RepoLink),
|
||||
})
|
||||
return
|
||||
@@ -332,14 +332,14 @@ func DeleteProtectedBranchRulePost(ctx *context.Context) {
|
||||
|
||||
if err := git_model.DeleteProtectedBranch(ctx, ctx.Repo.Repository.ID, ruleID); err != nil {
|
||||
ctx.Flash.Error(ctx.Tr("repo.settings.remove_protected_branch_failed", rule.RuleName))
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"redirect": fmt.Sprintf("%s/settings/branches", ctx.Repo.RepoLink),
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
ctx.Flash.Success(ctx.Tr("repo.settings.remove_protected_branch_success", rule.RuleName))
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"redirect": fmt.Sprintf("%s/settings/branches", ctx.Repo.RepoLink),
|
||||
})
|
||||
}
|
||||
|
@@ -145,7 +145,7 @@ func WebhooksNew(ctx *context.Context) {
|
||||
return
|
||||
}
|
||||
if hookType == "discord" {
|
||||
ctx.Data["DiscordHook"] = map[string]interface{}{
|
||||
ctx.Data["DiscordHook"] = map[string]any{
|
||||
"Username": "Gitea",
|
||||
}
|
||||
}
|
||||
@@ -196,7 +196,7 @@ type webhookParams struct {
|
||||
Secret string
|
||||
HTTPMethod string
|
||||
WebhookForm forms.WebhookForm
|
||||
Meta interface{}
|
||||
Meta any
|
||||
}
|
||||
|
||||
func createWebhook(ctx *context.Context, params webhookParams) {
|
||||
@@ -729,7 +729,7 @@ func DeleteWebhook(ctx *context.Context) {
|
||||
ctx.Flash.Success(ctx.Tr("repo.settings.webhook_deletion_success"))
|
||||
}
|
||||
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"redirect": ctx.Repo.RepoLink + "/settings/hooks",
|
||||
})
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@ import (
|
||||
// TopicsPost response for creating repository
|
||||
func TopicsPost(ctx *context.Context) {
|
||||
if ctx.Doer == nil {
|
||||
ctx.JSON(http.StatusForbidden, map[string]interface{}{
|
||||
ctx.JSON(http.StatusForbidden, map[string]any{
|
||||
"message": "Only owners could change the topics.",
|
||||
})
|
||||
return
|
||||
@@ -30,7 +30,7 @@ func TopicsPost(ctx *context.Context) {
|
||||
validTopics, invalidTopics := repo_model.SanitizeAndValidateTopics(topics)
|
||||
|
||||
if len(validTopics) > 25 {
|
||||
ctx.JSON(http.StatusUnprocessableEntity, map[string]interface{}{
|
||||
ctx.JSON(http.StatusUnprocessableEntity, map[string]any{
|
||||
"invalidTopics": nil,
|
||||
"message": ctx.Tr("repo.topic.count_prompt"),
|
||||
})
|
||||
@@ -38,7 +38,7 @@ func TopicsPost(ctx *context.Context) {
|
||||
}
|
||||
|
||||
if len(invalidTopics) > 0 {
|
||||
ctx.JSON(http.StatusUnprocessableEntity, map[string]interface{}{
|
||||
ctx.JSON(http.StatusUnprocessableEntity, map[string]any{
|
||||
"invalidTopics": invalidTopics,
|
||||
"message": ctx.Tr("repo.topic.format_prompt"),
|
||||
})
|
||||
@@ -48,13 +48,13 @@ func TopicsPost(ctx *context.Context) {
|
||||
err := repo_model.SaveTopics(ctx.Repo.Repository.ID, validTopics...)
|
||||
if err != nil {
|
||||
log.Error("SaveTopics failed: %v", err)
|
||||
ctx.JSON(http.StatusInternalServerError, map[string]interface{}{
|
||||
ctx.JSON(http.StatusInternalServerError, map[string]any{
|
||||
"message": "Save topics failed.",
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"status": "ok",
|
||||
})
|
||||
}
|
||||
|
@@ -791,7 +791,7 @@ func DeleteWikiPagePost(ctx *context.Context) {
|
||||
|
||||
notification.NotifyDeleteWikiPage(ctx, ctx.Doer, ctx.Repo.Repository, string(wikiName))
|
||||
|
||||
ctx.JSON(http.StatusOK, map[string]interface{}{
|
||||
ctx.JSON(http.StatusOK, map[string]any{
|
||||
"redirect": ctx.Repo.RepoLink + "/wiki/",
|
||||
})
|
||||
}
|
||||
|
@@ -62,7 +62,7 @@ func assertWikiNotExists(t *testing.T, repo *repo_model.Repository, wikiName wik
|
||||
assert.Nil(t, wikiEntry(t, repo, wikiName))
|
||||
}
|
||||
|
||||
func assertPagesMetas(t *testing.T, expectedNames []string, metas interface{}) {
|
||||
func assertPagesMetas(t *testing.T, expectedNames []string, metas any) {
|
||||
pageMetas, ok := metas.([]PageMeta)
|
||||
if !assert.True(t, ok) {
|
||||
return
|
||||
|
Reference in New Issue
Block a user