[PLT-5170] Add join the channel system message for the person who created the channel (#7299)
* add join the channel system message for the person who created the channel * update test
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
bb2ca558bb
Коммит
f34cd567a6
@@ -246,7 +246,7 @@ func TestGetTeamAnalyticsStandard(t *testing.T) {
|
||||
t.Fatal()
|
||||
}
|
||||
|
||||
if rows[2].Value != 6 {
|
||||
if rows[2].Value != 9 {
|
||||
t.Log(rows.ToJson())
|
||||
t.Fatal()
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@@ -256,9 +257,22 @@ func TestTestCommand(t *testing.T) {
|
||||
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
|
||||
p1 := Client.Must(Client.GetPosts(channel1.Id, 0, 2, "")).Data.(*model.PostList)
|
||||
if len(p1.Order) != 1 {
|
||||
t.Fatal("Test command failed to send")
|
||||
p1 := Client.Must(Client.GetPosts(channel1.Id, 0, 10, "")).Data.(*model.PostList)
|
||||
// including system 'joined' message
|
||||
if len(p1.Order) != 2 {
|
||||
t.Fatal("Test command response failed to send")
|
||||
}
|
||||
|
||||
cmdPosted := false
|
||||
for _, post := range p1.Posts {
|
||||
if strings.Contains(post.Message, "test command response") {
|
||||
cmdPosted = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if !cmdPosted {
|
||||
t.Fatal("Test command response failed to post")
|
||||
}
|
||||
|
||||
cmd2 := &model.Command{
|
||||
@@ -276,8 +290,8 @@ func TestTestCommand(t *testing.T) {
|
||||
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
|
||||
p2 := Client.Must(Client.GetPosts(channel1.Id, 0, 2, "")).Data.(*model.PostList)
|
||||
if len(p2.Order) != 2 {
|
||||
p2 := Client.Must(Client.GetPosts(channel1.Id, 0, 10, "")).Data.(*model.PostList)
|
||||
if len(p2.Order) != 3 {
|
||||
t.Fatal("Test command failed to send")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -613,8 +613,8 @@ func TestGetPostsBeforeAfter(t *testing.T) {
|
||||
t.Fatal("wrong order")
|
||||
}
|
||||
|
||||
if len(r1.Posts) != 3 {
|
||||
t.Log(r1.Posts)
|
||||
// including created post from test helper and system 'joined' message
|
||||
if len(r1.Posts) != 4 {
|
||||
t.Fatal("wrong size")
|
||||
}
|
||||
|
||||
@@ -927,8 +927,8 @@ func TestDeletePosts(t *testing.T) {
|
||||
|
||||
r2 := Client.Must(Client.GetPosts(channel1.Id, 0, 10, "")).Data.(*model.PostList)
|
||||
|
||||
if len(r2.Posts) != 5 {
|
||||
t.Fatal("should have returned 5 items")
|
||||
if post := r2.Posts[post3.Id]; post != nil {
|
||||
t.Fatal("should have not returned deleted post")
|
||||
}
|
||||
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
package api4
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/mattermost/platform/app"
|
||||
@@ -416,10 +417,22 @@ func TestExecuteCommand(t *testing.T) {
|
||||
}
|
||||
|
||||
posts, err := app.GetPostsPage(channel.Id, 0, 10)
|
||||
if err != nil || posts == nil || len(posts.Order) != 2 {
|
||||
if err != nil || posts == nil || len(posts.Order) != 3 {
|
||||
t.Fatal("Test command failed to send")
|
||||
}
|
||||
|
||||
cmdPosted := false
|
||||
for _, post := range posts.Posts {
|
||||
if strings.Contains(post.Message, "test command response") {
|
||||
cmdPosted = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if !cmdPosted {
|
||||
t.Fatal("Test command response failed to post")
|
||||
}
|
||||
|
||||
getCmd := &model.Command{
|
||||
CreatorId: th.BasicUser.Id,
|
||||
TeamId: th.BasicTeam.Id,
|
||||
@@ -440,7 +453,7 @@ func TestExecuteCommand(t *testing.T) {
|
||||
}
|
||||
|
||||
posts, err = app.GetPostsPage(channel.Id, 0, 10)
|
||||
if err != nil || posts == nil || len(posts.Order) != 3 {
|
||||
if err != nil || posts == nil || len(posts.Order) != 4 {
|
||||
t.Fatal("Test command failed to send")
|
||||
}
|
||||
|
||||
|
||||
@@ -126,6 +126,13 @@ func CreateChannelWithUser(channel *model.Channel, userId string) (*model.Channe
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var user *model.User
|
||||
if user, err = GetUser(userId); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
postJoinChannelMessage(user, channel)
|
||||
|
||||
message := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_CHANNEL_CREATED, "", "", userId, nil)
|
||||
message.Add("channel_id", channel.Id)
|
||||
message.Add("team_id", channel.TeamId)
|
||||
|
||||
Ссылка в новой задаче
Block a user