Fixed bug that was allowing to like posts even if the user had the session expired.

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/news-feed@98805 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2014-07-18 14:57:40 +00:00
parent c77bcc84e1
commit 9b2ca36a5d
3 changed files with 19 additions and 2 deletions

View File

@ -1,4 +1,8 @@
<ReleaseNotes> <ReleaseNotes>
<Changeset component="org.gcube.portlets.user.NewsFeed.1-7-1"
date="2014-06-04">
Fixed bug that was allowing to like posts even if the user had the session expired.
</Changeset>
<Changeset component="org.gcube.portlets.user.NewsFeed.1-7-0" <Changeset component="org.gcube.portlets.user.NewsFeed.1-7-0"
date="2014-06-04"> date="2014-06-04">
Fixed bug loosing session when messaging user from the news feed Fixed bug loosing session when messaging user from the news feed

View File

@ -766,7 +766,11 @@ public class NewsFeedPanel extends Composite {
@Override @Override
public void onFailure(Throwable caught) {} public void onFailure(Throwable caught) {}
@Override @Override
public void onSuccess(Boolean result) { } public void onSuccess(Boolean result) {
if (!result) {
doShowSessionExpired();
}
}
}); });
} }
@ -775,7 +779,11 @@ public class NewsFeedPanel extends Composite {
@Override @Override
public void onFailure(Throwable caught) {} public void onFailure(Throwable caught) {}
@Override @Override
public void onSuccess(Boolean result) { } public void onSuccess(Boolean result) {
if (!result) {
doShowSessionExpired();
}
}
}); });
} }

View File

@ -459,6 +459,11 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
public boolean like(String feedid, String feedText, String feedOwnerId) { public boolean like(String feedid, String feedText, String feedOwnerId) {
boolean likeCommitResult = false; boolean likeCommitResult = false;
UserInfo user = getUserSettings().getUserInfo(); UserInfo user = getUserSettings().getUserInfo();
if (user.getUsername().compareTo(TEST_USER) == 0) {
return false;
}
Like toLike = new Like(UUID.randomUUID().toString(), user.getUsername(), Like toLike = new Like(UUID.randomUUID().toString(), user.getUsername(),
new Date(), feedid, user.getFullName(), user.getAvatarId()); new Date(), feedid, user.getFullName(), user.getAvatarId());
try { try {