diff --git a/models/issues/commit_comment.go b/models/issues/commit_comment.go index 2b4e38a43f..297b97ce6c 100644 --- a/models/issues/commit_comment.go +++ b/models/issues/commit_comment.go @@ -35,22 +35,17 @@ type CommitCommentsForDiff map[string]*FileCommitComments // FindCommitCommentsByCommitSHA returns all comments for a given commit in a repo. func FindCommitCommentsByCommitSHA(ctx context.Context, repoID int64, commitSHA string) ([]*Comment, error) { - var refs []CommitComment - if err := db.GetEngine(ctx). + var commentIDs []int64 + if err := db.GetEngine(ctx).Cols("comment_id").Table("commit_comment"). Where("repo_id = ? AND commit_sha = ?", repoID, commitSHA). - Find(&refs); err != nil { + Find(&commentIDs); err != nil { return nil, err } - if len(refs) == 0 { + if len(commentIDs) == 0 { return nil, nil } - commentIDs := make([]int64, 0, len(refs)) - for _, ref := range refs { - commentIDs = append(commentIDs, ref.CommentID) - } - comments := make([]*Comment, 0, len(commentIDs)) if err := db.GetEngine(ctx). In("id", commentIDs). diff --git a/models/repo/commit_comment.go b/models/repo/commit_comment.go deleted file mode 100644 index 74657a72a0..0000000000 --- a/models/repo/commit_comment.go +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright 2026 The Gitea Authors. All rights reserved. -// SPDX-License-Identifier: MIT - -// This file intentionally left minimal. The CommitComment junction table -// and all query methods now live in models/issues/commit_comment.go -// alongside the Comment model they reference. - -package repo