mirror of https://github.com/zulip/zulip.git
f59cca2dcd
Before this commit, the reactions code would take the `message.reactions` structure from the server and try to "collapse" all the reactions for the same users into the same reactions, but with each reaction having a list of user_ids. It was a strangely denormalized structure that was awkward to work with, and it made it really hard to reason about whether the data was in the original structure that the server sent or the modified structure. Now we use a cleaner, normalized Map to keep each reaction (i.e. one per emoji), and we write that to `message.clean_reactions`. The `clean_reactions` structure is now the authoritatize source for all reaction-related operations. As soon as you try to do anything with reactions, we build the `clean_reactions` data on the fly from the server data. In particular, when we process events, we just directly manipulate the `clean_reactions` data, which is much easier to work with, since it's a Map and doesn't duplicate any data. This rewrite should avoid some obscure bugs. I use `r` as shorthand for the clean reaction structures, so as not to confuse it with data from the server's message.reactions. It also avoids some confusion where we use `reaction` as a var name for the reaction elements. |
||
---|---|---|
.. | ||
assets | ||
audio | ||
generated | ||
html | ||
images | ||
js | ||
shared | ||
styles | ||
templates | ||
third | ||
.eslintrc.json | ||
.gitignore | ||
favicon.ico |