Fixing notification addressee
This commit is contained in:
parent
e137394230
commit
5083e392f9
|
@ -32,6 +32,7 @@ public abstract class ModerationThread {
|
|||
protected String itemName;
|
||||
protected String itemTitle;
|
||||
protected String itemURL;
|
||||
protected String itemAuthorCkanUsername;
|
||||
|
||||
protected String moderationURL;
|
||||
|
||||
|
@ -66,6 +67,14 @@ public abstract class ModerationThread {
|
|||
this.itemAuthor = itemAuthor;
|
||||
}
|
||||
|
||||
public String getItemAuthorCkanUsername() {
|
||||
return itemAuthorCkanUsername;
|
||||
}
|
||||
|
||||
public void setItemAuthorCkanUsername(String itemAuthorCkanUsername) {
|
||||
this.itemAuthorCkanUsername = itemAuthorCkanUsername;
|
||||
}
|
||||
|
||||
public void setCKANUser(CKANUser ckanUser) {
|
||||
this.ckanUser = ckanUser;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ public class SocialNotificationModerationThread extends ModerationThread {
|
|||
protected static final boolean notificationSentByGCat;
|
||||
|
||||
static {
|
||||
notificationSentByGCat = false;
|
||||
notificationSentByGCat = true;
|
||||
}
|
||||
|
||||
public SocialNotificationModerationThread() {
|
||||
|
@ -193,13 +193,12 @@ public class SocialNotificationModerationThread extends ModerationThread {
|
|||
|
||||
Set<String> users = SocialUsers.getUsernamesByRole(Moderated.CATALOGUE_MODERATOR);
|
||||
|
||||
SecretManager secretManager = SecretManagerProvider.instance.get();
|
||||
String username = secretManager.getUser().getUsername();
|
||||
// Adding the user is generating the event
|
||||
users.add(username);
|
||||
// Adding item creator
|
||||
// Adding current ckanUser
|
||||
users.add(CKANUser.getUsernameFromCKANUsername(ckanUser.getName()));
|
||||
|
||||
// Adding item author
|
||||
users.add(CKANUser.getUsernameFromCKANUsername(itemAuthorCkanUsername));
|
||||
|
||||
catalogueEvent.setIdsToNotify(users.toArray(new String[users.size()]));
|
||||
catalogueEvent.setIdsAsGroup(false);
|
||||
|
||||
|
|
|
@ -1117,7 +1117,6 @@ public class CKANPackage extends CKAN implements Moderated {
|
|||
* --------------------------------------------------------------------------------------------------------
|
||||
*
|
||||
*/
|
||||
|
||||
protected CMItemStatus getCMItemStatus() {
|
||||
|
||||
String cmItemStatusString = CMItemStatus.APPROVED.getValue();
|
||||
|
@ -1169,6 +1168,15 @@ public class CKANPackage extends CKAN implements Moderated {
|
|||
if(moderationEnabled && moderationThread==null) {
|
||||
moderationThread = ModerationThread.getDefaultInstance();
|
||||
moderationThread.setCKANUser(ckanUser);
|
||||
|
||||
String itemAuthorCkanUsername = "";
|
||||
JsonNode jsonNode = getExtraField(result, Moderated.SYSTEM_CM_ITEM_AUTHOR);
|
||||
if(jsonNode!=null) {
|
||||
itemAuthorCkanUsername = jsonNode.asText();
|
||||
moderationThread.setItemAuthorCkanUsername(itemAuthorCkanUsername);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return moderationEnabled;
|
||||
}
|
||||
|
@ -1372,6 +1380,7 @@ public class CKANPackage extends CKAN implements Moderated {
|
|||
}
|
||||
}
|
||||
addExtraField(jsonNode, Moderated.SYSTEM_CM_ITEM_VISIBILITY, cmItemVisibility.getValue());
|
||||
addExtraField(jsonNode, Moderated.SYSTEM_CM_ITEM_AUTHOR, ckanUser.getName());
|
||||
|
||||
((ObjectNode) jsonNode).put(PRIVATE_KEY, true);
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue