Take view archived config into account on users and posts api endpoints (#19014)

* Take view archived config into account on users and posts api endpoints

* Move the inChannel check to the top level
Этот коммит содержится в:
Miguel de la Cruz
2021-11-25 15:01:17 +01:00
коммит произвёл GitHub
родитель 8588f69850
Коммит 009d02c57a
5 изменённых файлов: 102 добавлений и 0 удалений

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

@@ -182,6 +182,18 @@ func getPostsForChannel(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
if !*c.App.Config().TeamSettings.ExperimentalViewArchivedChannels {
channel, err := c.App.GetChannel(channelId)
if err != nil {
c.Err = err
return
}
if channel.DeleteAt != 0 {
c.Err = model.NewAppError("Api4.getPostsForChannel", "api.user.view_archived_channels.get_posts_for_channel.app_error", nil, "", http.StatusForbidden)
return
}
}
var list *model.PostList
var err *model.AppError
etag := ""