summaryrefslogtreecommitdiffstats
path: root/app/post_test.go
diff options
context:
space:
mode:
authorJoramWilander <jwawilander@gmail.com>2017-05-12 08:00:28 -0400
committerJoramWilander <jwawilander@gmail.com>2017-05-12 08:00:28 -0400
commit9d109b070037951fcd0832b785eba8a3db9a157c (patch)
tree5d109da2e9e088f16eff0ad1421876a3d3da412e /app/post_test.go
parentb1c39204a63a87d2cbc57f66cf9db50c938b2ee5 (diff)
parenta21a06afd9907e9911dcb166d902cba9f405c7cb (diff)
downloadchat-9d109b070037951fcd0832b785eba8a3db9a157c.tar.gz
chat-9d109b070037951fcd0832b785eba8a3db9a157c.tar.bz2
chat-9d109b070037951fcd0832b785eba8a3db9a157c.zip
Merge branch 'release-3.9' into merge-3.9
Diffstat (limited to 'app/post_test.go')
-rw-r--r--app/post_test.go44
1 files changed, 44 insertions, 0 deletions
diff --git a/app/post_test.go b/app/post_test.go
new file mode 100644
index 000000000..9bc5ee742
--- /dev/null
+++ b/app/post_test.go
@@ -0,0 +1,44 @@
+// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+package app
+
+import (
+ "testing"
+
+ "github.com/mattermost/platform/model"
+ "fmt"
+)
+
+func TestPostReplyToPostWhereRootPosterLeftChannel(t *testing.T) {
+ // This test ensures that when replying to a root post made by a user who has since left the channel, the reply
+ // post completes successfully. This is a regression test for PLT-6523.
+ th := Setup().InitBasic()
+
+ channel := th.BasicChannel
+ userInChannel := th.BasicUser2
+ userNotInChannel := th.BasicUser
+ rootPost := th.BasicPost
+
+ if _, err := AddUserToChannel(userInChannel, channel); err != nil {
+ t.Fatal(err)
+ }
+
+ if err := RemoveUserFromChannel(userNotInChannel.Id, "", channel); err != nil {
+ t.Fatal(err)
+ }
+
+ replyPost := model.Post{
+ Message: "asd",
+ ChannelId: channel.Id,
+ RootId: rootPost.Id,
+ ParentId: rootPost.Id,
+ PendingPostId: model.NewId() + ":" + fmt.Sprint(model.GetMillis()),
+ UserId: userInChannel.Id,
+ CreateAt: 0,
+ }
+
+ if _, err := CreatePostAsUser(&replyPost); err != nil {
+ t.Fatal(err)
+ }
+}