Skip to content

Commit e3b51e8

Browse files
committed
Fix conversation comment
1 parent d9ef4e4 commit e3b51e8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

models/conversations/comment.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ func CreateComment(ctx context.Context, opts *CreateCommentOptions) (_ *Conversa
243243
Poster: opts.Doer,
244244
Content: opts.Content,
245245
Conversation: opts.Conversation,
246-
ConversationID: opts.ConversationID,
246+
ConversationID: opts.Conversation.ID,
247247
}
248248
if _, err = e.Insert(comment); err != nil {
249249
return nil, err
@@ -253,7 +253,7 @@ func CreateComment(ctx context.Context, opts *CreateCommentOptions) (_ *Conversa
253253
return nil, err
254254
}
255255

256-
if err = updateCommentInfos(ctx, opts, comment); err != nil {
256+
if err = updateCommentInfos(ctx, opts); err != nil {
257257
return nil, err
258258
}
259259

@@ -568,15 +568,15 @@ func InsertConversationComments(ctx context.Context, comments []*ConversationCom
568568
}
569569

570570
for _, conversationID := range conversationIDs {
571-
if _, err := db.Exec(ctx, "UPDATE conversation set num_comments = (SELECT count(*) FROM comment WHERE conversation_id = ? AND `type`=?) WHERE id = ?",
571+
if _, err := db.Exec(ctx, "UPDATE conversation set num_comments = (SELECT count(*) FROM conversation_comment WHERE conversation_id = ? AND `type`=?) WHERE id = ?",
572572
conversationID, CommentTypeComment, conversationID); err != nil {
573573
return err
574574
}
575575
}
576576
return committer.Commit()
577577
}
578578

579-
func updateCommentInfos(ctx context.Context, opts *CreateCommentOptions, comment *ConversationComment) (err error) {
579+
func updateCommentInfos(ctx context.Context, opts *CreateCommentOptions) (err error) {
580580
// Check comment type.
581581
switch opts.Type {
582582
case CommentTypeComment:

0 commit comments

Comments
 (0)