Mm 46065 (#20893)
* if thread is archived, allow the archived time to be returned instead of throwing an error
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
76386df998
Коммит
7186689f54
11
api4/post.go
11
api4/post.go
@@ -587,6 +587,17 @@ func getPostThread(c *Context, w http.ResponseWriter, r *http.Request) {
|
|||||||
c.Err = err
|
c.Err = err
|
||||||
return
|
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]
|
post, ok := list.Posts[c.Params.PostId]
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user