diff --git a/api4/post.go b/api4/post.go index 479d249967..8892bee66d 100644 --- a/api4/post.go +++ b/api4/post.go @@ -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 {