aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web/repo/issue_content_history.go
diff options
context:
space:
mode:
authorsilverwind <me@silverwind.io>2023-07-05 05:41:32 +0200
committerGitHub <noreply@github.com>2023-07-04 23:41:32 -0400
commit24e64fe37225a315c74c00d1f5e4d024168feea6 (patch)
treec89664dca5a884d5fc0a322815ce3bc20247cf84 /routers/web/repo/issue_content_history.go
parent4e310133f95ba8581c121a32596807721bdd6af9 (diff)
downloadgitea-24e64fe37225a315c74c00d1f5e4d024168feea6.tar.gz
gitea-24e64fe37225a315c74c00d1f5e4d024168feea6.zip
Replace `interface{}` with `any` (#25686) (#25687)
Same perl replacement as https://github.com/go-gitea/gitea/pull/25686 but for 1.20 to ease future backporting.
Diffstat (limited to 'routers/web/repo/issue_content_history.go')
-rw-r--r--routers/web/repo/issue_content_history.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/routers/web/repo/issue_content_history.go b/routers/web/repo/issue_content_history.go
index 7e5295e757..46a320a8cc 100644
--- a/routers/web/repo/issue_content_history.go
+++ b/routers/web/repo/issue_content_history.go
@@ -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,
})
}