summaryrefslogtreecommitdiffstats
path: root/model
diff options
context:
space:
mode:
Diffstat (limited to 'model')
-rw-r--r--model/client.go9
-rw-r--r--model/post.go4
2 files changed, 10 insertions, 3 deletions
diff --git a/model/client.go b/model/client.go
index 9fcb06cf8..c355b90f5 100644
--- a/model/client.go
+++ b/model/client.go
@@ -522,6 +522,15 @@ func (c *Client) GetPosts(channelId string, offset int, limit int, etag string)
}
}
+func (c *Client) GetPostsSince(channelId string, time int64) (*Result, *AppError) {
+ if r, err := c.DoGet(fmt.Sprintf("/channels/%v/posts/%v", channelId, time), "", ""); err != nil {
+ return nil, err
+ } else {
+ return &Result{r.Header.Get(HEADER_REQUEST_ID),
+ r.Header.Get(HEADER_ETAG_SERVER), PostListFromJson(r.Body)}, nil
+ }
+}
+
func (c *Client) GetPost(channelId string, postId string, etag string) (*Result, *AppError) {
if r, err := c.DoGet(fmt.Sprintf("/channels/%v/post/%v", channelId, postId), "", etag); err != nil {
return nil, err
diff --git a/model/post.go b/model/post.go
index f8a3032a3..0c035d4e7 100644
--- a/model/post.go
+++ b/model/post.go
@@ -120,9 +120,7 @@ func (o *Post) PreSave() {
o.OriginalId = ""
- if o.CreateAt <= 0 {
- o.CreateAt = GetMillis()
- }
+ o.CreateAt = GetMillis()
o.UpdateAt = o.CreateAt
if o.Props == nil {