Bug fix and update to handle the new ClientFeed class

git-svn-id: https://svn.research-infrastructures.eu/d4science/gcube/trunk/portlets/user/share-updates@122276 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2016-01-18 09:26:36 +00:00
parent 97f39a4ee4
commit 1cae9150af
2 changed files with 23 additions and 20 deletions

View File

@ -367,7 +367,9 @@ public class ShareUpdateForm extends Composite {
if(numberOfAttachmentsUploaded() > 0){
postContent = PostContent.TEXT_AND_ATTACHMENTS;
toShare = NO_TEXT_FILE_SHARE;
if(toShare.equals(""))
toShare = NO_TEXT_FILE_SHARE;
}
}
@ -487,15 +489,12 @@ public class ShareUpdateForm extends Composite {
file.getFormat()));
}
// share the post
shareupdateService.sharePostWithAttachments(toShareText, FeedType.TWEET, getPrivacyLevel(), vreId, uploadedFiles, mentionedUsers, notifyGroup, saveInWorkspaceCheckbox.getValue(), new AsyncCallback<ClientFeed>() {
@Override
public void onSuccess(ClientFeed result) {
GWT.log("OK");
submitButton.setEnabled(true);
shareTextArea.setEnabled(true);
@ -523,7 +522,7 @@ public class ShareUpdateForm extends Composite {
@Override
public void onFailure(Throwable caught) {
GWT.log(caught.toString());
submitButton.setEnabled(true);
@ -957,7 +956,7 @@ public class ShareUpdateForm extends Composite {
});
}-*/;
/**
* Check if DND could be enabled (i.e, it's supported by the browser)

View File

@ -149,8 +149,8 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
public ClientFeed sharePostWithLinkPreview(String postText, FeedType feedType, PrivacyLevel pLevel,
String vreId, LinkPreview preview, String urlThumbnail, ArrayList<String> mentionedUserFullNames, boolean notifyGroup) {
_log.debug("Writing a new post with text " + postText);
_log.debug("Writing a new post with text " + postText);
// escape text
String escapedFeedText = TextTransfromUtils.escapeHtmlAndTransformUrl(postText);
@ -243,7 +243,7 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
//everything went fine
ClientFeed cf = new ClientFeed(toShare.getKey(), toShare.getType().toString(), username, feedDate, toShare.getUri(),
TextTransfromUtils.replaceAmpersand(toShare.getDescription()), fullName, email, thumbnailAvatarURL, toShare.getLinkTitle(), toShare.getLinkDescription(),
toShare.getUriThumbnail(), toShare.getLinkHost());
toShare.getUriThumbnail(), toShare.getLinkHost(), null);
//send the notification about this posts to everyone in the group if notifyGroup is true
@ -277,6 +277,8 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
PrivacyLevel pLevel, String vreId, ArrayList<UploadedFile> uploadedFiles,
ArrayList<String> mentionedUserFullNames, boolean notifyGroup, boolean saveCopyWokspace) {
_log.debug("Incoming text is " + feedText);
// escape text
String escapedFeedText = TextTransfromUtils.escapeHtmlAndTransformUrl(feedText);
@ -321,7 +323,7 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
firstAttachmentDescription = "",
firstAttachmentFormat = "",
firstAttachmentDownloadUrl = "",
firstAttachmenturlThumbnail = "";
firstAttachmenturlThumbnail = "null";
if(uploadedFiles.size() > 0){
@ -332,7 +334,7 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
firstAttachmentDescription = firstAttachment.getDescription();
firstAttachmentFormat = firstAttachment.getFormat();
firstAttachmentDownloadUrl = firstAttachment.getDownloadUrl();
firstAttachmenturlThumbnail = firstAttachment.getThumbnailUrl();
firstAttachmenturlThumbnail = firstAttachment.getThumbnailUrl() != null ? firstAttachment.getThumbnailUrl() : "null";
if(uploadedFiles.size() > 1){
@ -430,10 +432,12 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
}
if (!result) return null;
_log.debug("Saved feed text is " + toShare.getDescription());
//everything went fine
ClientFeed cf = new ClientFeed(toShare.getKey(), toShare.getType().toString(), username, feedDate, toShare.getUri(),
TextTransfromUtils.replaceAmpersand(toShare.getDescription()), fullName, email, thumbnailAvatarURL, toShare.getLinkTitle(), toShare.getLinkDescription(),
toShare.getUriThumbnail(), toShare.getLinkHost());
toShare.getUriThumbnail(), toShare.getLinkHost(), attachments);
//send the notification about this posts to everyone in the group if notifyGroup is true
@ -537,14 +541,14 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
String httpURL = "";
String smpURI = "";
//if (isWithinPortal()) {
//get the url to show, before actually uploading it
smpURI = "http://ciccio.com";//storageClient.getUrl(true).RFile(remoteFilePath);
if (isWithinPortal()) {
//get the url to show, before actually uploading it
smpURI = storageClient.getUrl(true).RFile(remoteFilePath); //"http://ciccio.com";
//The storage uploader Thread starts here asyncronously
//Thread thread = new Thread(new UploadToStorageThread(storageClient, fileName, fileabsolutePathOnServer, remoteFilePath));
//thread.start();
//}
//The storage uploader Thread starts here asyncronously
Thread thread = new Thread(new UploadToStorageThread(storageClient, fileName, fileabsolutePathOnServer, remoteFilePath));
thread.start();
}
try {
String mimeType = FilePreviewer.getMimeType(new File(fileabsolutePathOnServer), fileName);