mirror of https://gitee.com/answerdev/answer.git
fix(answer): The author can view the deleted answer.
This commit is contained in:
parent
f9798534c9
commit
ba8e173658
|
@ -207,7 +207,7 @@ func (ar *answerRepo) SearchList(ctx context.Context, search *entity.AnswerSearc
|
|||
session = session.OrderBy("adopted desc,vote_count desc,created_at asc")
|
||||
}
|
||||
if !search.IncludeDeleted {
|
||||
session = session.And("status = ? OR user_id = ?", entity.AnswerStatusAvailable, search.UserID)
|
||||
session = session.And("status = ? OR user_id = ?", entity.AnswerStatusAvailable, search.LoginUserID)
|
||||
}
|
||||
|
||||
session = session.Limit(search.PageSize, offset)
|
||||
|
|
|
@ -479,6 +479,7 @@ func (as *AnswerService) SearchList(ctx context.Context, req *schema.AnswerListR
|
|||
dbSearch.PageSize = req.PageSize
|
||||
dbSearch.Order = req.Order
|
||||
dbSearch.IncludeDeleted = req.CanDelete
|
||||
dbSearch.LoginUserID = req.UserID
|
||||
answerOriginalList, count, err := as.answerRepo.SearchList(ctx, &dbSearch)
|
||||
if err != nil {
|
||||
return list, count, err
|
||||
|
|
Loading…
Reference in New Issue