Multiple cross-team functionality fixes (#2902)

Этот коммит содержится в:
Joram Wilander
2016-05-06 08:06:34 -04:00
коммит произвёл Christopher Speller
родитель 4b2843ee9d
Коммит d75cb02948
7 изменённых файлов: 27 добавлений и 10 удалений

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

@@ -146,7 +146,11 @@ func CreateDirectChannel(userId string, otherUserId string) (*model.Channel, *mo
}
if result := <-Srv.Store.Channel().SaveDirectChannel(channel, cm1, cm2); result.Err != nil {
return nil, result.Err
if result.Err.Id == store.CHANNEL_EXISTS_ERROR {
return result.Data.(*model.Channel), nil
} else {
return nil, result.Err
}
} else {
return result.Data.(*model.Channel), nil
}

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

@@ -113,8 +113,9 @@ func TestCreateDirectChannel(t *testing.T) {
t.Fatal("channel type was not direct")
}
if _, err := Client.CreateDirectChannel(th.BasicUser2.Id); err == nil {
t.Fatal("channel already exists and should have failed")
// don't fail on direct channels already existing
if _, err := Client.CreateDirectChannel(th.BasicUser2.Id); err != nil {
t.Fatal(err)
}
if _, err := Client.CreateDirectChannel("junk"); err == nil {