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:
parent
162ea4e2be
commit
e85191a73b
|
@ -82,6 +82,7 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
|
||||||
private static final String STORAGE_OWNER = "gCubeSocialFramework";
|
private static final String STORAGE_OWNER = "gCubeSocialFramework";
|
||||||
public static final String UPLOAD_DIR = "/social-framework-uploads";
|
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 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) {
|
if (isWithinPortal() && username.compareTo(TEST_USER) != 0) {
|
||||||
long companyId = OrganizationsUtil.getCompany().getCompanyId();
|
long companyId = OrganizationsUtil.getCompany().getCompanyId();
|
||||||
com.liferay.portal.model.UserModel user = UserLocalServiceUtil.getUserByScreenName(companyId, username);
|
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();
|
thumbnailURL = "/image/user_male_portrait?img_id="+user.getPortraitId();
|
||||||
fullName = user.getFirstName() + " " + user.getLastName();
|
fullName = user.getFirstName() + " " + user.getLastName();
|
||||||
email = user.getEmailAddress();
|
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);
|
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;
|
return toReturn;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -306,9 +307,9 @@ public class ShareUpdateServiceImpl extends RemoteServiceServlet implements Shar
|
||||||
return new UserSettings();
|
return new UserSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isNotificationViaEmailEnabled(String username, Organization currOrg) {
|
private boolean isNotificationViaEmailEnabled(ASLSession session) throws PortalException, SystemException {
|
||||||
final String ATTR_TO_CHECK = "PostNotificationViaEmail";
|
Organization currOrg = OrganizationLocalServiceUtil.getOrganization(session.getGroupId());
|
||||||
return OrganizationManagerImpl.get().readOrganizationCustomAttribute(username, currOrg, ATTR_TO_CHECK);
|
return OrganizationManagerImpl.getInstance(session).readOrganizationCustomAttribute(session.getUsername(), currOrg, ATTR_TO_CHECK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue