@@ -189,15 +189,29 @@ func SoftDeleteContentHistory(ctx *context.Context) {
189
189
var comment * issues_model.Comment
190
190
var history * issues_model.ContentHistory
191
191
var err error
192
+
193
+ if history , err = issues_model .GetIssueContentHistoryByID (ctx , historyID ); err != nil {
194
+ log .Error ("can not get issue content history %v. err=%v" , historyID , err )
195
+ return
196
+ }
197
+ if history .IssueID != issue .ID {
198
+ ctx .NotFound ("CompareRepoID" , issues_model.ErrCommentNotExist {})
199
+ return
200
+ }
192
201
if commentID != 0 {
202
+ if history .CommentID != commentID {
203
+ ctx .NotFound ("CompareCommentID" , issues_model.ErrCommentNotExist {})
204
+ return
205
+ }
206
+
193
207
if comment , err = issues_model .GetCommentByID (ctx , commentID ); err != nil {
194
208
log .Error ("can not get comment for issue content history %v. err=%v" , historyID , err )
195
209
return
196
210
}
197
- }
198
- if history , err = issues_model . GetIssueContentHistoryByID ( ctx , historyID ); err != nil {
199
- log . Error ( "can not get issue content history %v. err=%v" , historyID , err )
200
- return
211
+ if comment . IssueID != issue . ID {
212
+ ctx . NotFound ( "CompareIssueID" , issues_model. ErrCommentNotExist {})
213
+ return
214
+ }
201
215
}
202
216
203
217
canSoftDelete := canSoftDeleteContentHistory (ctx , issue , comment , history )
0 commit comments