expire related comments after highlight comment

pull/393/head
Michael Li 9 months ago
parent 405aff2b01
commit e2f34633cf
No known key found for this signature in database

@ -27,6 +27,7 @@ const (
_commentActionReplyDelete
_commentActionReplyThumbsUp
_commentActionReplyThumbsDown
_commentActionHighlight
)
type cacheUnreadMsgEvent struct {
@ -138,6 +139,8 @@ func (e *commentActionEvent) Action() (err error) {
case _commentActionThumbsUp, _commentActionThumbsDown:
err = e.updateCommentMetric()
e.expireHotsComments()
case _commentActionHighlight:
e.expireAllStyleComments()
default:
// nothing
}

@ -482,6 +482,10 @@ func (s *privSrv) HighlightComment(req *web.HighlightCommentReq) (*web.Highlight
} else if err != nil {
return nil, web.ErrHighlightCommentFailed
}
// 缓存处理, 宽松处理错误
if comment, err := s.Ds.GetCommentByID(req.CommentId); err == nil {
onCommentActionEvent(comment.PostID, comment.ID, _commentActionHighlight)
}
return &web.HighlightCommentResp{
HighlightStatus: status,
}, nil

Loading…
Cancel
Save