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

Get posts for a channel has_next attribute fix #26901

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Aryakoste
Copy link
Contributor

Summary

Fixed the issue where has_next attribute always returned false. Made has_next attribute pointer and made changes accordingly.

Ticket Link

Fixes #26862
Jira https://mattermost.atlassian.net/browse/MM-57937

Screenshots

Release Note

NONE

@mm-cloud-bot mm-cloud-bot added the release-note-none Denotes a PR that doesn't merit a release note. label Apr 27, 2024
@mattermost-build
Copy link
Contributor

Hello @Aryakoste,

Thanks for your pull request! A Core Committer will review your pull request soon. For code contributions, you can learn more about the review process here.

@hanzei hanzei added 2: Dev Review Requires review by a developer 3: QA Review Requires review by a QA tester. May occur at the same time as Dev Review labels Apr 30, 2024
@mattermost-build
Copy link
Contributor

E2E tests not automatically triggered, because the PR is not in a mergeable state. Please update the branch with the base branch and resolve outstanding conflicts.

Copy link
Member

@agnivade agnivade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, as I mentioned here: #26862 (comment), please add a test in the getPostsForChannel API endpoint (see api4/post_test.go) and confirm that the pointer is nil in the response.

@@ -776,7 +776,7 @@ func testPostStoreGetForThread(t *testing.T, rctx request.CTX, ss store.Store) {
require.NoError(t, err)
require.Len(t, r1.Order, 3) // including the root post
require.Len(t, r1.Posts, 3)
assert.True(t, r1.HasNext)
require.Nil(t, r1.HasNext)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes seem wrong. The assertion should still be true here. I would assume something like: assert.True(t, *r1.HasNext) after a require.NotNil(t, r1.HasNext)

@agnivade
Copy link
Member

@Aryakoste - please check the CI for failures

PASS channels/store/localcachelayer.TestPostStore/LocalCache+PostgreSQL/GetForThread/Post_threadmembership_does_not_exist (0.01s)
=== RUN   TestPostStore/LocalCache+PostgreSQL/GetForThread/Pagination
    post_store.go:796: 
        	Error Trace:	/mattermost/server/channels/store/storetest/post_store.go:796
        	Error:      	Should be true
        	Test:       	TestPostStore/LocalCache+PostgreSQL/GetForThread/Pagination
    post_store.go:812: 
        	Error Trace:	/mattermost/server/channels/store/storetest/post_store.go:812
        	Error:      	Should be true
        	Test:       	TestPostStore/LocalCache+PostgreSQL/GetForThread/Pagination
    post_store.go:864: 
        	Error Trace:	/mattermost/server/channels/store/storetest/post_store.go:864
        	Error:      	Should be true
        	Test:       	TestPostStore/LocalCache+PostgreSQL/GetForThread/Pagination
    post_store.go:881: 
        	Error Trace:	/mattermost/server/channels/store/storetest/post_store.go:881
        	Error:      	Should be true
        	Test:       	TestPostStore/LocalCache+PostgreSQL/GetForThread/Pagination
--- FAIL: TestPostStore/LocalCache+PostgreSQL/GetForThread/Pagination (0.02s)

The code needs to be changed as well for the tests to work.

@agnivade agnivade self-requested a review May 15, 2024 04:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2: Dev Review Requires review by a developer 3: QA Review Requires review by a QA tester. May occur at the same time as Dev Review Contributor release-note-none Denotes a PR that doesn't merit a release note.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

API: "Get posts for a channel" always shows 'has_next' as false
5 participants