mirror of
https://github.com/mattermost/mattermost.git
synced 2026-10-24 02:00:45 +08:00
Multiple cross-team functionality fixes (#2902)
This commit is contained in:
committed by
Christopher Speller
parent
4b2843ee9d
commit
d75cb02948
+5
-1
@@ -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
|
||||
}
|
||||
|
||||
+3
-2
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user