-
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
Reaction registration implementation #120
Merged
RiccardoM
merged 26 commits into
master
from
leonardo/reactions-registration-limiting-impl
Mar 27, 2020
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
c6ecca8
restart the branch after a discussion with @RiccardoM on cyclic depen…
53f444b
created reaction type
c23dfa2
Merge branch 'master' of github.com:desmos-labs/desmos into leonardo/…
f15056d
added method to reaction type, keeper method and relative tests, crea…
71ba4f7
added querier, handler, cli and rest commands querier, handler, msg t…
ad266ff
adding simulation tests
48835ab
added registered reactions to genesis + tests
7850814
- aadded unicode checks
fbcb95d
- small lint fixes
12941eb
minor fixes
ad0f0c8
fixed tests, added checks for post reactions to see if they are regis…
4685f9a
solved cli tests and (maybe) simulation tests
3f11920
solving sim tests
196bea4
fixed sim-after import tests
a692f26
fixed sim tests
eeeab28
Updated docs
leobragaz c48bc5d
fixed errors and suggestions
bc5fdce
Merge remote-tracking branch 'origin/leonardo/reactions-registration-…
0b64eee
Merge branch 'master' of github.com:desmos-labs/desmos into leonardo/…
4db3361
Update x/posts/internal/keeper/keeper_reactions.go
RiccardoM 8266d84
Update CHANGELOG.md
RiccardoM 3d083d3
Update x/posts/internal/keeper/keeper_reactions.go
RiccardoM 4d15cae
Update x/posts/legacy/v0.2.0/types.go
RiccardoM 90ada69
Update x/posts/internal/keeper/keeper_reactions.go
RiccardoM d232e5a
fixed last suggestions
ee6e599
Merge remote-tracking branch 'origin/leonardo/reactions-registration-…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# `MsgRegisterReaction` | ||
This message allows you to register a new reaction. | ||
If you want to know more about the `Reaction` type, you can do so inside the [`Reaction` type documentation page](../../types/reaction.md) | ||
|
||
## Structure | ||
```json | ||
{ | ||
"type": "desmos/MsgRegisterReaction", | ||
"value": { | ||
"short_code": "<reaction short code>", | ||
"value": "<url (identifing gif or image) or unicode (identifing emoji)>", | ||
"subspace": "<Reaction subspace>", | ||
"creator": "<Desmos address that's registering the reaction>" | ||
} | ||
} | ||
``` | ||
|
||
### Attributes | ||
| Attribute | Type | Description | | ||
| :-------: | :----: | :-------- | | ||
| `short_code` | String | Short code that identifies the reaction (e.g. `":smile:"`) | | ||
| `value` | String | Value can be a URL or a UNICODE identifing gif, images, emoji | | ||
| `subspace` | String | Required string that identifies the subspace inside which the reaction will be registered | | ||
| `creator` | String | Desmos address of the user that is registering the reaction | | ||
|
||
## Example | ||
```json | ||
{ | ||
"type": "desmos/MsgRegisterReaction", | ||
"value": { | ||
"shortcode": ":smile:", | ||
"value": "U+1F604", | ||
"subspace": "4e188d9c17150037d5199bbdb91ae1eb2a78a15aca04cb35530cccb81494b36e", | ||
"creator": "desmos13s7p4jx3rj5pxjzlecxdvua68ex0sg7rug0pt3" | ||
} | ||
} | ||
``` | ||
|
||
## Message action | ||
The action associated to this message is the following: | ||
|
||
``` | ||
register_reaction | ||
``` |
4 changes: 2 additions & 2 deletions
4
docs/developers/msgs/remove-reaction.md → docs/developers/msgs/remove-post-reaction.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Query registered reactions | ||
This query endpoint allows you to retrieve the list of registered reactions. | ||
|
||
**CLI** | ||
```bash | ||
desmoscli query posts registered-reactions | ||
|
||
# Example | ||
# desmoscli query posts registered-reactions | ||
``` | ||
|
||
**REST** | ||
``` | ||
/reactions | ||
|
||
# Example | ||
# curl https://morpheus4000.desmos.network/reactions | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Reaction | ||
Inside Desmos, the reactions is the fastest way users can react to posts. | ||
|
||
Everyday each one of us use reactions inside the most popular social networks. | ||
Reactions let you immediately express what you think about the post/photo/video you've just watched. | ||
|
||
Each new reaction that will be registered inside Desmos will become part of the set of reactions supported by the system. | ||
Once you have registered your favorite GIF/image/emoji, you will be allowed to use them to react to every post inside Desmos. | ||
Remember that a reaction can be registered only once per `subspace`, so if you ever try to register a previously | ||
registered reaction, your transaction will not be valid. | ||
|
||
## Contained data | ||
A reaction is made of different parts. Following you will find out what are those and how they can be used. | ||
|
||
### `ShortCode` | ||
The `ShortCode` identifies the actual reaction short code. | ||
Short codes are codes used on various websites to speed up reaction insertion using a keyboard. | ||
These begin and end with a colon, and contain the literal name of the reaction itself. | ||
For example, it can look something like `:emoji-shortcode:`. | ||
When registering a new reaction, the shot code must be validated by the following regEx: `:[a-z]([a-z\d_])*:`. | ||
[Here](https://www.webfx.com/tools/emoji-cheat-sheet/) the list of all available short codes. | ||
|
||
### `Value` | ||
The `Value` of a reaction identifies whether the reaction is a GIF an image or an emoji. | ||
Value can be a `URL` with the path of the GIF/image your using as a reaction or it can be a `UNICODE` | ||
that identifies a specific emoji. | ||
`URL`'s will be validated by the following regEx: `^(?:http(s)?://)[\w.-]+(?:\.[\w.-]+)+[\w\-._~:/?#[\]@!$&'()*+,;=.]+$`. | ||
`Unicode` must be one of the following [list](https://unicode.org/emoji/charts/full-emoji-list.html). | ||
|
||
### `Subspace` | ||
The `Subspace` field identifies the application inside which the reaction has been registered. | ||
Currently the subspace must be a SHA256 hash of the previously plain-text value. | ||
|
||
### `Creator` | ||
The `Creator` field is used to specify the Bech32 address of the creator of the reaction. | ||
In order for a creator address to be valid, it must begin with the `desmos` Bech32 human-readable part. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can we have a test using an emoji as value such as 🎉 ?