-
Notifications
You must be signed in to change notification settings - Fork 16
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
feat: Add custom reactions to ReactionKind for posts #209
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,7 @@ pub type ReactionId = u64; | |
pub enum ReactionKind { | ||
Upvote, | ||
Downvote, | ||
Custom(u32), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe call it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I remember one idea was to support custom reactions (not even emojis). |
||
} | ||
|
||
impl Default for ReactionKind { | ||
|
@@ -201,6 +202,7 @@ pub mod pallet { | |
)?; | ||
post.inc_downvotes(); | ||
}, | ||
_ => {}, | ||
} | ||
|
||
PostById::<T>::insert(post_id, post.clone()); | ||
|
@@ -256,6 +258,7 @@ pub mod pallet { | |
post.inc_downvotes(); | ||
post.dec_upvotes(); | ||
}, | ||
_ => {}, | ||
} | ||
|
||
ReactionById::<T>::insert(reaction_id, reaction); | ||
|
@@ -299,6 +302,7 @@ pub mod pallet { | |
match reaction.kind { | ||
ReactionKind::Upvote => post.dec_upvotes(), | ||
ReactionKind::Downvote => post.dec_downvotes(), | ||
_ => {}, | ||
} | ||
|
||
PostById::<T>::insert(post_id, post.clone()); | ||
|
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 am not sure about this. What if this is a negative emoji? Then it cannot be considered as an upvote.