RemoveComment delete comment
(ctx context.Context, req *schema.RemoveCommentReq)
| 277 | |
| 278 | // RemoveComment delete comment |
| 279 | func (cs *CommentService) RemoveComment(ctx context.Context, req *schema.RemoveCommentReq) (err error) { |
| 280 | commentInfo, exist, err := cs.commentCommonRepo.GetComment(ctx, req.CommentID) |
| 281 | if err != nil { |
| 282 | return err |
| 283 | } |
| 284 | if !exist { |
| 285 | return nil |
| 286 | } |
| 287 | err = cs.commentRepo.RemoveComment(ctx, req.CommentID) |
| 288 | if err != nil { |
| 289 | return err |
| 290 | } |
| 291 | cs.eventQueueService.Send(ctx, schema.NewEvent(constant.EventCommentDelete, req.UserID). |
| 292 | TID(req.CommentID).CID(req.CommentID, req.UserID)) |
| 293 | if commentInfo.ObjectID == commentInfo.QuestionID { |
| 294 | cs.vectorSyncService.Send(ctx, &vector_sync.Task{Action: vector_sync.ActionUpsert, ObjectType: vector_sync.ObjectTypeQuestion, ObjectID: commentInfo.QuestionID}) |
| 295 | } else { |
| 296 | cs.vectorSyncService.Send(ctx, &vector_sync.Task{Action: vector_sync.ActionUpsert, ObjectType: vector_sync.ObjectTypeAnswer, ObjectID: commentInfo.ObjectID}) |
| 297 | cs.vectorSyncService.Send(ctx, &vector_sync.Task{Action: vector_sync.ActionUpsert, ObjectType: vector_sync.ObjectTypeQuestion, ObjectID: commentInfo.QuestionID}) |
| 298 | } |
| 299 | return nil |
| 300 | } |
| 301 | |
| 302 | // UpdateComment update comment |
| 303 | func (cs *CommentService) UpdateComment(ctx context.Context, req *schema.UpdateCommentReq) ( |
nothing calls this directly
no test coverage detected