Commit Graph

17 Commits

Author SHA1 Message Date
Steve Howell
4ec1260b41 reactions.js: Have an initialize() function. 2017-05-30 21:43:18 -07:00
Steve Howell
6149111b5e Add test_error_handling() for reactions.js. 2017-05-30 21:43:18 -07:00
Steve Howell
b0b647c9e5 Add more code to test_add_and_remove_reaction().
This increases our line coverage a bit.
2017-05-30 21:43:18 -07:00
Steve Howell
879abd6290 Add coverage for update_existing_reaction(). 2017-05-29 20:10:53 -07:00
Steve Howell
1ae66cda6f Increase test coverage for insert_new_reaction. 2017-05-29 20:10:53 -07:00
Steve Howell
80920438a5 Add coverage for get_emojis_used_by_user_for_message_id. 2017-05-29 20:10:53 -07:00
Steve Howell
805c99ae27 Add hide_emoji_popover() to toggle_emoji_reaction().
This change sets us up to de-duplicate some code.  It
changes behavior for the edge case situation where
you had the reaction menu open but then decide to
click on one of the existing reactions.  This change
closes the emoji popover, which is probably the
correct behavior.
2017-05-29 17:10:04 -06:00
Steve Howell
63d0711c4b Rename message_reaction_on_click() to toggle_emoji_reaction().
This prepares us to de-duplicate some code.
2017-05-29 17:10:04 -06:00
Steve Howell
49e3ee36c4 Add tests for reactions.remove_reaction(). 2017-05-29 14:59:52 -07:00
Steve Howell
affff8ac82 Extract reactions.set_reaction_count. 2017-05-29 14:59:52 -07:00
Steve Howell
cb0527397e Add tests for reactions.add_reaction(). 2017-05-28 16:58:32 -07:00
Steve Howell
8d7cd2e3af Add tests for reactions.message_reaction_on_click(). 2017-05-28 16:58:32 -07:00
Steve Howell
c02f4b4756 Add people.initialize().
This makes us not have to stub jquery in many of our node
tests!
2017-05-23 19:35:08 -07:00
Harshit Bansal
d827cc878b emoji.js: Remove unnecessary indirection.
Remove unnecessary function `emoji_name_to_css_class()` called while
populating `emojis_name_to_css_class` dict.
2017-05-17 08:09:50 -07:00
Steve Howell
87f5c22593 Simplify how we find the current user's emoji reactions.
This adds the current_user_has_reacted_to_emoji() helper.

This new helper is easier to use and slightly more efficient
than calling get_user_list_for_message_reaction() and then
indexOf().

This also replaces one call to get_user_list_for_message_reaction()
with a list of user_ids that we already had locally.

The node tests were improved a bit here, including a minor
whitespace fixup.
2017-05-11 09:39:17 -07:00
Steve Howell
cf6545a71f reactions: Only warn for unknown user ids.
If we get reactions for deactivated users, or otherwise missing
users, we only issue a blueslip warning now.  The function
get_message_reactions() was indirectly causing blueslip errors
before this fix, but we can downgrade to warnings now that this
function has better unit tests around it.

We eventually want to track deactivated users on the client.

Fixes #4289
2017-03-26 11:51:36 -07:00
Steve Howell
03b7e59b59 node tests: Add reactions.js test module.
We test get_message_reactions() in our first test here.
2017-03-26 11:39:05 -07:00