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