made notification to members option configurable as default, see Feature #121

git-svn-id: https://svn.research-infrastructures.eu/d4science/gcube/trunk/portlets/user/share-updates@117041 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2015-07-06 15:12:40 +00:00
parent 162ea4e2be
commit e85191a73b
1 changed files with 6 additions and 5 deletions

View File

@ -82,6 +82,7 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
private static final String STORAGE_OWNER = "gCubeSocialFramework";
public static final String UPLOAD_DIR = "/social-framework-uploads";
private static final String NEWS_FEED_PORTLET_CLASSNAME = "org.gcube.portlets.user.newsfeed.server.NewsServiceImpl";
private final static String ATTR_TO_CHECK = "Postnotificationviaemail";
/**
*
*/
@ -276,7 +277,7 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
if (isWithinPortal() && username.compareTo(TEST_USER) != 0) {
long companyId = OrganizationsUtil.getCompany().getCompanyId();
com.liferay.portal.model.UserModel user = UserLocalServiceUtil.getUserByScreenName(companyId, username);
Organization currOrg = OrganizationLocalServiceUtil.getOrganization(session.getGroupId());
thumbnailURL = "/image/user_male_portrait?img_id="+user.getPortraitId();
fullName = user.getFirstName() + " " + user.getLastName();
email = user.getEmailAddress();
@ -287,7 +288,7 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
UserInfo userInfo = new UserInfo(username, fullName, thumbnailURL, user.getEmailAddress(), accountURL, true, isAdmin(), vreNames);
UserSettings toReturn = new UserSettings(userInfo, 0, session.getScopeName(), isInfrastructureScope(), isNotificationViaEmailEnabled(username, currOrg));
UserSettings toReturn = new UserSettings(userInfo, 0, session.getScopeName(), isInfrastructureScope(), isNotificationViaEmailEnabled(session));
return toReturn;
}
else {
@ -306,9 +307,9 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
return new UserSettings();
}
private boolean isNotificationViaEmailEnabled(String username, Organization currOrg) {
final String ATTR_TO_CHECK = "PostNotificationViaEmail";
return OrganizationManagerImpl.get().readOrganizationCustomAttribute(username, currOrg, ATTR_TO_CHECK);
private boolean isNotificationViaEmailEnabled(ASLSession session) throws PortalException, SystemException {
Organization currOrg = OrganizationLocalServiceUtil.getOrganization(session.getGroupId());
return OrganizationManagerImpl.getInstance(session).readOrganizationCustomAttribute(session.getUsername(), currOrg, ATTR_TO_CHECK);
}
/**