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
Add PostComments
paginated query method
#510
Conversation
Codecov Report
@@ Coverage Diff @@
## master #510 +/- ##
==========================================
- Coverage 84.94% 84.93% -0.01%
==========================================
Files 89 89
Lines 4284 4296 +12
==========================================
+ Hits 3639 3649 +10
- Misses 484 485 +1
- Partials 161 162 +1
Continue to review full report at Codecov.
|
…post-comments-query
Co-authored-by: Leonardo Bragagnolo <leo.braga95@gmail.com>
Co-authored-by: Leonardo Bragagnolo <leo.braga95@gmail.com>
@@ -93,6 +93,11 @@ func (k msgServer) CreatePost(goCtx context.Context, msg *types.MsgCreatePost) ( | |||
return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, | |||
"post with id %s does not allow comments", parentPost.PostID) | |||
} | |||
|
|||
if parentPost.Subspace != post.Subspace { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch!
x/staging/posts/keeper/keeper.go
Outdated
// nolint: interfacer | ||
func (k Keeper) GetPostChildrenIDs(ctx sdk.Context, postID string) []string { | ||
store := ctx.KVStore(k.storeKey) | ||
func (k Keeper) GetPostCommentsIDs(ctx sdk.Context, postID string) []string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm having a hard time understanding where this is used. Maybe we can delete it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. It is only for test. Let me move it to test files or use another way in test.
@@ -30,6 +30,23 @@ func (k Keeper) IteratePosts(ctx sdk.Context, fn func(index int64, post types.Po | |||
} | |||
} | |||
|
|||
func (k Keeper) IterateCommentIDsByPost(ctx sdk.Context, postID string, fn func(index int64, commentID string) (stop bool)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is only used inside GetPostCommentsIDs
, which appears to be unused as well. Maybe we can delete this as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
Description
This PR is the implementation of #505.
Closes #505
CommentID
object from protoPostComments
query methodPostComments
cmd functionChecklist
CHANGELOG.md
file.Files changed
in the Github PR explorer.