-
Notifications
You must be signed in to change notification settings - Fork 46
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
Post and Like structure revist #40
Conversation
- Removed the Namespace and ExternalOwner fields - Changed how the likes for a given post are stored
Fixed some tests and formatted them using the gotests style
Let's target merging it this weekend and launch testnet. |
Signed-off-by: RiccardoM <riccardo.montagnin@gmail.com>
Codecov Report
@@ Coverage Diff @@
## develop #40 +/- ##
============================================
+ Coverage 61.18% 81.47% +20.29%
============================================
Files 13 13
Lines 541 502 -39
============================================
+ Hits 331 409 +78
+ Misses 192 84 -108
+ Partials 18 9 -9
Continue to review full report at Codecov.
|
if err := keeper.CreateSession(ctx, session); err != nil { | ||
// Check for any previously existing session | ||
if _, found := keeper.GetSession(ctx, session.SessionID); found { | ||
return sdk.ErrUnknownRequest(fmt.Sprintf("Session with id %s already exists", session.SessionID)).Result() |
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.
Not a big deal but looks strange if a function is named GetSession
where the function is to check whether the session exists.
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.
The GetSession
here is used to check if a session already exists, but elsewhere (i.e inside the querier
) the same method is used to get a session using its ID.
Here we use the second returned value, which allows for faster and easier comparison than the first one. It's just a convinient way to keep the code DRY and avoiding having multiple methods with very similar functionality
if err := k.SaveLike(ctx, like); err != nil { | ||
return err | ||
// Check for double likes | ||
if likes.ContainsOwnerLike(like.Owner) { |
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.
Possible to query the state before broadcasting the message?
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.
Unluckily, not. The ValidateBasic
method has no access to the state.
On the other hand, we can move this to the handler. Do you think it would be better?
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.
Looks good. Just a few comments.
Signed-off-by: RiccardoM <riccardo.montagnin@gmail.com>
Description
This PR implements various
Post
andLike
structure improvements.Also, the various messages have been revisited in order to delete useless time fields.
Tests have been added and documentation has been written.
Closes #39
Checklist
Files changed
in the Github PR explorer