release gCube 3.1

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/news-feed@95402 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2014-05-07 10:31:41 +00:00
parent 4937821396
commit 72a3641e9f
3 changed files with 23 additions and 14 deletions

View File

@ -1,6 +1,6 @@
<ReleaseNotes>
<Changeset component="org.gcube.portlets.user.NewsFeed.1-6-4"
date="2014-04-10">
date="2014-05-07">
<Change>Implemented the automatic scroll back in time for feeds (in
VRE scope)</Change>
<Change>Added possibility to unlike alread liked posts</Change>

View File

@ -75,6 +75,7 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
private static final String SESSION_ADMIN_ATTR = "SESSION_ADMIN_ATTR";
private static final String USER_SETTINGS_ATTR = "USER_SETTINGS_ATTR";
private static final String TEST_USER = "test.user";
/**
*
@ -115,8 +116,8 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
* @return .
*/
public String getDevelopmentUser() {
String user = "test.user";
// user = "massimiliano.assante";
String user = TEST_USER;
//user = "massimiliano.assante";
return user;
}
/**
@ -133,7 +134,15 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
String fullName = username+" FULL";
String thumbnailURL = "images/Avatar_default.png";
if (withinPortal) {
boolean isDevelopment = false;
try {
UserLocalServiceUtil.getService();
}
catch (com.liferay.portal.kernel.bean.BeanLocatorException ex) {
isDevelopment = true;
}
if (username.compareTo(TEST_USER) != 0 && !isDevelopment) {
UserModel user = UserLocalServiceUtil.getUserByScreenName(OrganizationsUtil.getCompany().getCompanyId(), username);
thumbnailURL = "/image/user_male_portrait?img_id="+user.getPortraitId();
fullName = user.getFirstName() + " " + user.getLastName();
@ -154,7 +163,7 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
else {
_log.info("Returning test USER");
CustomConfiguration config = getUserConfiguration();
UserInfo user = new UserInfo(getASLSession().getUsername(), fullName, thumbnailURL, email, "fakeAccountUrl", true, false, null);
UserInfo user = new UserInfo(session.getUsername(), fullName, thumbnailURL, email, "fakeAccountUrl", true, false, null);
return new UserSettings(user, config.getRefreshTime(), session.getScopeName(), config.getVreLabel(), isInfrastructureScope(), config.isShowTimelineSource());
}
@ -470,7 +479,7 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
}
return likeCommitResult;
}
@Override
public boolean unlike(String feedid, String feedText, String feedOwnerId) {
UserInfo user = getUserSettings().getUserInfo();
@ -499,7 +508,7 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
boolean commentCommitResult = false;
_log.trace("Trying to add this comment " + commentText);
UserInfo user = getUserSettings().getUserInfo();
String escapedCommentText = Utils.escapeHtmlAndTransformUrl(commentText);
@ -508,7 +517,7 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
mentionedUsers = getSelectedUserIds(mentionedUserFullNames);
escapedCommentText = Utils.convertMentionPeopleAnchorHTML(escapedCommentText, mentionedUsers);
}
Comment comment = new Comment(UUID.randomUUID().toString(), user.getUsername(),
new Date(), feedid, escapedCommentText, user.getFullName(), user.getAvatarId());
try {
@ -527,16 +536,16 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
boolean result = nm.notifyOwnCommentReply(feedOwnerId, feedid, escapeHtml(commentText));
_log.trace("Comment Notification to post owner added? " + result);
}
//if there are users who liked this post they get notified, asynchronously with this thread
ArrayList<Like> favorites = getAllLikesByFeed(feedid);
Thread likesThread = new Thread(new LikeNotificationsThread(commentText, nm, favorites, feedOwnerId));
likesThread.start();
//notify the other users who commented this post (excluding the ones above)
Thread commentsNotificationthread = new Thread(new CommentNotificationsThread(store, user.getUsername(), comment.getFeedid(), commentText, nm, feedOwnerId, favorites));
commentsNotificationthread.start();
//send the notification to the mentioned users, if any
if (mentionedUsers != null && mentionedUsers.size() > 0) {
Thread thread = new Thread(new MentionNotificationsThread(comment.getFeedid(), commentText, nm, mentionedUsers));
@ -550,7 +559,7 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
public Comment editComment(Comment toEdit) {
UserInfo user = getUserSettings().getUserInfo();
String escapedCommentText = Utils.escapeHtmlAndTransformUrl(toEdit.getText());
Comment edited = new Comment(toEdit.getKey(), toEdit.getUserid(),
new Date(), toEdit.getFeedid(), escapedCommentText, user.getFullName(), user.getAvatarId());
try {
@ -909,7 +918,7 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
}
}

View File

@ -4,7 +4,7 @@
<inherits name='com.google.gwt.user.User' />
<!-- To Comment out -->
<!-- <set-property name="user.agent" value="safari,gecko1_8,ie9" /> -->
<set-property name="user.agent" value="safari,gecko1_8,ie9" />
<!-- Other module inherits -->
<inherits name="net.eliasbalasis.tibcopagebus4gwt.tibcopagebus4gwt" />