[MM-62092] Allow system admins to pull posts in from DMs they're not in (#29557)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
b60ce28726
Коммит
57372bd06b
@@ -214,7 +214,7 @@ func getPostsForChannel(c *Context, w http.ResponseWriter, r *http.Request) {
|
|||||||
c.Err = err
|
c.Err = err
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !c.App.SessionHasPermissionToReadChannel(c.AppContext, *c.AppContext.Session(), channel) {
|
if !c.IsSystemAdmin() && !c.App.SessionHasPermissionToReadChannel(c.AppContext, *c.AppContext.Session(), channel) {
|
||||||
c.SetPermissionError(model.PermissionReadChannelContent)
|
c.SetPermissionError(model.PermissionReadChannelContent)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1994,6 +1994,14 @@ func TestGetPostsForChannel(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
CheckOKStatus(t, resp)
|
CheckOKStatus(t, resp)
|
||||||
require.Len(t, posts.Order, 10, "expected 10 posts")
|
require.Len(t, posts.Order, 10, "expected 10 posts")
|
||||||
|
|
||||||
|
// allow viewing of direct messages
|
||||||
|
dmChannel := th.CreateDmChannel(th.BasicUser2)
|
||||||
|
th.CreateMessagePostNoClient(dmChannel, "test1", model.GetMillis())
|
||||||
|
|
||||||
|
posts, resp, err = c.GetPostsForChannel(context.Background(), dmChannel.Id, 0, 100, "", false, false)
|
||||||
|
require.NoError(t, err)
|
||||||
|
CheckOKStatus(t, resp)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user