* if thread is archived, allow the archived time to be returned instead of throwing an error
Этот коммит содержится в:
Nathaniel Allred
2022-09-30 13:20:26 -05:00
коммит произвёл GitHub
родитель 76386df998
Коммит 7186689f54

Просмотреть файл

@@ -587,6 +587,17 @@ func getPostThread(c *Context, w http.ResponseWriter, r *http.Request) {
c.Err = err
return
}
if list.FirstInaccessiblePostTime != 0 {
// e.g. if root post is archived in a cloud plan,
// we don't want to display the thread,
// but at the same time the request was not bad,
// so we return the time of archival and let the client
// show an error
if err := (&model.PostList{Order: []string{}, FirstInaccessiblePostTime: list.FirstInaccessiblePostTime}).EncodeJSON(w); err != nil {
c.Logger.Warn("Error while writing response", mlog.Err(err))
}
return
}
post, ok := list.Posts[c.Params.PostId]
if !ok {