diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component
index 8f4b759..7d33a49 100644
--- a/.settings/org.eclipse.wst.common.component
+++ b/.settings/org.eclipse.wst.common.component
@@ -4,15 +4,6 @@
-
- uses
-
-
- uses
-
-
- uses
-
diff --git a/src/main/java/org/gcube/portlets/user/newsfeed/client/panels/NewsFeedPanel.java b/src/main/java/org/gcube/portlets/user/newsfeed/client/panels/NewsFeedPanel.java
index ff0647b..4125846 100644
--- a/src/main/java/org/gcube/portlets/user/newsfeed/client/panels/NewsFeedPanel.java
+++ b/src/main/java/org/gcube/portlets/user/newsfeed/client/panels/NewsFeedPanel.java
@@ -6,6 +6,7 @@ import java.util.HashSet;
import org.gcube.portal.databook.client.GCubeSocialNetworking;
import org.gcube.portal.databook.client.util.Encoder;
+import org.gcube.portal.databook.shared.Attachment;
import org.gcube.portal.databook.shared.ClientFeed;
import org.gcube.portal.databook.shared.Comment;
import org.gcube.portal.databook.shared.Feed;
@@ -562,11 +563,33 @@ public class NewsFeedPanel extends Composite {
* @param description
*/
public void addJustAddedFeed(ClientFeed cFeed) {
- Feed feed = new Feed(cFeed.getKey(), FeedType.SHARE, cFeed.getUserid(), cFeed.getTime(), "", cFeed.getUri(), cFeed.getLinkUrlThumbnail(),
- cFeed.getDescription(), PrivacyLevel.CONNECTION, cFeed.getFullName(),
- cFeed.getEmail(), cFeed.getThumbnailURL(), cFeed.getLinkTitle(), cFeed.getLinkDescription(), cFeed.getLinkHost());
+
+ Feed feed = new Feed(cFeed.getKey(),
+ FeedType.SHARE,
+ cFeed.getUserid(),
+ cFeed.getTime(),
+ "",
+ cFeed.getUri(),
+ cFeed.getLinkUrlThumbnail(),
+ cFeed.getDescription(),
+ PrivacyLevel.CONNECTION,
+ cFeed.getFullName(),
+ cFeed.getEmail(),
+ cFeed.getThumbnailURL(),
+ cFeed.getLinkTitle(),
+ cFeed.getLinkDescription(),
+ cFeed.getLinkHost());
+
+ // set attachments property
+ boolean multiAttachments = cFeed.getAttachments() != null;
+ feed.setMultiFileUpload(multiAttachments);
+
EnhancedFeed toAdd = new EnhancedFeed(feed, false, true); //false cuz he could not have liked this yet and true because is the current user's
+ // be careful when converting from List<> to ArrayList<> ...
+ ArrayList attachments = cFeed.getAttachments() == null ? null : new ArrayList(cFeed.getAttachments());
+ toAdd.setAttachments(attachments);
+
final TweetTemplate tt = new TweetTemplate(myUserInfo, toAdd, eventBus, true);
if (isFirstTweet) {
newsPanel.clear();
@@ -574,6 +597,7 @@ public class NewsFeedPanel extends Composite {
isFirstTweet = false;
}
newsPanel.insert(tt, 0);
+
Timer t = new Timer() {
@Override
diff --git a/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/TweetTemplate.java b/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/TweetTemplate.java
index 6ed2e7b..d5daff8 100644
--- a/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/TweetTemplate.java
+++ b/src/main/java/org/gcube/portlets/user/newsfeed/client/ui/TweetTemplate.java
@@ -70,7 +70,7 @@ public class TweetTemplate extends Composite {
private int totalComments = 0;
private HTML showAllComments = new HTML();
private boolean isAppFeed = false;
-
+
private TweetTemplate myInstance;
/**
@@ -141,13 +141,15 @@ public class TweetTemplate extends Composite {
} else {
closeImage.removeFromParent();
}
- GWT.log("# attachments: "+myFeed.getAttachments().size());
- if (myFeed.getAttachments().size() > 0) {
- for (Attachment a : myFeed.getAttachments()) {
- GWT.log(a.toString());
+ if(myFeed.getAttachments() != null){
+ GWT.log("# attachments: "+myFeed.getAttachments().size());
+ if (myFeed.getAttachments().size() > 0) {
+ for (Attachment a : myFeed.getAttachments()) {
+ GWT.log(a.toString());
+ }
}
}
-
+
openImage.setStyleName("openImage");
openImage.setTitle("Open this feed separately");
//show if the user has already liked this or not
@@ -157,7 +159,7 @@ public class TweetTemplate extends Composite {
String feedText = feed.getDescription();
String descWithoutHTML = new HTML(feedText).getText();
-
+
if ( (! feedText.startsWith(" MAX_SHOWTEXT_LENGTH && !displaySingle) {
final int TEXT_TO_SHOW_LENGHT = (descWithoutHTML.length() < 500) ? (feedText.length() - (feedText.length() / 3)) : 500;
feedText = feedText.substring(0, TEXT_TO_SHOW_LENGHT) + "...";
@@ -461,35 +463,35 @@ public class TweetTemplate extends Composite {
}
public void addComment(SingleComment comment) {
-
+
commentsPanel.add(comment);
myComments.add(comment);
-
+
}
-
+
public void updateSingleComment(Comment edited, HTMLPanel commentPanel){
-
+
commentPanel.clear();
SingleComment sc = new SingleComment(edited, this, true);
commentPanel.add(sc);
-
+
// replace the new SingleComment in the list
int index = 0;
Iterator iterator = this.myComments.iterator();
-
+
for (;iterator.hasNext();) {
SingleComment singleComment = (SingleComment) iterator.next();
-
+
if(singleComment.getCommentKey().equals(edited.getKey())){
-
+
iterator.remove();
this.myComments.add(index, sc);
break;
-
+
}
index ++;
}
-
+
}
public void clearComments() {
diff --git a/src/main/java/org/gcube/portlets/user/newsfeed/server/NewsServiceImpl.java b/src/main/java/org/gcube/portlets/user/newsfeed/server/NewsServiceImpl.java
index a986928..cda43b9 100644
--- a/src/main/java/org/gcube/portlets/user/newsfeed/server/NewsServiceImpl.java
+++ b/src/main/java/org/gcube/portlets/user/newsfeed/server/NewsServiceImpl.java
@@ -84,9 +84,9 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
private static final String USER_SETTINGS_ATTR = "USER_SETTINGS_ATTR";
public static final String TEST_SCOPE = "/gcube/devsec/devVRE";
-
+
private String APP_ID;
-
+
/**
*
@@ -124,7 +124,7 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
*/
public String getDevelopmentUser() {
String user = NewsConstants.TEST_USER;
-// user = "andrea.rossi";
+ // user = "andrea.rossi";
return user;
}
/**
@@ -611,7 +611,7 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
boolean commentCommitResult = false;
_log.trace("Trying to add this comment " + commentText);
UserInfo user = getUserSettings().getUserInfo();
-
+
if (user.getUsername().compareTo(NewsConstants.TEST_USER) == 0) {
return new OperationResult(false, "Session Expired", null);
}
@@ -621,7 +621,7 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
//copy the set into a list
ArrayList mentionedUserFullNamesList = new ArrayList();
mentionedUserFullNamesList.addAll(mentionedUserFullNames);
-
+
ArrayList mentionedUsers = null;
if (mentionedUserFullNames != null && ! mentionedUserFullNames.isEmpty()) {
mentionedUsers = getSelectedUserIds(mentionedUserFullNamesList);
@@ -675,7 +675,7 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
if (user.getUsername().compareTo(NewsConstants.TEST_USER) == 0) {
return new OperationResult(false, "Session Expired", null);
}
-
+
String escapedCommentText = Utils.escapeHtmlAndTransformUrl(toEdit.getText());
Comment edited = new Comment(toEdit.getKey(), toEdit.getUserid(),
@@ -704,7 +704,7 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
ArrayList likedFeeds = (ArrayList) store.getAllLikedFeedIdsByUser(getASLSession().getUsername());
boolean skip = false;
for (Feed feed : toEnhance) {
-
+
boolean isMultiFileUpload = feed.isMultiFileUpload();
ArrayList attachments = new ArrayList();
if (isMultiFileUpload) {
@@ -714,7 +714,7 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
_log.error("It looks like sth wrong with this feedid having attachments, could not find feedId = " + feed.getKey() + "\n" + e.getMessage());
}
}
-
+
skip = false;
if (! feed.isApplicationFeed()) {
String thumb = getUserImagePortraitUrlLocal(feed.getEntityId());
diff --git a/src/main/resources/org/gcube/portlets/user/newsfeed/NewsFeed.gwt.xml b/src/main/resources/org/gcube/portlets/user/newsfeed/NewsFeed.gwt.xml
index 050aee5..ed67b14 100644
--- a/src/main/resources/org/gcube/portlets/user/newsfeed/NewsFeed.gwt.xml
+++ b/src/main/resources/org/gcube/portlets/user/newsfeed/NewsFeed.gwt.xml
@@ -4,14 +4,14 @@
-
+
-
+