refactor: clean up pull request comment related code and template dict (#39789)

1. drop comment.commit_id
2. refactor templates, remove `dict "." .` from templates
This commit is contained in:
wxiaoguang authored and GitHub committed 2026-10-15 23:09:41 +00:00
1 parent 1c117a9352
commit 222136ee71
28 files changed
+321 -266

No files matched your search

+1
View File
@@ -437,6 +437,7 @@ func prepareMigrationTasks() []*migration {
newMigration(358, "Track previous remember-me token hashes", v29.AddPreviousAuthTokenHash),
newMigration(359, "Add stage and number columns to action_task_step", v29.AddStageAndNumberToActionTaskStep),
newMigration(360, "Move branch protection settings to JSON", v29.MoveBranchProtectionConfigToJSON),
newMigration(361, "Drop legacy commit_id column from comment", v29.DropCommentCommitID),
}
return preparedMigrations
}
+21
View File
@@ -0,0 +1,21 @@
// Copyright 2026 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package v29
import (
"context"
"gitea.dev/modelmigration/base"
)
func DropCommentCommitID(ctx context.Context, x base.EngineMigration) error {
exists, err := x.Dialect().IsColumnExist(x.DB(), ctx, "comment", "commit_id")
if err != nil || !exists {
return err
}
return base.EngineTransaction(x, func(sess base.Session) error {
return base.DropTableColumns(sess, "comment", "commit_id")
})
}