integrated session expiration popup
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/news-feed@94085 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
3cacb91ead
commit
ff5badd29f
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/news-feed-1.6.3-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||
<classpathentry kind="src" output="target/news-feed-1.6.4-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
|
@ -31,5 +31,5 @@
|
|||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/news-feed-1.6.3-SNAPSHOT/WEB-INF/classes"/>
|
||||
<classpathentry kind="output" path="target/news-feed-1.6.4-SNAPSHOT/WEB-INF/classes"/>
|
||||
</classpath>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
eclipse.preferences.version=1
|
||||
jarsExcludedFromWebInfLib=
|
||||
lastWarOutDir=/Users/massi/Documents/workspace/news-feed/target/news-feed-1.6.3-SNAPSHOT
|
||||
lastWarOutDir=/Users/massi/Documents/workspace/news-feed/target/news-feed-1.6.4-SNAPSHOT
|
||||
warSrcDir=src/main/webapp
|
||||
warSrcDirIsOutput=false
|
||||
|
|
|
@ -1,4 +1,11 @@
|
|||
<ReleaseNotes>
|
||||
<Changeset component="org.gcube.portlets.user.NewsFeed.1-6-3"
|
||||
date="2014-04-02">
|
||||
<Change>Implemented the autmoatic scroll back in time for feeds</Change>
|
||||
<Change>Fixed double notifications for post owner who commented his post</Change>
|
||||
<Change>Fixed double notifications for post owner who liked his post</Change>
|
||||
<Change>Added session checking popup</Change>
|
||||
</Changeset>
|
||||
<Changeset component="org.gcube.portlets.user.NewsFeed.1-5-0"
|
||||
date="2014-02-13">
|
||||
<Change>Moved to Java7</Change>
|
||||
|
|
9
pom.xml
9
pom.xml
|
@ -13,7 +13,7 @@
|
|||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>news-feed</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<version>1.6.3-SNAPSHOT</version>
|
||||
<version>1.6.4-SNAPSHOT</version>
|
||||
|
||||
<name>gCube News Feed Portlet</name>
|
||||
<description>
|
||||
|
@ -75,7 +75,12 @@
|
|||
<dependency>
|
||||
<groupId>org.gcube.applicationsupportlayer</groupId>
|
||||
<artifactId>accesslogger</artifactId>
|
||||
</dependency>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.widgets</groupId>
|
||||
<artifactId>session-checker</artifactId>
|
||||
<version>[0.2.0-SNAPSHOT, 1.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.applicationsupportlayer</groupId>
|
||||
<artifactId>aslsocial</artifactId>
|
||||
|
|
|
@ -43,6 +43,7 @@ import org.gcube.portlets.user.newsfeed.client.templates.TweetTemplate;
|
|||
import org.gcube.portlets.user.newsfeed.shared.EnhancedFeed;
|
||||
import org.gcube.portlets.user.newsfeed.shared.MoreFeedsBean;
|
||||
import org.gcube.portlets.user.newsfeed.shared.UserSettings;
|
||||
import org.gcube.portlets.widgets.sessionchecker.client.CheckSession;
|
||||
import org.gcube.portlets.widgets.userselection.client.UserSelectionDialog;
|
||||
import org.gcube.portlets.widgets.userselection.client.events.SelectedUserEvent;
|
||||
import org.gcube.portlets.widgets.userselection.client.events.SelectedUserEventHandler;
|
||||
|
@ -250,7 +251,7 @@ public class NewsFeedPanel extends Composite {
|
|||
currentScope = result.getCurrentScope();
|
||||
if (result.getUserInfo().getUsername().equals("test.user")) {
|
||||
doStopFeedsTimer();
|
||||
Window.alert("Your Session Expired, please logout and login again");
|
||||
doShowSessionExpired();
|
||||
}
|
||||
else {
|
||||
if (getFeedToShowId() != null) {
|
||||
|
@ -366,7 +367,7 @@ public class NewsFeedPanel extends Composite {
|
|||
public void onSuccess(UserSettings result) {
|
||||
if (result.getUserInfo().getUsername().equals("test.user")) {
|
||||
doStopFeedsTimer();
|
||||
Window.alert("Your Session Expired, please logout and login again");
|
||||
doShowSessionExpired();
|
||||
}
|
||||
/**
|
||||
* this check avoids the 2 tabs open in 2 different scope, if the previous tab was open at VRE Level and then antoher
|
||||
|
@ -753,6 +754,18 @@ public class NewsFeedPanel extends Composite {
|
|||
});
|
||||
}
|
||||
|
||||
private void doShowSessionExpired() {
|
||||
GWT.runAsync(UserSelectionDialog.class, new RunAsyncCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
CheckSession.showLogoutDialog();
|
||||
}
|
||||
public void onFailure(Throwable reason) {
|
||||
Window.alert("Could not load this component: " + reason.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void doShowLikes(final String feedId) {
|
||||
GWT.runAsync(UserSelectionDialog.class, new RunAsyncCallback() {
|
||||
@Override
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
package org.gcube.portlets.user.newsfeed.server;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.applicationsupportlayer.social.NotificationsManager;
|
||||
import org.gcube.portal.databook.server.DatabookStore;
|
||||
import org.gcube.portal.databook.shared.Comment;
|
||||
import org.gcube.portal.databook.shared.Like;
|
||||
import org.gcube.vomanagement.usermanagement.UserManager;
|
||||
import org.gcube.vomanagement.usermanagement.impl.liferay.LiferayUserManager;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -26,15 +28,19 @@ public class CommentNotificationsThread implements Runnable {
|
|||
private String feedOwnerId;
|
||||
private NotificationsManager nm;
|
||||
private HashSet<String> userIdsToNotify;
|
||||
//needed to avoid sending notification twice (the user who favorited gets the notification anyways)
|
||||
private ArrayList<Like> favorites;
|
||||
|
||||
|
||||
public CommentNotificationsThread(DatabookStore storeInstance, String commenterUserId, String commentedFeedId, String commentText, NotificationsManager nm, String feedOwnerId) {
|
||||
public CommentNotificationsThread(DatabookStore storeInstance, String commenterUserId,
|
||||
String commentedFeedId, String commentText, NotificationsManager nm, String feedOwnerId, ArrayList<Like> favorites) {
|
||||
super();
|
||||
this.nm = nm;
|
||||
this.commenterUserId = commenterUserId;
|
||||
this.commentedFeedId = commentedFeedId;
|
||||
this.commentText = commentText;
|
||||
this.feedOwnerId = feedOwnerId;
|
||||
this.favorites = favorites;
|
||||
|
||||
userIdsToNotify = new HashSet<String>();
|
||||
List<Comment> feedComments = storeInstance.getAllCommentByFeed(commentedFeedId);
|
||||
|
@ -50,17 +56,25 @@ public class CommentNotificationsThread implements Runnable {
|
|||
|
||||
@Override
|
||||
public void run() {
|
||||
String feedOwnerFullName = "";
|
||||
String feedOwnerFullName = "";
|
||||
UserManager um = new LiferayUserManager();
|
||||
try {
|
||||
feedOwnerFullName = um.getUserByScreenName(feedOwnerId).getFullname();
|
||||
} catch (Exception e) {
|
||||
feedOwnerFullName = feedOwnerId;
|
||||
}
|
||||
//get the list of userid who liked the post
|
||||
ArrayList<String> favoriteUserIds = new ArrayList<>();
|
||||
for (Like favorite : favorites) {
|
||||
favoriteUserIds.add(favorite.getUserid());
|
||||
}
|
||||
|
||||
if (userIdsToNotify != null) {
|
||||
for (String userId : userIdsToNotify) {
|
||||
boolean result = nm.notifyCommentReply(userId, commentedFeedId, commentText, feedOwnerFullName);
|
||||
_log.trace("Sending Notification for also commented to: " + feedOwnerFullName + " result?"+ result);
|
||||
for (String userId : userIdsToNotify) {
|
||||
if (userId.compareTo(feedOwnerId) != 0 && !(favoriteUserIds.contains(userId)) ) { //avoid notifying the owner and the user who liked twice
|
||||
boolean result = nm.notifyCommentReply(userId, commentedFeedId, commentText, feedOwnerFullName);
|
||||
_log.trace("Sending Notification for also commented to: " + feedOwnerFullName + " result?"+ result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,10 +18,12 @@ public class LikeNotificationsThread implements Runnable {
|
|||
|
||||
private NotificationsManager nm;
|
||||
private ArrayList<Like> likes;
|
||||
|
||||
|
||||
public LikeNotificationsThread(String commentText, NotificationsManager nm, ArrayList<Like> likes) {
|
||||
private String feedOwnerId;
|
||||
|
||||
|
||||
public LikeNotificationsThread(String commentText, NotificationsManager nm, ArrayList<Like> likes, String feedOwnerId) {
|
||||
super();
|
||||
this.feedOwnerId = feedOwnerId;
|
||||
this.commentText = commentText;
|
||||
this.nm = nm;
|
||||
this.likes = likes;
|
||||
|
@ -30,11 +32,13 @@ public class LikeNotificationsThread implements Runnable {
|
|||
@Override
|
||||
public void run() {
|
||||
for (Like fav : likes) {
|
||||
boolean result = nm.notifyCommentOnFavorite(fav.getUserid(), fav.getFeedid(), commentText);
|
||||
_log.trace("Sending Notification for favorited post comment added to: " + fav.getFullName() + " result?"+ result);
|
||||
if (fav.getUserid().compareTo(feedOwnerId) != 0) { //avoid notifying the owner twice (if the post owner commented he gets the notification regardless)
|
||||
boolean result = nm.notifyCommentOnFavorite(fav.getUserid(), fav.getFeedid(), commentText);
|
||||
_log.trace("Sending Notification for favorited post comment added to: " + fav.getFullName() + " result?"+ result);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -491,13 +491,15 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
|
|||
boolean result = nm.notifyOwnCommentReply(feedOwnerId, feedid, escapeHtml(commentText));
|
||||
_log.trace("Comment Notification to post owner added? " + result);
|
||||
}
|
||||
//notify the other users who commented this post
|
||||
Thread commentsNotificationthread = new Thread(new CommentNotificationsThread(store, user.getUsername(), comment.getFeedid(), commentText, nm, feedOwnerId));
|
||||
commentsNotificationthread.start();
|
||||
|
||||
//if there are other users who liked this post they get notified too, asynchronously with this thread
|
||||
Thread likesThread = new Thread(new LikeNotificationsThread(commentText, nm, getAllLikesByFeed(feedid)));
|
||||
|
||||
//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();
|
||||
}
|
||||
return comment;
|
||||
}
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
<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" />
|
||||
<inherits name="org.jsonmaker.gwt.Gwt_jsonmaker" />
|
||||
|
@ -15,6 +15,7 @@
|
|||
<inherits name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' />
|
||||
<inherits name='org.gcube.portlets.widgets.wsmail.WsMail_Widget' />
|
||||
<inherits name='org.gcube.portlets.widgets.userselection.UserSelection' />
|
||||
<inherits name='org.gcube.portlets.widgets.sessionchecker.SessionChecker' />
|
||||
<inherits
|
||||
name='org.gcube.portlets.widgets.lighttree.WorkspacePortletLightTree' />
|
||||
<inherits name='org.gcube.portal.databook.GCubeSocialNetworking' />
|
||||
|
|
|
@ -9,13 +9,10 @@ table {
|
|||
margin: 0 0 10px;
|
||||
padding: 10px;
|
||||
margin: 0px 5px;
|
||||
|
||||
background: #FFF url(images/vre_bg_gray.png) repeat-x left bottom;
|
||||
|
||||
border-radius: 6px !important;
|
||||
-moz-border-radius: 6px !important;
|
||||
-webkit-border-radius: 6px !important;
|
||||
|
||||
-moz-border-radius: 6px !important;
|
||||
-webkit-border-radius: 6px !important;
|
||||
border: 1px solid #DBDBDB;
|
||||
}
|
||||
|
||||
|
@ -253,7 +250,7 @@ table {
|
|||
}
|
||||
|
||||
.openImage:hover {
|
||||
background: url(images/open-sep.png) 0px -14px no-repeat;
|
||||
background: url(images/open-sep.png) 0px -14px no-repeat;
|
||||
cursor: pointer;
|
||||
cursor: hand;
|
||||
}
|
||||
|
@ -358,7 +355,14 @@ a.person-link:hover {
|
|||
font-size: 14px;
|
||||
line-height: 18px;
|
||||
color: #333;
|
||||
word-break:break-all;
|
||||
width: 500px;
|
||||
word-wrap: break-word;
|
||||
-ms-word-break: break-all;
|
||||
/* Non standard for webkit */
|
||||
word-break: break-word;
|
||||
-webkit-hyphens: auto;
|
||||
-moz-hyphens: auto;
|
||||
hyphens: auto;
|
||||
}
|
||||
|
||||
.tweet-separator {
|
||||
|
|
Loading…
Reference in New Issue