Fix #5704 Backend: Remove usage from activity feed (#5759)

This commit is contained in:
Vivek Ratnavel Subramanian 2022-06-30 02:15:21 -07:00 committed by GitHub
parent f3f45bc174
commit 2b0aeaf0eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -84,6 +84,13 @@ public class ChangeEventHandler implements EventHandler {
// Add a new thread to the entity for every change event
// for the event to appear in activity feeds
if (Entity.shouldDisplayEntityChangeOnFeed(changeEvent.getEntityType())) {
// ignore usageSummary updates in the feed
boolean shouldIgnore = false;
if (Entity.TABLE.equals(changeEvent.getEntityType()) && changeEvent.getChangeDescription() != null) {
List<FieldChange> fields = changeEvent.getChangeDescription().getFieldsUpdated();
shouldIgnore = fields.stream().anyMatch(field -> field.getName().equals("usageSummary"));
}
if (!shouldIgnore) {
for (var thread : listOrEmpty(getThreads(responseContext, loggedInUserName))) {
// Don't create a thread if there is no message
if (!thread.getMessage().isEmpty()) {
@ -109,6 +116,7 @@ public class ChangeEventHandler implements EventHandler {
}
}
}
}
} catch (Exception e) {
LOG.error("Failed to capture change event for method {} due to ", method, e);
}