Start a conversation

Sorting the Replies and Comments

Added in 24.10.

Admins can customize the sorting order of replies and comments. This function enables them to effectively manage the organization and display discussions for community members.

You can sort the replies and comments at a node and user level by:

  • Creation time (PUBLISHTIME - Newest to Oldest)
  • Reverse Creation time (REVERSEPUBLISHTIME - Oldest to Newest)
  • Likes (LIKES)

Sorting at a Node Level

Use the setRepliesSortOrderSettingsOnNode mutation to set the sorting order of the replies and comments of a post at a node in your community.

Note: The default value for sort order is LIKES for all nodes.

Example

Use the below GraphQL query to sort the replies and comments by Oldest to Newest for a board ID: boardone.

mutation {
    setRepliesSortOrderSettingsOnNode(nodeId: "board:boardone", settingsInput: {sortOrder: REVERSE_PUBLISH_TIME}) {
        errors {
            __typename
        }
        result
    }
}

GraphQL response:

{
  "data": {
    "setRepliesSortOrderSettingsOnNode": {
      "errors": null,
      "result": true
    }
  }
}

Sorting at the User Level

Use the setRepliesSortOrderSettingsOnNode mutation to set the sorting order of the replies and comments at the user level.

Note: If you did not set the sortOrder, the sorting defaults to the current node's sort order.

Example

Use the below GraphQL query to sort the replies and comments by Newest to Oldest for the user ID: 5.

mutation {
    setRepliesSortOrderSettingsOnUser(userId: "user:5", settingsInput: {sortOrder: PUBLISH_TIME}) {
        errors {
            __typename
        }
    }
}

GraphQL response:

{
  "data": {
    "setRepliesSortOrderSettingsOnUser": {
      "errors": null
    }
  }
}
Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. ATLAS

  2. Posted
  3. Updated

Comments