-
Notifications
You must be signed in to change notification settings - Fork 0
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
Contract updates to match new frontends #28
Conversation
…tract into use-postId
…tract into use-postId
…tract into use-postId
@@ -83,11 +83,8 @@ contract KetlGuarded is Initializable, OwnableUpgradeable { | |||
allowedCaller = _allowedCaller; | |||
} | |||
|
|||
// @Todo: rollback when release |
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.
Just pointing out
contracts/superclasses/Posts.sol
Outdated
parentPost.numberOfComments++; | ||
posts[feedId][postId].numberOfComments++; | ||
if (replyTo > 0) { | ||
comments[feedId][postId][replyTo - 1].numberOfComments++; |
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.
Do we need to update the comment's number of comments? I don't think we display it anywhere in the UI
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.
Probably not, let's ask Sergey, maybe he needs it
contracts/superclasses/Posts.sol
Outdated
@@ -82,15 +83,20 @@ contract Posts is KetlGuarded { | |||
mapping(uint => mapping(uint => Post[])) public comments; | |||
mapping(uint => mapping(uint => Counters.Counter)) public lastCommentIds; | |||
|
|||
mapping(uint => mapping(uint => mapping(uint => Reaction[]))) | |||
mapping(uint => mapping(uint => mapping(uint => mapping(uint => Reaction)))) |
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.
This change is unnecessary
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 sure, right now this map works like:
reactions[feedId][postId][commendId][reactionId]
If commentId === 0
, you're accessing the post
Reaction
has reactionId
inside, if you'll remove something from reaction array, you'll need to update every reactionId
Also you need to make sure on frontend that currentUserReaction
is proper (because you removed reaction, array has shifted and you need to shift it on frontend as well)
contracts/superclasses/Posts.sol
Outdated
@@ -234,14 +240,14 @@ contract Posts is KetlGuarded { | |||
uint feedId = commentRequest.feedId; | |||
uint postId = commentRequest.postId; | |||
uint replyTo = commentRequest.replyTo; | |||
// Fetch parent post | |||
Post memory parentPost = posts[feedId][postId]; |
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.
We use this twice below, without this change the git diff would look 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.
It didn't work for us for some reason
…ract into use-postId
NOTE: Reactions and comments point to postId, and we mixed up threadId and postId on frontend, so we decided to use postId name here