fixed bug

This commit is contained in:
Luca Frosini 2023-02-01 17:35:07 +01:00
parent 959b350674
commit e30794baa6
3 changed files with 6 additions and 7 deletions

View File

@ -163,8 +163,8 @@ public abstract class ModerationThread {
postUserMessage(cmItemStatus, userMessage); postUserMessage(cmItemStatus, userMessage);
} }
public void postItemDeleted(CMItemStatus cmItemStatus) throws Exception { public void postItemDeleted() throws Exception {
this.cmItemStatus = cmItemStatus; this.cmItemStatus = null;
String fullName = ckanUser.getNameSurname(); String fullName = ckanUser.getNameSurname();
String message = String.format( String message = String.format(
"@**%s** deleted the item with name '%s' (id='%s')", "@**%s** deleted the item with name '%s' (id='%s')",

View File

@ -162,9 +162,9 @@ public class SocialNotificationModerationThread extends ModerationThread {
} }
@Override @Override
public void postItemDeleted(CMItemStatus cmItemStatus) throws Exception { public void postItemDeleted() throws Exception {
this.create = false; this.create = false;
this.cmItemStatus = cmItemStatus; this.cmItemStatus = null;
this.catalogueEventType = CatalogueEventType.ITEM_REMOVED; this.catalogueEventType = CatalogueEventType.ITEM_REMOVED;
notifyItemDeleted(); notifyItemDeleted();
} }
@ -218,7 +218,7 @@ public class SocialNotificationModerationThread extends ModerationThread {
catalogueEvent.setType(catalogueEventType); catalogueEvent.setType(catalogueEventType);
catalogueEvent.setNotifyText(messageString); catalogueEvent.setNotifyText(messageString);
catalogueEvent.setItemId(getSubject()); catalogueEvent.setItemId(getSubject());
if(cmItemStatus == CMItemStatus.APPROVED) { if(cmItemStatus!=null && cmItemStatus == CMItemStatus.APPROVED) {
catalogueEvent.setItemURL(new URL(itemURL)); catalogueEvent.setItemURL(new URL(itemURL));
}else { }else {
catalogueEvent.setItemURL(new URL(getModerationURL())); catalogueEvent.setItemURL(new URL(getModerationURL()));

View File

@ -1467,9 +1467,8 @@ public class CKANPackage extends CKAN implements Moderated {
private void postItemDeleted() { private void postItemDeleted() {
try { try {
if(isModerationEnabled()) { if(isModerationEnabled()) {
CMItemStatus cmItemStatus = getCMItemStatus();
moderationThread.setItemCoordinates(itemID, name, itemTitle, itemURL); moderationThread.setItemCoordinates(itemID, name, itemTitle, itemURL);
moderationThread.postItemDeleted(cmItemStatus); moderationThread.postItemDeleted();
} }
} catch(WebApplicationException e) { } catch(WebApplicationException e) {
throw e; throw e;