|
|
|
@ -1,7 +1,9 @@
|
|
|
|
|
package org.gcube.portlets.user.newsfeed.client.panels;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Collections;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.HashSet;
|
|
|
|
|
|
|
|
|
|
import org.gcube.common.portal.GCubePortalConstants;
|
|
|
|
@ -119,6 +121,7 @@ public class NewsFeedPanel extends Composite {
|
|
|
|
|
public static final String SHARE_FWD_LABEL = "Share";
|
|
|
|
|
private static final int SEARCHED_FEEDS_TO_SHOW = 10;
|
|
|
|
|
private static final int FEEDS_RELATED_TO_USER_STATISTICS_TO_SHOW = 10;
|
|
|
|
|
private static final String LIMIT_REACHED_FOR_SORTING_COMMENTS_TEXT = "You reached the limit, sort by newest comments works up to 100 posts.";
|
|
|
|
|
|
|
|
|
|
private String vreLabel;
|
|
|
|
|
|
|
|
|
@ -294,7 +297,7 @@ public class NewsFeedPanel extends Composite {
|
|
|
|
|
GWT.log("checking params ");
|
|
|
|
|
if (getFeedToShowId() != null) {
|
|
|
|
|
String feedKey = getFeedToShowId();
|
|
|
|
|
showSingleFeed(feedKey);
|
|
|
|
|
showSinglePost(feedKey);
|
|
|
|
|
filterPanel.removeFilterSelected();
|
|
|
|
|
}
|
|
|
|
|
else if (getHashtagParam() != null) {
|
|
|
|
@ -341,6 +344,8 @@ public class NewsFeedPanel extends Composite {
|
|
|
|
|
filterPanel.removeFilterSelected();
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if (!result.isInfrastructure())
|
|
|
|
|
filterPanelWrapper.setVisible(getFeedToShowId() == null);
|
|
|
|
|
showAllUpdatesFeeds();
|
|
|
|
|
}
|
|
|
|
|
currentFilter = FilterType.ALL_UPDATES;
|
|
|
|
@ -366,9 +371,11 @@ public class NewsFeedPanel extends Composite {
|
|
|
|
|
Window.addWindowScrollHandler(new ScrollHandler() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onWindowScroll(ScrollEvent event) {
|
|
|
|
|
boolean isInView = isScrolledIntoView(showMoreWidget);
|
|
|
|
|
if (isInView) {
|
|
|
|
|
eventBus.fireEvent(new ShowMoreUpdatesEvent());
|
|
|
|
|
if (showMoreWidget != null) {
|
|
|
|
|
boolean isInView = isScrolledIntoView(showMoreWidget);
|
|
|
|
|
if (isInView) {
|
|
|
|
|
eventBus.fireEvent(new ShowMoreUpdatesEvent());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
@ -392,7 +399,7 @@ public class NewsFeedPanel extends Composite {
|
|
|
|
|
showOnlyConnectionsFeeds();
|
|
|
|
|
break;
|
|
|
|
|
case MINE:
|
|
|
|
|
showOnlyMyFeeds();
|
|
|
|
|
showOnlyMyPosts();
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
@ -431,11 +438,11 @@ public class NewsFeedPanel extends Composite {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* used from notification referrals (see this Post)
|
|
|
|
|
* @param feedKey
|
|
|
|
|
* @param postKey
|
|
|
|
|
*/
|
|
|
|
|
private void showSingleFeed(String feedKey) {
|
|
|
|
|
private void showSinglePost(String postKey) {
|
|
|
|
|
newsPanel.clear();
|
|
|
|
|
newsService.getSingleFeed(feedKey, new AsyncCallback<EnhancedFeed>() {
|
|
|
|
|
newsService.getSingleFeed(postKey, new AsyncCallback<EnhancedFeed>() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(EnhancedFeed result) {
|
|
|
|
|
if (result.getFeed().getType() == FeedType.DISABLED) {
|
|
|
|
@ -759,35 +766,35 @@ public class NewsFeedPanel extends Composite {
|
|
|
|
|
newsPanel.insert(tt, 0); //insert in the view
|
|
|
|
|
allUpdates.add(0, feed); //insert in the model
|
|
|
|
|
|
|
|
|
|
// //timer for the transition
|
|
|
|
|
// Timer t = new Timer() {
|
|
|
|
|
// @Override
|
|
|
|
|
// public void run() {
|
|
|
|
|
// tt.setcontentAreaStyle("visible");
|
|
|
|
|
//
|
|
|
|
|
// // alert the user-statistics portlet to update statistics in case
|
|
|
|
|
// // one or more feed belongs to user himself
|
|
|
|
|
// if(tt.isUser()){
|
|
|
|
|
// try{
|
|
|
|
|
//
|
|
|
|
|
// NewsFeed.pageBusAdapter.PageBusPublish(PageBusEvents.postIncrement, "", Defaults.STRING_JSONIZER);
|
|
|
|
|
//
|
|
|
|
|
// int numComments = tt.numberOfComments();
|
|
|
|
|
// int numLikes = tt.numberOfLikes();
|
|
|
|
|
//
|
|
|
|
|
// for(int i = 0; i < numComments; i++)
|
|
|
|
|
// NewsFeed.pageBusAdapter.PageBusPublish(PageBusEvents.commentsIncrement, "", Defaults.STRING_JSONIZER);
|
|
|
|
|
//
|
|
|
|
|
// for(int i = 0; i < numLikes; i++)
|
|
|
|
|
// NewsFeed.pageBusAdapter.PageBusPublish(PageBusEvents.likesIncrement, "", Defaults.STRING_JSONIZER);
|
|
|
|
|
//
|
|
|
|
|
// }catch (PageBusAdapterException ex) {
|
|
|
|
|
// GWT.log(ex.toString());
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// };
|
|
|
|
|
// t.schedule(100);
|
|
|
|
|
// //timer for the transition
|
|
|
|
|
// Timer t = new Timer() {
|
|
|
|
|
// @Override
|
|
|
|
|
// public void run() {
|
|
|
|
|
// tt.setcontentAreaStyle("visible");
|
|
|
|
|
//
|
|
|
|
|
// // alert the user-statistics portlet to update statistics in case
|
|
|
|
|
// // one or more feed belongs to user himself
|
|
|
|
|
// if(tt.isUser()){
|
|
|
|
|
// try{
|
|
|
|
|
//
|
|
|
|
|
// NewsFeed.pageBusAdapter.PageBusPublish(PageBusEvents.postIncrement, "", Defaults.STRING_JSONIZER);
|
|
|
|
|
//
|
|
|
|
|
// int numComments = tt.numberOfComments();
|
|
|
|
|
// int numLikes = tt.numberOfLikes();
|
|
|
|
|
//
|
|
|
|
|
// for(int i = 0; i < numComments; i++)
|
|
|
|
|
// NewsFeed.pageBusAdapter.PageBusPublish(PageBusEvents.commentsIncrement, "", Defaults.STRING_JSONIZER);
|
|
|
|
|
//
|
|
|
|
|
// for(int i = 0; i < numLikes; i++)
|
|
|
|
|
// NewsFeed.pageBusAdapter.PageBusPublish(PageBusEvents.likesIncrement, "", Defaults.STRING_JSONIZER);
|
|
|
|
|
//
|
|
|
|
|
// }catch (PageBusAdapterException ex) {
|
|
|
|
|
// GWT.log(ex.toString());
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// };
|
|
|
|
|
// t.schedule(100);
|
|
|
|
|
}
|
|
|
|
|
//after that I remove the ($updatesNo) from Window Title
|
|
|
|
|
String currTitle = Document.get().getTitle();
|
|
|
|
@ -1024,43 +1031,57 @@ public class NewsFeedPanel extends Composite {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
|
|
|
|
|
int from = (fromStartingPoint == null) ? allUpdates.size()+1 : fromStartingPoint;
|
|
|
|
|
|
|
|
|
|
final int quantity = 10;
|
|
|
|
|
GWT.log("StartingPoint = " + from);
|
|
|
|
|
newsService.getMoreFeeds(from, quantity, new AsyncCallback<MoreFeedsBean>() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(MoreFeedsBean rangeFeeds) {
|
|
|
|
|
newsPanel.remove(showMoreUpdatesPanel);
|
|
|
|
|
if (rangeFeeds.getFeeds() != null) {
|
|
|
|
|
fromStartingPoint = rangeFeeds.getLastReturnedFeedTimelineIndex();
|
|
|
|
|
int c = 1;
|
|
|
|
|
for (EnhancedFeed feed : rangeFeeds.getFeeds()) {
|
|
|
|
|
if (!isFeedPresent(feed)) { //avoid possible duplicates
|
|
|
|
|
newsPanel.add(new TweetTemplate(false, showFeedTimelineSource, myUserInfo, feed, eventBus)); //in the view
|
|
|
|
|
allUpdates.add(feed); //in the model
|
|
|
|
|
}
|
|
|
|
|
c++;
|
|
|
|
|
}
|
|
|
|
|
if (c >= quantity) { //there could be more feeds
|
|
|
|
|
GWT.log("there could be more feeds");
|
|
|
|
|
showMoreUpdatesPanel.clear();
|
|
|
|
|
showMoreWidget = new ShowMoreFeeds(eventBus);
|
|
|
|
|
showMoreUpdatesPanel.add(showMoreWidget);
|
|
|
|
|
newsPanel.add(showMoreUpdatesPanel);
|
|
|
|
|
loadMorePosts(quantity, false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* @param quantity
|
|
|
|
|
*/
|
|
|
|
|
public void loadMorePosts(final int quantity, boolean isSortingByLastCommentedposts) {
|
|
|
|
|
if (isSortingByLastCommentedposts)
|
|
|
|
|
showLoader();
|
|
|
|
|
int from = (fromStartingPoint == null) ? allUpdates.size()+1 : fromStartingPoint;
|
|
|
|
|
GWT.log("StartingPoint = " + from);
|
|
|
|
|
newsService.getMoreFeeds(from, quantity, new AsyncCallback<MoreFeedsBean>() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(MoreFeedsBean rangeFeeds) {
|
|
|
|
|
newsPanel.remove(showMoreUpdatesPanel);
|
|
|
|
|
if (rangeFeeds.getFeeds() != null) {
|
|
|
|
|
fromStartingPoint = rangeFeeds.getLastReturnedFeedTimelineIndex();
|
|
|
|
|
int c = 1;
|
|
|
|
|
for (EnhancedFeed feed : rangeFeeds.getFeeds()) {
|
|
|
|
|
if (!isFeedPresent(feed)) { //avoid possible duplicates
|
|
|
|
|
newsPanel.add(new TweetTemplate(false, showFeedTimelineSource, myUserInfo, feed, eventBus)); //in the view
|
|
|
|
|
allUpdates.add(feed); //in the model
|
|
|
|
|
}
|
|
|
|
|
c++;
|
|
|
|
|
}
|
|
|
|
|
if (c >= quantity) { //there could be more feeds
|
|
|
|
|
GWT.log("there could be more feeds");
|
|
|
|
|
showMoreUpdatesPanel.clear();
|
|
|
|
|
showMoreWidget = new ShowMoreFeeds(eventBus);
|
|
|
|
|
showMoreUpdatesPanel.add(showMoreWidget);
|
|
|
|
|
newsPanel.add(showMoreUpdatesPanel);
|
|
|
|
|
}
|
|
|
|
|
if (isSortingByLastCommentedposts) {
|
|
|
|
|
sortCurrentPostsByLatestComment();
|
|
|
|
|
showMoreUpdatesPanel.clear();
|
|
|
|
|
showMoreWidget = null;
|
|
|
|
|
if (getAllUpdatesSize() > 99)
|
|
|
|
|
newsPanel.add(new HTML(LIMIT_REACHED_FOR_SORTING_COMMENTS_TEXT));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public void onFailure(Throwable caught) {
|
|
|
|
|
showMoreUpdatesPanel.clear();
|
|
|
|
|
newsPanel.add(new HTML("<div class=\"nofeed-message\">" +
|
|
|
|
|
"Ops! There were problems while retrieving your feeds!. <br> " +
|
|
|
|
|
"Please try again in a short while.</div>"));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public void onFailure(Throwable caught) {
|
|
|
|
|
showMoreUpdatesPanel.clear();
|
|
|
|
|
newsPanel.add(new HTML("<div class=\"nofeed-message\">" +
|
|
|
|
|
"Ops! There were problems while retrieving your feeds!. <br> " +
|
|
|
|
|
"Please try again in a short while.</div>"));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* @param widget the widget to check
|
|
|
|
@ -1127,7 +1148,7 @@ public class NewsFeedPanel extends Composite {
|
|
|
|
|
/**
|
|
|
|
|
* Only User Feeds
|
|
|
|
|
*/
|
|
|
|
|
public void showOnlyMyFeeds() {
|
|
|
|
|
public void showOnlyMyPosts() {
|
|
|
|
|
showLoader();
|
|
|
|
|
newsService.getOnlyMyUserFeeds(new AsyncCallback<ArrayList<EnhancedFeed>>() {
|
|
|
|
|
@Override
|
|
|
|
@ -1164,9 +1185,9 @@ public class NewsFeedPanel extends Composite {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* Only User Liked Feeds
|
|
|
|
|
* Only User Liked Posts
|
|
|
|
|
*/
|
|
|
|
|
public void showOnlyLikedFeeds() {
|
|
|
|
|
public void showOnlyLikedPosts() {
|
|
|
|
|
showLoader();
|
|
|
|
|
newsService.getOnlyLikedFeeds(new AsyncCallback<ArrayList<EnhancedFeed>>() {
|
|
|
|
|
@Override
|
|
|
|
@ -1202,6 +1223,63 @@ public class NewsFeedPanel extends Composite {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
/**:
|
|
|
|
|
* Sort the posts per recent comment
|
|
|
|
|
*/
|
|
|
|
|
private void sortCurrentPostsByLatestComment() {
|
|
|
|
|
showLoader();
|
|
|
|
|
GWT.log(" number of posts " + allUpdates.size());
|
|
|
|
|
ArrayList<Comment> latestComments = new ArrayList<>();
|
|
|
|
|
//thePostsMap is need so that later it is faster to get the post by id
|
|
|
|
|
HashMap<String, EnhancedFeed> theCommentedPostsMap = new HashMap<>();
|
|
|
|
|
for (EnhancedFeed post : allUpdates) {
|
|
|
|
|
ArrayList<Comment> postComments = post.getComments();
|
|
|
|
|
if (postComments != null && !postComments.isEmpty()) {
|
|
|
|
|
theCommentedPostsMap.put(post.getFeed().getKey(), post);
|
|
|
|
|
Comment latest = postComments.get(postComments.size()-1);
|
|
|
|
|
latestComments.add(latest); //get the latest
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//sort the comments
|
|
|
|
|
Collections.sort(latestComments, Collections.reverseOrder());
|
|
|
|
|
ArrayList<EnhancedFeed> sortedPostsByLatestComment = new ArrayList<>();
|
|
|
|
|
// evaluate unique posts' ids
|
|
|
|
|
HashSet<String> postIds = new HashSet<String>();
|
|
|
|
|
for (Comment comment : latestComments) {
|
|
|
|
|
String postId = comment.getFeedid();
|
|
|
|
|
if(!postIds.contains(postId)){
|
|
|
|
|
postIds.add(postId);
|
|
|
|
|
sortedPostsByLatestComment.add(theCommentedPostsMap.get(postId));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//at this point the sortedPostsByLatestComment list contains only the commented posts in the right order
|
|
|
|
|
//we need to add the remaining posts of the page in the latest post order
|
|
|
|
|
for (EnhancedFeed post : allUpdates) {
|
|
|
|
|
if (!theCommentedPostsMap.containsKey(post.getFeed().getKey()))
|
|
|
|
|
sortedPostsByLatestComment.add(post);
|
|
|
|
|
}
|
|
|
|
|
newsPanel.clear();
|
|
|
|
|
if (sortedPostsByLatestComment.size() == 0) {
|
|
|
|
|
newsPanel.add(new HTML("<div class=\"nofeed-message\">" +
|
|
|
|
|
"Looks like we've got nothing for you at the moment. <br> " +
|
|
|
|
|
"Set an update as your <strong>favorite</strong> to see it here</div>"));
|
|
|
|
|
isFirstTweet = true;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
newsPanel.setHeight("");
|
|
|
|
|
newsPanel.setHorizontalAlignment(HasAlignment.ALIGN_LEFT);
|
|
|
|
|
newsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
|
|
|
|
|
for (EnhancedFeed feed : sortedPostsByLatestComment)
|
|
|
|
|
newsPanel.add(new TweetTemplate(false, showFeedTimelineSource, myUserInfo, feed, eventBus));
|
|
|
|
|
if (sortedPostsByLatestComment.size() < 5) {
|
|
|
|
|
newsPanel.add(new Image(spacer));
|
|
|
|
|
}
|
|
|
|
|
isFirstTweet = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1231,17 +1309,17 @@ public class NewsFeedPanel extends Composite {
|
|
|
|
|
doShowSessionExpired();
|
|
|
|
|
} else{
|
|
|
|
|
|
|
|
|
|
// // alert the User statistics portlet to increment the number of likes got
|
|
|
|
|
// if(owner.isUser()){
|
|
|
|
|
// try {
|
|
|
|
|
// NewsFeed.pageBusAdapter.PageBusPublish(
|
|
|
|
|
// PageBusEvents.likesIncrement
|
|
|
|
|
// , ""
|
|
|
|
|
// , Defaults.STRING_JSONIZER);
|
|
|
|
|
// } catch (PageBusAdapterException ex) {
|
|
|
|
|
// GWT.log(ex.toString());
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// // alert the User statistics portlet to increment the number of likes got
|
|
|
|
|
// if(owner.isUser()){
|
|
|
|
|
// try {
|
|
|
|
|
// NewsFeed.pageBusAdapter.PageBusPublish(
|
|
|
|
|
// PageBusEvents.likesIncrement
|
|
|
|
|
// , ""
|
|
|
|
|
// , Defaults.STRING_JSONIZER);
|
|
|
|
|
// } catch (PageBusAdapterException ex) {
|
|
|
|
|
// GWT.log(ex.toString());
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1259,16 +1337,16 @@ public class NewsFeedPanel extends Composite {
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
|
|
// alert the User statistics portlet to decrement the number of likes got
|
|
|
|
|
// if(owner.isUser()){
|
|
|
|
|
// try {
|
|
|
|
|
// NewsFeed.pageBusAdapter.PageBusPublish(
|
|
|
|
|
// PageBusEvents.likesDecrement
|
|
|
|
|
// , ""
|
|
|
|
|
// , Defaults.STRING_JSONIZER);
|
|
|
|
|
// } catch (PageBusAdapterException ex) {
|
|
|
|
|
// GWT.log(ex.toString());
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// if(owner.isUser()){
|
|
|
|
|
// try {
|
|
|
|
|
// NewsFeed.pageBusAdapter.PageBusPublish(
|
|
|
|
|
// PageBusEvents.likesDecrement
|
|
|
|
|
// , ""
|
|
|
|
|
// , Defaults.STRING_JSONIZER);
|
|
|
|
|
// } catch (PageBusAdapterException ex) {
|
|
|
|
|
// GWT.log(ex.toString());
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1277,7 +1355,7 @@ public class NewsFeedPanel extends Composite {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void doShowSessionExpired() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void doShowLikes(final String feedId) {
|
|
|
|
@ -1324,14 +1402,14 @@ public class NewsFeedPanel extends Composite {
|
|
|
|
|
owner.updateCommentsNumberCount();
|
|
|
|
|
owner.showAddCommentForm(false);
|
|
|
|
|
|
|
|
|
|
// if(owner.isUser()){
|
|
|
|
|
// // alert the User statistics portlet to increment the number of comments got
|
|
|
|
|
// try {
|
|
|
|
|
// NewsFeed.pageBusAdapter.PageBusPublish(PageBusEvents.commentsIncrement, "", Defaults.STRING_JSONIZER);
|
|
|
|
|
// } catch (PageBusAdapterException e) {
|
|
|
|
|
// GWT.log(e.toString());
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// if(owner.isUser()){
|
|
|
|
|
// // alert the User statistics portlet to increment the number of comments got
|
|
|
|
|
// try {
|
|
|
|
|
// NewsFeed.pageBusAdapter.PageBusPublish(PageBusEvents.commentsIncrement, "", Defaults.STRING_JSONIZER);
|
|
|
|
|
// } catch (PageBusAdapterException e) {
|
|
|
|
|
// GWT.log(e.toString());
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
@ -1407,14 +1485,14 @@ public class NewsFeedPanel extends Composite {
|
|
|
|
|
doShowComments(owner, false);
|
|
|
|
|
owner.updateCommentsNumberCount();
|
|
|
|
|
|
|
|
|
|
// if(owner.isUser()){
|
|
|
|
|
// // alert the User statistics portlet to decrement the number of comments got
|
|
|
|
|
// try {
|
|
|
|
|
// NewsFeed.pageBusAdapter.PageBusPublish(PageBusEvents.commentsDecrement, "", Defaults.STRING_JSONIZER);
|
|
|
|
|
// } catch (PageBusAdapterException ex) {
|
|
|
|
|
// GWT.log(ex.toString());
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// if(owner.isUser()){
|
|
|
|
|
// // alert the User statistics portlet to decrement the number of comments got
|
|
|
|
|
// try {
|
|
|
|
|
// NewsFeed.pageBusAdapter.PageBusPublish(PageBusEvents.commentsDecrement, "", Defaults.STRING_JSONIZER);
|
|
|
|
|
// } catch (PageBusAdapterException ex) {
|
|
|
|
|
// GWT.log(ex.toString());
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
} else
|
|
|
|
|
Window.alert("Comment could not be deleted, please try again in a short while.");
|
|
|
|
|
}
|
|
|
|
@ -1437,23 +1515,23 @@ public class NewsFeedPanel extends Composite {
|
|
|
|
|
toDelete.removeFromParent();
|
|
|
|
|
|
|
|
|
|
if(toDelete.isUser()){
|
|
|
|
|
// try{
|
|
|
|
|
// // alert the User statistics portlet to decrement the number of user's posts
|
|
|
|
|
// NewsFeed.pageBusAdapter.PageBusPublish(PageBusEvents.postDecrement, "", Defaults.STRING_JSONIZER);
|
|
|
|
|
//
|
|
|
|
|
// // alert the same portlet to decrement the number of likes/replies, if any
|
|
|
|
|
// int numComments = toDelete.numberOfComments();
|
|
|
|
|
// int numLikes = toDelete.numberOfLikes();
|
|
|
|
|
//
|
|
|
|
|
// for(int i = 0; i < numComments; i++)
|
|
|
|
|
// NewsFeed.pageBusAdapter.PageBusPublish(PageBusEvents.commentsDecrement, "", Defaults.STRING_JSONIZER);
|
|
|
|
|
//
|
|
|
|
|
// for(int i = 0; i < numLikes; i++)
|
|
|
|
|
// NewsFeed.pageBusAdapter.PageBusPublish(PageBusEvents.likesDecrement, "", Defaults.STRING_JSONIZER);
|
|
|
|
|
//
|
|
|
|
|
// }catch (PageBusAdapterException ex) {
|
|
|
|
|
// GWT.log(ex.toString());
|
|
|
|
|
// }
|
|
|
|
|
// try{
|
|
|
|
|
// // alert the User statistics portlet to decrement the number of user's posts
|
|
|
|
|
// NewsFeed.pageBusAdapter.PageBusPublish(PageBusEvents.postDecrement, "", Defaults.STRING_JSONIZER);
|
|
|
|
|
//
|
|
|
|
|
// // alert the same portlet to decrement the number of likes/replies, if any
|
|
|
|
|
// int numComments = toDelete.numberOfComments();
|
|
|
|
|
// int numLikes = toDelete.numberOfLikes();
|
|
|
|
|
//
|
|
|
|
|
// for(int i = 0; i < numComments; i++)
|
|
|
|
|
// NewsFeed.pageBusAdapter.PageBusPublish(PageBusEvents.commentsDecrement, "", Defaults.STRING_JSONIZER);
|
|
|
|
|
//
|
|
|
|
|
// for(int i = 0; i < numLikes; i++)
|
|
|
|
|
// NewsFeed.pageBusAdapter.PageBusPublish(PageBusEvents.likesDecrement, "", Defaults.STRING_JSONIZER);
|
|
|
|
|
//
|
|
|
|
|
// }catch (PageBusAdapterException ex) {
|
|
|
|
|
// GWT.log(ex.toString());
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
Window.alert("Feed could not be deleted, please try again in a short while.");
|
|
|
|
@ -1467,6 +1545,10 @@ public class NewsFeedPanel extends Composite {
|
|
|
|
|
Window.Location.assign(Window.Location.getHref() + ((Window.Location.getHref().contains("?")) ? "&oid="+feedKey : "?oid="+feedKey));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int getAllUpdatesSize() {
|
|
|
|
|
return allUpdates.size();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* set the filter type status for automatic reloading of tweets
|
|
|
|
|
* @param currentFilter
|
|
|
|
@ -1481,7 +1563,7 @@ public class NewsFeedPanel extends Composite {
|
|
|
|
|
public static String getCurrentScope() {
|
|
|
|
|
return currentScope;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static String extractOrgFriendlyURL(String portalURL) {
|
|
|
|
|
String groupRegEx = "/group/";
|
|
|
|
|
if (portalURL.contains(groupRegEx)) {
|
|
|
|
|