коммит произвёл
GitHub
родитель
ac3bb2e811
Коммит
964c2b06db
@@ -166,7 +166,6 @@ func TestCheckPendingNotifications(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
received := make(chan *model.Post, 2)
|
received := make(chan *model.Post, 2)
|
||||||
timeout := make(chan bool)
|
|
||||||
|
|
||||||
job.checkPendingNotifications(time.Unix(10130, 0), func(s string, notifications []*batchedNotification) {
|
job.checkPendingNotifications(time.Unix(10130, 0), func(s string, notifications []*batchedNotification) {
|
||||||
for _, notification := range notifications {
|
for _, notification := range notifications {
|
||||||
@@ -174,27 +173,19 @@ func TestCheckPendingNotifications(t *testing.T) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
go func() {
|
|
||||||
// start a timeout to make sure that we don't get stuck here on a failed test
|
|
||||||
time.Sleep(5 * time.Second)
|
|
||||||
timeout <- true
|
|
||||||
}()
|
|
||||||
|
|
||||||
require.Nil(t, job.pendingNotifications[th.BasicUser.Id], "shouldn't have sent queued post")
|
require.Nil(t, job.pendingNotifications[th.BasicUser.Id], "shouldn't have sent queued post")
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case post := <-received:
|
case post := <-received:
|
||||||
require.Equal(t, post.Message, "post1", "should've received post1 first")
|
require.Equal(t, post.Message, "post1", "should've received post1 first")
|
||||||
|
case <-time.After(5 * time.Second):
|
||||||
case <-timeout:
|
|
||||||
require.Fail(t, "timed out waiting for first post notification")
|
require.Fail(t, "timed out waiting for first post notification")
|
||||||
}
|
}
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case post := <-received:
|
case post := <-received:
|
||||||
require.Equal(t, post.Message, "post2", "should've received post2 second")
|
require.Equal(t, post.Message, "post2", "should've received post2 second")
|
||||||
|
case <-time.After(5 * time.Second):
|
||||||
case <-timeout:
|
|
||||||
require.Fail(t, "timed out waiting for second post notification")
|
require.Fail(t, "timed out waiting for second post notification")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ func (s *Server) servePluginRequest(w http.ResponseWriter, r *http.Request, hand
|
|||||||
|
|
||||||
csrfCheckPassed := false
|
csrfCheckPassed := false
|
||||||
|
|
||||||
if err == nil && cookieAuth && r.Method != "GET" {
|
if session != nil && err == nil && cookieAuth && r.Method != "GET" {
|
||||||
sentToken := ""
|
sentToken := ""
|
||||||
|
|
||||||
if r.Header.Get(model.HEADER_CSRF_TOKEN) == "" {
|
if r.Header.Get(model.HEADER_CSRF_TOKEN) == "" {
|
||||||
@@ -172,7 +172,7 @@ func (s *Server) servePluginRequest(w http.ResponseWriter, r *http.Request, hand
|
|||||||
sid := ""
|
sid := ""
|
||||||
userID := ""
|
userID := ""
|
||||||
|
|
||||||
if session != nil {
|
if session.Id != "" {
|
||||||
sid = session.Id
|
sid = session.Id
|
||||||
userID = session.UserId
|
userID = session.UserId
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user