reddit / devvit

Reddit for Developers
https://developers.reddit.com
BSD 3-Clause "New" or "Revised" License
73 stars 17 forks source link

getConversations does not return conversations sort order #113

Closed PitchforkAssistant closed 6 days ago

PitchforkAssistant commented 1 week ago

The getConversations() function for ModMail does not expose the sort order of the conversations.

The Modmail API returns something like this:

{
    "conversations": {
        "2d1vfw": {},
        "2d0pz5": {},
        "2cwuwh": {}
    },
    "messages": {
        "3csyy9": {},
        "3cpnqe": {},
        "3ct85p": {}
    },
    "viewerId": "t2_qikfu",
    "conversationIds": [
        "2d1vfw",
        "2d0pz5",
        "2cwuwh"
    ]
}

The conversationIds part of the response specifies the sorted order of the conversations, however it is not present in the GetConversationsResponse. This makes determining the after conversation ID that is needed for paginated calls quite difficult.

That value does appear to be present in the protos function that is called by the public-api ModMailService, so adding it should be quite simple:

image