-
Notifications
You must be signed in to change notification settings - Fork 48
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 reaction registration and limiting #94
Comments
I see the solution fine here. I have the following comments.
|
The implementation proposal is good. I agree with @kwunyeung's 1 comment. |
@kwunyeung @bragaz I'm splitting my comments into different sections for easier reading. RegEx updateThanks @kwunyeung for the tip, I have updated the original regex to be the one you've written as I think too it is better. Emoji ownershipI see no problem in saving who is the owner, but I see some problems in allowing him/her to edit the emoji value if we use the implementation proposed above. Suppose that a user creates an emoji called To solve this issue I currently see two possible options:
URL checkingI'm personally against this URL checking thing. While it is generically true that most of the images have URLs that terminate with the image extension itself, some don't. If the user starts grabbing images from Google Search, he might find ones like the followings: In the first case, the extensions is available but it is not the last thing the URL has. In the second one, the extensions is not even visible. Generally, when we refer to an image there is no need for the URL to have the extension inside it. We just have to make sure the request returns a proper What I would do, instead, is think more deeply how a possible For the REST part, however, there is no global solution as we should always consider the blockchain cannot perform any HTTP call and we should not force any URL form. If the user sets an invalid image, the worst thing would be the clients will not show it altogether. |
@RiccardoM you are right on the Emoji ownership. Saving We can only request a range of the file and verify with the |
After a discussion with @RiccardoM about cyclic dependency of a possibile new |
Context
Currently when a user adds a reaction to a post, he has the freedom of adding whatever reaction he prefers best. This allows a freedom of expression, and results in post having different kinds of reactions:
While this allows users to better express themselves, it makes reactions representation a lot harded inside mobile application, which will most certainly be the way users will be able to use them.
For example, in order to present and allow users to easily use post reactions, Mooncake currently only shows single Unicode characters emojis, thus filtering out the second and third type described above.
The problem with such approach is that it causes an incoherent visualization of post reactions across the different platform. To make it more clear why, let's suppose that the following reaction have been added to a post:
What would happen inside the explorer is that all of the reaction are going to be visualized properly. However, inside Mooncake only the first one will be shown, resulting in a conflicting and most probably confusing situation for the end user that sees two different things on two different platforms.
To solve this problem all over the Desmos client implementation, a unified approach should be taken.
Implementation proposal
After a brief discussion between me and @kwunyeung we found a possible solution that heavily imitates what currently happens inside Github, Slack, Discord and other channels: using emojis shortcodes.
According to this approach, all reactions will be identified by a string that has the following format:
Such string, also referenced as "emoji short code", is supported by most platforms and uniquely identifies an emoji. Examples of such shortcodes are the following:
:+1:
-> 👍:small_airplane:
-> 🛩️:smile:
-> 😄In order to allow users to express their opinions the best way the can, we have thought of also implementing custom shotcodes to allow for custom reactions registrations.
In order to implement such things, a list of supported shortcodes should be kept on-chain, and each time a new reaction is added to a post, that reaction should be a registered shortcode. If it is not, the adding should not proceed.
Implementation details
To implement this the best way possible, I suggest we create a new module called
reactions
which contains the following messaged handling and data storing logic.Types
The current
Reaction
type should be renamed toPostReaction
, while a newReaction
should be created:Such type should also have a
Validate
method that checks the following constraints:Shortcode
must be a string starting and ending with a colon (:
) and not containing any white space, thus satisfying the following regex::[a-z]([a-z\d_])*:
Value
must be either a single unicode emoji or a URL starting withhttp(s)
. This is to allow users to add gifs and custom pics as reactions tooKeeper
All the current methods regarding post reactions should be kept.
The following new methods should be created as well:
Messages
The current
MsgAddReaction
andMsgRemoveReaction
types should be moved here.An additional
MsgRegisterReaction
should be created:Such message should have the following constraints:
Shortcode
must be a string starting and ending with a column (:
) and not containing any white space, thus satisfying the following regex::(\S)*:
Value
must be either a single unicode emoji or a URL starting withhttp(s)
. This is to allow users to add gifs and custom pics as reactions tooHandler
The currently existing handler methods that deal with post reactions should be moved inside the
reactions
module handler.A new method handling
MsgRegisterPostReaction
should be created. Such method should act as follows:msg.Shortcode
.Querier
The currently present post reactions-related queries should be moved inside this new querier.
A new query should also be implemented, allowing a user to get all the registered reactions.
Conclusion
I think that with such implementation we could fix the problem described above, maintaining a nice on-chain list of all the supported reactions. As always, I'd like your thoughts on this too @kwunyeung @bragaz
The text was updated successfully, but these errors were encountered: