summaryrefslogtreecommitdiffstats
path: root/store
diff options
context:
space:
mode:
Diffstat (limited to 'store')
-rw-r--r--store/sql_post_store.go11
-rw-r--r--store/sql_post_store_test.go2
2 files changed, 8 insertions, 5 deletions
diff --git a/store/sql_post_store.go b/store/sql_post_store.go
index e7c3a59a0..cd668b13c 100644
--- a/store/sql_post_store.go
+++ b/store/sql_post_store.go
@@ -286,7 +286,7 @@ func (s SqlPostStore) GetPostsSince(channelId string, time int64) StoreChannel {
WHERE
(UpdateAt > :Time
AND ChannelId = :ChannelId)
- LIMIT 100)
+ LIMIT 1000)
UNION
(SELECT
*
@@ -302,7 +302,7 @@ func (s SqlPostStore) GetPostsSince(channelId string, time int64) StoreChannel {
WHERE
UpdateAt > :Time
AND ChannelId = :ChannelId
- LIMIT 100) temp_tab))
+ LIMIT 1000) temp_tab))
ORDER BY CreateAt DESC`,
map[string]interface{}{"ChannelId": channelId, "Time": time})
@@ -314,7 +314,9 @@ func (s SqlPostStore) GetPostsSince(channelId string, time int64) StoreChannel {
for _, p := range posts {
list.AddPost(p)
- list.AddOrder(p.Id)
+ if p.UpdateAt > time {
+ list.AddOrder(p.Id)
+ }
}
result.Data = list
@@ -372,7 +374,8 @@ func (s SqlPostStore) getParentsPosts(channelId string, offset int, limit int) S
ChannelId = :ChannelId1
AND DeleteAt = 0
ORDER BY CreateAt DESC
- LIMIT :Limit OFFSET :Offset) q3) q1 ON q1.RootId = q2.RootId
+ LIMIT :Limit OFFSET :Offset) q3
+ WHERE q3.RootId != '') q1 ON q1.RootId = q2.Id
WHERE
ChannelId = :ChannelId2
AND DeleteAt = 0
diff --git a/store/sql_post_store_test.go b/store/sql_post_store_test.go
index 8854fb5c4..4564e2deb 100644
--- a/store/sql_post_store_test.go
+++ b/store/sql_post_store_test.go
@@ -374,7 +374,7 @@ func TestPostStoreGetPostsWtihDetails(t *testing.T) {
t.Fatal("invalid order")
}
- if len(r1.Posts) != 6 {
+ if len(r1.Posts) != 5 { //the last 4, + o1 (o3 and o2a's parent)
t.Fatal("wrong size")
}