Skip to content

Commit

Permalink
revert names and give a proper comment
Browse files Browse the repository at this point in the history
  • Loading branch information
T-Damer committed Jun 5, 2023
1 parent 283a7b1 commit b106341
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions contracts/models/Post.sol
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ pragma solidity ^0.8.19;
import "./CID.sol";

struct Post {
address sender;
address author;
CID metadata;
uint timestamp;
uint postId;
uint threadId;
uint replyTo;
uint numberOfComments;
}
9 changes: 4 additions & 5 deletions contracts/superclasses/Posts.sol
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ contract Posts is KetlGuarded {
uint indexed feedId,
uint indexed postId,
Post post,
address indexed sender
address indexed author
);
event PostPinned(uint indexed feedId, uint indexed postId);
event PostUnpinned(uint indexed feedId, uint indexed postId);
Expand Down Expand Up @@ -177,7 +177,6 @@ contract Posts is KetlGuarded {
onlyElevatedPriveleges(feedId, sender)
{
require(postId < lastPostIds[feedId].current(), "Post not found");
require(pinnedPosts[feedId][postId] != pin, "Post already pinned/unpinned");
pinnedPosts[feedId][postId] = pin;
if (pin) {
emit PostPinned(feedId, postId);
Expand Down Expand Up @@ -333,7 +332,7 @@ contract Posts is KetlGuarded {
// Fetch post or comment
Post memory post = commentId == 0
? posts[feedId][postId]
: comments[feedId][postId][commentId - 1]; // -1 because we're reading array
: comments[feedId][postId][commentId - 1]; // -1 because commentIds starts with 1
// Check if post or comment exists
require(post.sender != address(0), "Post or comment not found");
// Get old reaction if it exists
Expand Down Expand Up @@ -401,7 +400,7 @@ contract Posts is KetlGuarded {
// Fetch post or comment
Post memory post = commentId == 0
? posts[feedId][postId]
: comments[feedId][postId][commentId - 1]; // -1 because we're reading array
: comments[feedId][postId][commentId - 1]; // -1 because commentIds starts with 1
// Check if post or comment exists
require(post.sender != address(0), "Post or comment not found");
// Check if sent by the owner
Expand All @@ -424,7 +423,7 @@ contract Posts is KetlGuarded {
// Fetch post or comment
Post memory post = commentId == 0
? posts[feedId][postId]
: comments[feedId][postId][commentId - 1]; // -1 because we're reading array
: comments[feedId][postId][commentId - 1]; // -1 because commentIds starts with 1
// Check if post or comment exists
require(post.sender != address(0), "Post or comment not found");
// Get the number of reactions
Expand Down

0 comments on commit b106341

Please sign in to comment.