Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API: "Get posts for a channel" always shows 'has_next' as false #26862

Open
mattermod opened this issue Apr 24, 2024 · 2 comments · May be fixed by #26901
Open

API: "Get posts for a channel" always shows 'has_next' as false #26862

mattermod opened this issue Apr 24, 2024 · 2 comments · May be fixed by #26901
Assignees
Labels
Help Wanted Community help wanted

Comments

@mattermod
Copy link
Contributor

When using the Get posts for a channel API call, the response includes a has_next attribute, which is supposed to indicate if more pages are available. In my testing (on Mattermost v9.5.3) it always returns false. In the example here:

{
  ...
    "next_post_id": "ggwusis3ufgeinank878k7dq4h",
    "prev_post_id": "onhx6rnrbib3tfqmnmgostcy1r",
    "has_next": false,
    "first_inaccessible_post_time": 0
}

you can see both the next_post_id and prev_post_id fields are populated, and there are definitely more pages available, yet the has_next field remains steadfastly as false.


If you're interested please comment here and come join our "Contributors" community channel on our daily build server, where you can discuss questions with community members and the Mattermost core team. For technical advice or questions, please join our "Developers" community channel.

New contributors please see our Developer's Guide.

JIRA: https://mattermost.atlassian.net/browse/MM-57937

@mattermod mattermod added Help Wanted Community help wanted Up For Grabs labels Apr 24, 2024
@agnivade
Copy link
Member

The objective for this ticket is to change the HasNext attribute in

HasNext bool `json:"has_next"`
to have omitempty and change it to a pointer.

And then change the code in the sqlstore/post_store.go to appropriately dereference the pointer and set it.

Also, please add a test to ensure that getPostsForChannel API endpoint and probably others don't return the has_next field.

@Aryakoste
Copy link
Contributor

Hello @mattermod. I would like to work on this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Help Wanted Community help wanted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants