Skip to content

Commit

Permalink
[Notification] - Making query URL paginated for user segment
Browse files Browse the repository at this point in the history
  • Loading branch information
pankajjangid05 committed Apr 21, 2023
1 parent f114c27 commit 1839c52
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,11 @@ private XMessage setXMessageTransformers(XMessage xMessage, JsonNode botNode) {
? transformerMeta.findValue("formID").asText()
: "");
if (transformerMeta.get("type") != null && transformerMeta.get("type").asText().equals(BotUtil.transformerTypeBroadcast)) {
metaData.put("federatedUsers", getFederatedUsersMeta(botNode, transformer));
if(xMessage != null && xMessage.getFrom() != null && xMessage.getFrom().getMeta() != null && xMessage.getFrom().getMeta().containsKey("page")){
metaData.put("federatedUsers", getFederatedUsersMeta(botNode, transformer, xMessage.getFrom().getMeta().get("page")));
} else{
metaData.put("federatedUsers", getFederatedUsersMeta(botNode, transformer, null));
}
}

if (transformerMeta.findValue("hiddenFields") != null && !transformerMeta.findValue("hiddenFields").isEmpty()) {
Expand Down Expand Up @@ -294,11 +298,11 @@ private XMessage setXMessageTransformers(XMessage xMessage, JsonNode botNode) {
* @param transformer
* @return Federated users as json string
*/
private String getFederatedUsersMeta(JsonNode botNode, JsonNode transformer) {
private String getFederatedUsersMeta(JsonNode botNode, JsonNode transformer, String page) {
String botId = botNode.get("id").asText();

/* Get federated users from federation services */
JSONArray users = userService.getUsersFromFederatedServers(botId);
JSONArray users = userService.getUsersFromFederatedServers(botId, page);

/* Check if users, & related meta data exists in transformer */
if(users != null && transformer.get("meta") != null
Expand Down

0 comments on commit 1839c52

Please sign in to comment.