Skip to content

Commit

Permalink
fix: message conversation list based on user messages [DHIS2-18605] (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jbee authored Dec 11, 2024
1 parent fd072ee commit 52e4a64
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,11 @@ public ResponseEntity<?> getObject(

@Override
protected List<UID> getPreQueryMatches(GetMessageConversationObjectListParams params) {
if (params.getQuery() != null) return null;
List<org.hisp.dhis.message.MessageConversation> allUserMessages =
messageService.getMessageConversations();
String query = params.getQueryString();
if (query == null) return null;
if (query == null) return allUserMessages.stream().map(UID::of).toList();

String op = params.getQueryOperator();
if (op == null) op = "token";
Expand All @@ -197,7 +200,8 @@ protected List<UID> getPreQueryMatches(GetMessageConversationObjectListParams pa
.setPaging(false)
.setRootJunction(Junction.Type.OR)
.setFilters(filters);
Query subQuery = queryService.getQueryFromUrl(getEntityClass(), subQueryParams);
Query subQuery =
queryService.getQueryFromUrl(getEntityClass(), subQueryParams).setObjects(allUserMessages);
// Note: in theory these filters could be added to the main query
// but the OR concerns both DB and in-memory properties
// which would break if added to the main query ATM
Expand Down

0 comments on commit 52e4a64

Please sign in to comment.