forked from Archives/Athou_commafeed
don't display entries twice when refreshing during loading (fix #473)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user