don't display entries twice when refreshing during loading (fix #473)

This commit is contained in:
Athou
2013-08-01 11:17:38 +02:00
parent 10fdffc378
commit 8df587aaad
5 changed files with 33 additions and 1 deletions

View File

@@ -35,6 +35,12 @@ public class Entries implements Serializable {
@ApiProperty("if the query has more elements")
private boolean hasMore;
@ApiProperty("the requested offset")
private int offset;
@ApiProperty("the requested limit")
private int limit;
@ApiProperty("list of entries")
private List<Entry> entries = Lists.newArrayList();
@@ -94,4 +100,20 @@ public class Entries implements Serializable {
this.hasMore = hasMore;
}
public int getOffset() {
return offset;
}
public void setOffset(int offset) {
this.offset = offset;
}
public int getLimit() {
return limit;
}
public void setLimit(int limit) {
this.limit = limit;
}
}

View File

@@ -106,6 +106,8 @@ public class CategoryREST extends AbstractResourceREST {
limit = Math.max(0, limit);
Entries entries = new Entries();
entries.setOffset(offset);
entries.setLimit(limit);
boolean unreadOnly = readType == ReadType.unread;
if (StringUtils.isBlank(id)) {
id = ALL;

View File

@@ -98,7 +98,9 @@ public class EntryREST extends AbstractResourceREST {
Preconditions.checkArgument(StringUtils.length(keywords) >= 3);
Entries entries = new Entries();
entries.setOffset(offset);
entries.setLimit(limit);
List<FeedSubscription> subs = feedSubscriptionDAO.findAll(getUser());
List<FeedEntryStatus> entriesStatus = feedEntryStatusDAO.findBySubscriptions(subs, false, keywords, null, offset, limit + 1,
ReadingOrder.desc, true);

View File

@@ -145,6 +145,9 @@ public class FeedREST extends AbstractResourceREST {
limit = Math.max(0, limit);
Entries entries = new Entries();
entries.setOffset(offset);
entries.setLimit(limit);
boolean unreadOnly = readType == ReadType.unread;
Date newerThanDate = newerThan == null ? null : new Date(Long.valueOf(newerThan));

View File

@@ -721,6 +721,9 @@ module.controller('FeedListCtrl', [
}
var callback = function(data) {
if (data.offset == 0) {
$scope.entries = [];
}
for ( var i = 0; i < data.entries.length; i++) {
$scope.entries.push(data.entries[i]);
}