Skip to content

Commit 0be30d9

Browse files
committed
Fix bug
1 parent b91eefa commit 0be30d9

File tree

5 files changed

+12
-10
lines changed

5 files changed

+12
-10
lines changed

models/issues/comment.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,8 @@ func (r RoleInRepo) LocaleHelper(lang translation.Locale) string {
221221
// CommentMetaData stores metadata for a comment, these data will not be changed once inserted into database
222222
type CommentMetaData struct {
223223
ProjectColumnID int64 `json:"project_column_id"`
224-
ProjectColumnTitle string `json:"project_column_name"`
225-
ProjectTitle string `json:"project_name"`
224+
ProjectColumnTitle string `json:"project_column_title"`
225+
ProjectTitle string `json:"project_title"`
226226
}
227227

228228
// Comment represents a comment in commit and issue page.
@@ -806,11 +806,11 @@ func CreateComment(ctx context.Context, opts *CreateCommentOptions) (_ *Comment,
806806
}
807807

808808
var commentMetaData *CommentMetaData
809-
if opts.ProjectColumnID > 0 {
809+
if opts.ProjectColumnTitle != "" {
810810
commentMetaData = &CommentMetaData{
811811
ProjectColumnID: opts.ProjectColumnID,
812812
ProjectColumnTitle: opts.ProjectColumnTitle,
813-
ProjectTitle: opts.ProjectColumnTitle,
813+
ProjectTitle: opts.ProjectTitle,
814814
}
815815
}
816816

models/migrations/v1_22/v287.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 The Gitea Authors. All rights reserved.
1+
// Copyright 2024 The Gitea Authors. All rights reserved.
22
// SPDX-License-Identifier: MIT
33
package v1_22 //nolint
44

routers/web/org/projects.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -708,6 +708,7 @@ func MoveIssues(ctx *context.Context) {
708708
form := &movedIssuesForm{}
709709
if err = json.NewDecoder(ctx.Req.Body).Decode(&form); err != nil {
710710
ctx.ServerError("DecodeMovedIssuesForm", err)
711+
return
711712
}
712713

713714
issueIDs := make([]int64, 0, len(form.Issues))

services/projects/issue.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@ import (
1616
// MoveIssuesOnProjectBoard moves or keeps issues in a column and sorts them inside that column
1717
func MoveIssuesOnProjectBoard(ctx context.Context, doer *user_model.User, column *project_model.Board, sortedIssueIDs map[int64]int64) error {
1818
return db.WithTx(ctx, func(ctx context.Context) error {
19-
sess := db.GetEngine(ctx)
20-
2119
issueIDs := make([]int64, 0, len(sortedIssueIDs))
2220
for _, issueID := range sortedIssueIDs {
2321
issueIDs = append(issueIDs, issueID)
2422
}
25-
count, err := sess.Table(new(project_model.ProjectIssue)).Where("project_id=?", column.ProjectID).In("issue_id", issueIDs).Count()
23+
count, err := db.GetEngine(ctx).
24+
Where("project_id=?", column.ProjectID).
25+
In("issue_id", issueIDs).
26+
Count(new(project_model.ProjectIssue))
2627
if err != nil {
2728
return err
2829
}
@@ -44,7 +45,7 @@ func MoveIssuesOnProjectBoard(ctx context.Context, doer *user_model.User, column
4445
}
4546

4647
for sorting, issueID := range sortedIssueIDs {
47-
_, err = sess.Exec("UPDATE `project_issue` SET project_board_id=?, sorting=? WHERE issue_id=?", column.ID, sorting, issueID)
48+
_, err = db.Exec(ctx, "UPDATE `project_issue` SET project_board_id=?, sorting=? WHERE issue_id=?", column.ID, sorting, issueID)
4849
if err != nil {
4950
return err
5051
}

templates/repo/issue/view_content/comments.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@
619619
{{template "shared/user/avatarlink" dict "user" .Poster}}
620620
<span class="text grey muted-links">
621621
{{template "shared/user/authorlink" .Poster}}
622-
{{$newProjectDisplayHtml := "Unknown Project"}}
622+
{{$newProjectDisplayHtml := .CommentMetaData.ProjectTitle|Safe}}
623623
{{if .Project}}
624624
{{$trKey := printf "projects.type-%d.display_name" .Project.Type}}
625625
{{$newProjectDisplayHtml = printf `%s <a href="%s"><span data-tooltip-content="%s">%s</span></a>` (svg .Project.IconName) (.Project.Link ctx) (ctx.Locale.Tr $trKey | Escape) (.Project.Title | Escape)}}

0 commit comments

Comments
 (0)