summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
Diffstat (limited to 'api')
-rw-r--r--api/post.go1
-rw-r--r--api/post_test.go11
2 files changed, 12 insertions, 0 deletions
diff --git a/api/post.go b/api/post.go
index 354fe35db..e8aef2f86 100644
--- a/api/post.go
+++ b/api/post.go
@@ -1217,6 +1217,7 @@ func updatePost(c *Context, w http.ResponseWriter, r *http.Request) {
*newPost = *oldPost
newPost.Message = post.Message
+ newPost.EditAt = model.GetMillis()
newPost.Hashtags, _ = model.ParseHashtags(post.Message)
if result := <-Srv.Store.Post().Update(newPost, oldPost); result.Err != nil {
diff --git a/api/post_test.go b/api/post_test.go
index e48debcae..6101d2c8d 100644
--- a/api/post_test.go
+++ b/api/post_test.go
@@ -47,6 +47,10 @@ func TestCreatePost(t *testing.T) {
t.Fatal("shouldn't have files")
}
+ if rpost1.Data.(*model.Post).EditAt != 0 {
+ t.Fatal("Newly craeted post shouldn't have EditAt set")
+ }
+
post2 := &model.Post{ChannelId: channel1.Id, Message: "a" + model.NewId() + "a", RootId: rpost1.Data.(*model.Post).Id}
rpost2, err := Client.CreatePost(post2)
if err != nil {
@@ -326,6 +330,10 @@ func TestUpdatePost(t *testing.T) {
t.Fatal(err)
}
+ if rpost2.Data.(*model.Post).EditAt != 0 {
+ t.Fatal("Newly craeted post shouldn't have EditAt set")
+ }
+
msg2 := "a" + model.NewId() + " update post 1"
rpost2.Data.(*model.Post).Message = msg2
if rupost2, err := Client.UpdatePost(rpost2.Data.(*model.Post)); err != nil {
@@ -334,6 +342,9 @@ func TestUpdatePost(t *testing.T) {
if rupost2.Data.(*model.Post).Message != msg2 {
t.Fatal("failed to updates")
}
+ if rupost2.Data.(*model.Post).EditAt == 0 {
+ t.Fatal("EditAt not updated for post")
+ }
}
msg1 := "#hashtag a" + model.NewId() + " update post 2"