fix announcement notification. (#17793)

This commit is contained in:
Siddhant 2024-09-11 22:08:54 +05:30 committed by GitHub
parent e7cfa4889c
commit 052430ee07
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 26 additions and 8 deletions

View File

@ -387,6 +387,15 @@ public interface MessageDecorator<T> {
String.format(
"Ends At : %s", getDateString(thread.getAnnouncement().getEndTime())));
}
case ENTITY_DELETED -> {
headerMessage =
String.format(
"[%s] **@%s** posted an update on **Announcement**",
publisherName, thread.getUpdatedBy());
attachmentList.add(
String.format(
"Announcement Deleted: %s", thread.getAnnouncement().getDescription()));
}
}
}
}

View File

@ -372,22 +372,31 @@ public class SubscriptionUtil {
handleConversationNotification(category, type, event));
// TODO: For Announcement, Immediate Consumer needs to be Notified (find information from
// Lineage)
case Announcement -> {
receiverUrls.addAll(buildReceivers(action, category, type, event, event.getEntityId()));
}
}
} else {
EntityInterface entityInterface = getEntity(event);
receiverUrls.addAll(
buildReceiversListFromActions(
action,
category,
type,
Entity.getCollectionDAO(),
entityInterface.getId(),
event.getEntityType()));
receiverUrls.addAll(buildReceivers(action, category, type, event, entityInterface.getId()));
}
return receiverUrls;
}
private static Set<String> buildReceivers(
SubscriptionAction action,
SubscriptionDestination.SubscriptionCategory category,
SubscriptionDestination.SubscriptionType type,
ChangeEvent event,
UUID id) {
Set<String> result = new HashSet<>();
result.addAll(
buildReceiversListFromActions(
action, category, type, Entity.getCollectionDAO(), id, event.getEntityType()));
return result;
}
public static List<Invocation.Builder> getTargetsForWebhookAlert(
SubscriptionAction action,
SubscriptionDestination.SubscriptionCategory category,