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:
parent
4937821396
commit
72a3641e9f
|
@ -1,6 +1,6 @@
|
||||||
<ReleaseNotes>
|
<ReleaseNotes>
|
||||||
<Changeset component="org.gcube.portlets.user.NewsFeed.1-6-4"
|
<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
|
<Change>Implemented the automatic scroll back in time for feeds (in
|
||||||
VRE scope)</Change>
|
VRE scope)</Change>
|
||||||
<Change>Added possibility to unlike alread liked posts</Change>
|
<Change>Added possibility to unlike alread liked posts</Change>
|
||||||
|
|
|
@ -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 SESSION_ADMIN_ATTR = "SESSION_ADMIN_ATTR";
|
||||||
private static final String USER_SETTINGS_ATTR = "USER_SETTINGS_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 .
|
* @return .
|
||||||
*/
|
*/
|
||||||
public String getDevelopmentUser() {
|
public String getDevelopmentUser() {
|
||||||
String user = "test.user";
|
String user = TEST_USER;
|
||||||
// user = "massimiliano.assante";
|
//user = "massimiliano.assante";
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -133,7 +134,15 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
|
||||||
String fullName = username+" FULL";
|
String fullName = username+" FULL";
|
||||||
String thumbnailURL = "images/Avatar_default.png";
|
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);
|
UserModel user = UserLocalServiceUtil.getUserByScreenName(OrganizationsUtil.getCompany().getCompanyId(), username);
|
||||||
thumbnailURL = "/image/user_male_portrait?img_id="+user.getPortraitId();
|
thumbnailURL = "/image/user_male_portrait?img_id="+user.getPortraitId();
|
||||||
fullName = user.getFirstName() + " " + user.getLastName();
|
fullName = user.getFirstName() + " " + user.getLastName();
|
||||||
|
@ -154,7 +163,7 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
|
||||||
else {
|
else {
|
||||||
_log.info("Returning test USER");
|
_log.info("Returning test USER");
|
||||||
CustomConfiguration config = getUserConfiguration();
|
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());
|
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;
|
return likeCommitResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean unlike(String feedid, String feedText, String feedOwnerId) {
|
public boolean unlike(String feedid, String feedText, String feedOwnerId) {
|
||||||
UserInfo user = getUserSettings().getUserInfo();
|
UserInfo user = getUserSettings().getUserInfo();
|
||||||
|
@ -499,7 +508,7 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
|
||||||
boolean commentCommitResult = false;
|
boolean commentCommitResult = false;
|
||||||
_log.trace("Trying to add this comment " + commentText);
|
_log.trace("Trying to add this comment " + commentText);
|
||||||
UserInfo user = getUserSettings().getUserInfo();
|
UserInfo user = getUserSettings().getUserInfo();
|
||||||
|
|
||||||
|
|
||||||
String escapedCommentText = Utils.escapeHtmlAndTransformUrl(commentText);
|
String escapedCommentText = Utils.escapeHtmlAndTransformUrl(commentText);
|
||||||
|
|
||||||
|
@ -508,7 +517,7 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
|
||||||
mentionedUsers = getSelectedUserIds(mentionedUserFullNames);
|
mentionedUsers = getSelectedUserIds(mentionedUserFullNames);
|
||||||
escapedCommentText = Utils.convertMentionPeopleAnchorHTML(escapedCommentText, mentionedUsers);
|
escapedCommentText = Utils.convertMentionPeopleAnchorHTML(escapedCommentText, mentionedUsers);
|
||||||
}
|
}
|
||||||
|
|
||||||
Comment comment = new Comment(UUID.randomUUID().toString(), user.getUsername(),
|
Comment comment = new Comment(UUID.randomUUID().toString(), user.getUsername(),
|
||||||
new Date(), feedid, escapedCommentText, user.getFullName(), user.getAvatarId());
|
new Date(), feedid, escapedCommentText, user.getFullName(), user.getAvatarId());
|
||||||
try {
|
try {
|
||||||
|
@ -527,16 +536,16 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
|
||||||
boolean result = nm.notifyOwnCommentReply(feedOwnerId, feedid, escapeHtml(commentText));
|
boolean result = nm.notifyOwnCommentReply(feedOwnerId, feedid, escapeHtml(commentText));
|
||||||
_log.trace("Comment Notification to post owner added? " + result);
|
_log.trace("Comment Notification to post owner added? " + result);
|
||||||
}
|
}
|
||||||
|
|
||||||
//if there are users who liked this post they get notified, asynchronously with this thread
|
//if there are users who liked this post they get notified, asynchronously with this thread
|
||||||
ArrayList<Like> favorites = getAllLikesByFeed(feedid);
|
ArrayList<Like> favorites = getAllLikesByFeed(feedid);
|
||||||
Thread likesThread = new Thread(new LikeNotificationsThread(commentText, nm, favorites, feedOwnerId));
|
Thread likesThread = new Thread(new LikeNotificationsThread(commentText, nm, favorites, feedOwnerId));
|
||||||
likesThread.start();
|
likesThread.start();
|
||||||
|
|
||||||
//notify the other users who commented this post (excluding the ones above)
|
//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));
|
Thread commentsNotificationthread = new Thread(new CommentNotificationsThread(store, user.getUsername(), comment.getFeedid(), commentText, nm, feedOwnerId, favorites));
|
||||||
commentsNotificationthread.start();
|
commentsNotificationthread.start();
|
||||||
|
|
||||||
//send the notification to the mentioned users, if any
|
//send the notification to the mentioned users, if any
|
||||||
if (mentionedUsers != null && mentionedUsers.size() > 0) {
|
if (mentionedUsers != null && mentionedUsers.size() > 0) {
|
||||||
Thread thread = new Thread(new MentionNotificationsThread(comment.getFeedid(), commentText, nm, mentionedUsers));
|
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) {
|
public Comment editComment(Comment toEdit) {
|
||||||
UserInfo user = getUserSettings().getUserInfo();
|
UserInfo user = getUserSettings().getUserInfo();
|
||||||
String escapedCommentText = Utils.escapeHtmlAndTransformUrl(toEdit.getText());
|
String escapedCommentText = Utils.escapeHtmlAndTransformUrl(toEdit.getText());
|
||||||
|
|
||||||
Comment edited = new Comment(toEdit.getKey(), toEdit.getUserid(),
|
Comment edited = new Comment(toEdit.getKey(), toEdit.getUserid(),
|
||||||
new Date(), toEdit.getFeedid(), escapedCommentText, user.getFullName(), user.getAvatarId());
|
new Date(), toEdit.getFeedid(), escapedCommentText, user.getFullName(), user.getAvatarId());
|
||||||
try {
|
try {
|
||||||
|
@ -909,7 +918,7 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<inherits name='com.google.gwt.user.User' />
|
<inherits name='com.google.gwt.user.User' />
|
||||||
|
|
||||||
<!-- To Comment out -->
|
<!-- 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 -->
|
<!-- Other module inherits -->
|
||||||
<inherits name="net.eliasbalasis.tibcopagebus4gwt.tibcopagebus4gwt" />
|
<inherits name="net.eliasbalasis.tibcopagebus4gwt.tibcopagebus4gwt" />
|
||||||
|
|
Loading…
Reference in New Issue