Feature #10192 allow to sort feeds per recent comments bug fix

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/news-feed@165135 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2018-03-15 14:55:20 +00:00
parent ef450ff5e8
commit 1e9892342b
3 changed files with 13 additions and 7 deletions

View File

@ -1040,9 +1040,13 @@ public class NewsFeedPanel extends Composite {
* @param quantity
*/
public void loadMorePosts(final int quantity, boolean isSortingByLastCommentedposts) {
if (isSortingByLastCommentedposts)
showLoader();
int from = (fromStartingPoint == null) ? allUpdates.size()+1 : fromStartingPoint;
if (isSortingByLastCommentedposts) {
showLoader();
if ((from == 0))
from = 1;
}
GWT.log("StartingPoint = " + from);
newsService.getMoreFeeds(from, quantity, new AsyncCallback<MoreFeedsBean>() {
@Override

View File

@ -51,7 +51,7 @@ public class FilterPanel extends Composite {
allUpdatesLink.setActive(false);
recentCommentsLink.setActive(true);
caller.setCurrentFilter(FilterType.RECENT_COMMENTS);
int loadedPostsInView = caller.getAllUpdatesSize();
int loadedPostsInView = caller.getAllUpdatesSize() + 1;
int quantity = loadedPostsInView < 100 ? 100 - loadedPostsInView : loadedPostsInView;
caller.loadMorePosts(quantity, true);
}

View File

@ -104,7 +104,7 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
private ElasticSearchClient escl;
private final static int MAX_POSTS_NO = 30;
public void init() {
store = new DBCassandraAstyanaxImpl();
try {
@ -494,9 +494,11 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
try {
rangeFeeds = store.getRecentFeedsByVREAndRange(vreid, start, quantity);
organizationFeeds = rangeFeeds.getFeeds();
for (Feed feed : organizationFeeds) {
feedsMap.put(feed.getKey(), feed);
//System.out.println("->\n"+feed.getDescription());
if (organizationFeeds != null) {
for (Feed feed : organizationFeeds) {
feedsMap.put(feed.getKey(), feed);
//System.out.println("->\n"+feed.getDescription());
}
}
}
catch (Exception e) {