Fixed ClientFeed exchange problem between this portlet and the share-updates one on posting.

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/news-feed@122312 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2016-01-19 13:35:27 +00:00
parent 12726771ff
commit f663bfe58b
5 changed files with 56 additions and 39 deletions

View File

@ -4,15 +4,6 @@
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
<dependent-module archiveName="session-checker-0.5.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/session-checker/session-checker">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="pickitem-widget-1.1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/pickitem-widget/pickitem-widget">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="gcube-widgets-1.9.1-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/gcube-widgets/gcube-widgets">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>
<property name="context-root" value="news-feed"/>
</wb-module>

View File

@ -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<Attachment> attachments = cFeed.getAttachments() == null ? null : new ArrayList<Attachment>(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

View File

@ -141,12 +141,14 @@ public class TweetTemplate extends Composite {
} else {
closeImage.removeFromParent();
}
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");