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 * @param quantity
*/ */
public void loadMorePosts(final int quantity, boolean isSortingByLastCommentedposts) { public void loadMorePosts(final int quantity, boolean isSortingByLastCommentedposts) {
if (isSortingByLastCommentedposts)
showLoader();
int from = (fromStartingPoint == null) ? allUpdates.size()+1 : fromStartingPoint; int from = (fromStartingPoint == null) ? allUpdates.size()+1 : fromStartingPoint;
if (isSortingByLastCommentedposts) {
showLoader();
if ((from == 0))
from = 1;
}
GWT.log("StartingPoint = " + from); GWT.log("StartingPoint = " + from);
newsService.getMoreFeeds(from, quantity, new AsyncCallback<MoreFeedsBean>() { newsService.getMoreFeeds(from, quantity, new AsyncCallback<MoreFeedsBean>() {
@Override @Override

View File

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

View File

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