Commit Graph

3602 Commits

Author SHA1 Message Date
Steve Howell
6518c63b14 node tests: Add tests to activity.js. 2017-05-24 17:41:41 -07:00
Steve Howell
689605dd2e Introduce make_zjquery(). 2017-05-24 17:41:41 -07:00
Steve Howell
6c7a5260fc node tests: Add tests for filtering user ids in user list. 2017-05-24 17:41:41 -07:00
Steve Howell
5c09bec5e9 node tests: Use zjquery for entire activity test. 2017-05-24 17:41:41 -07:00
Steve Howell
4cfd9aa689 Add test coverage for activity unread counts. 2017-05-24 13:08:54 -07:00
Cynthia Lin
2045426ab9 hotkeys: Change subscribe stream hotkey to S. 2017-05-24 12:19:15 -07:00
Steve Howell
a9f6f5f0c0 node tests: Split out presence.js. 2017-05-24 09:18:24 -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
Joshua Pan
43487c6c3f node_tests: Get unread.js to 100% node coverage. 2017-05-23 19:04:02 -07:00
Joshua Pan
d44626d456 node_tests: Get topic_generator.js to 100% node coverage. 2017-05-23 19:00:56 -07:00
Steve Howell
7c1b555331 node tests: Use zjquery for common.js tests. 2017-05-23 18:52:25 -07:00
Joshua Pan
f3369b266a node_tests: Extract and create fake_jquery as zjquery.
This allows us to use fake_jquery (originally only in
compose_actions.js) in all our node tests.
2017-05-23 10:27:07 -07:00
Joshua Pan
f8e10ed2f6 node_tests: Add test coverage to autofocus. 2017-05-23 10:26:30 -07:00
Joshua Pan
525cc34491 node_tests: Add test for long low-quality passwords. 2017-05-23 10:26:30 -07:00
Steve Howell
d0ea11f355 Have "n" key skip muted streams. 2017-05-17 11:28:33 -07:00
Steve Howell
6f73b7953f Have "n" key skip muted topics. 2017-05-17 11:28:33 -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
7d153c9f8a Revert "muting.js: Track muted streams using stream id."
This reverts commit c7f710b8d4.

Because the back end still stores muted topics fundamentally using
stream name as a key, trying to cut over the client to use stream
id was just making things more brittle.  Mutes would work after
renaming the stream, which was progress in the change that we
revert here, but only until page load.  The other problem, which
is more severe, is that the order of page loading functions would
cause no mutes to happen at page load time.  This could be fixed
to some degree, but we should do a deeper fix on the back end.
2017-05-17 07:06:32 -07:00
Tim Abbott
00c7f7d42f Remove date separators from the top of the message feed.
Now that we have the date visible in the recipient rows, we no longer
need a top-of-feed date separator.

Fixes #4581.
2017-05-16 14:47:04 -07:00
Tim Abbott
df5a0e7c92 hotkeys: Simplify logic for checking for subscriptions page. 2017-05-15 20:28:56 -07:00
Steve Howell
c7f710b8d4 muting.js: Track muted streams using stream id.
This should prevent some glitches with stream rename events.
2017-05-15 14:47:41 -07:00
Steve Howell
1a11042fdf refactor: Use stream id more in topic_list.js. 2017-05-15 14:47:41 -07:00
Steve Howell
efb35afeb7 Track recent topics (and active streams) using stream id.
This commit changes the key for recent_topics to be a
stream id.  For streams that have been renamed, we will now
get accurate data on recent topics and active streams as
long as stream_data.get_stream_id(stream_name) returns a
valid value.
2017-05-15 14:47:41 -07:00
Steve Howell
5d33d02235 Track unread counts using stream_id. 2017-05-15 14:47:41 -07:00
Steve Howell
c125ba1d08 Fix how we find if streams are muted.
This commit changes stream_data.in_home_view() to
take a stream_id parameter, which will make it more
robust to stream name changes.

This fixes a bug.  Now when an admin renames a stream
you are looking at, it will correctly show itself to
be un-muted. (Even with this fix, though, the stream
appears to be inactive.)

Some callers still do lookups by name, and they will
call name_in_home_view() for now, which we can
hopefully deprecate over time.
2017-05-15 14:47:41 -07:00
Steve Howell
d3a7aa3a37 Have get_stream_li() take a stream_id.
Rather than having get_stream_li() look up stream id using
stream name, we force the callers to pass in the stream id.

This adds an extra line to most of the callers for now, but
this will eventually change as we fix some of the callers to
have their callers pass in stream_id.

In places where we now call stream_data.get_stream_id() to
get the stream id, we will be more resilient toward stream
renamings, at least until the next reload, since
stream_data.get_stream_id() can resolve old names that
are stored when we process stream-rename events.
2017-05-15 14:47:41 -07:00
Steve Howell
191741a382 Use stream ids to filter messages in client-side narrows.
We now use stream ids to filter messages in narrowing
situations, instead of doing stream name comparisons.

This partially fixes certain stream-renaming scenarios, since
we will be able to match the stream id for an out-of-date
stream operand, but it doesn't fix some other stuff, such
as the query that the server gets.
2017-05-13 21:59:07 -07:00
Steve Howell
8ecfda9344 stream_data: Remember old stream names.
This is not a user-facing change, but it starts us down the
path to having the JS client be able to look up old stream
names for situations like people clicking old external links
or for live-update scenarios.
2017-05-13 21:58:37 -07:00
hackerkid
cf15a7b561 presence.js: Make get_status return active for logged in user. 2017-05-12 14:28:23 -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
958ed20a0f Only render one stream at a time for editing.
We used to render the subscriptions_settings template for every
stream when you loaded "Manage Streams," which can be very slow
for a big realm.  Now we only render the right pane on demand.
2017-05-11 08:46:52 -07:00
Steve Howell
f60a829b4d Remove lightbox.is_open property.
Outside of lightbox.js, we now use modals.lightbox_open() to
detect that the lightbox modal is open.
2017-05-10 09:46:21 -07:00
Steve Howell
5c52495b64 Use modals.settings_open().
We now uses modals.settings_open() to check for the settings
modal being open, rather than doing a regex check on
windows.location.hash.
2017-05-09 18:44:08 -07:00
Steve Howell
0a0f567aeb Split out markdown.js from echo.js.
The new module handles markdown rendering.

The code left behind in echo.js does local-echo kind of things
like reifying message ids.
2017-05-09 11:06:10 -07:00
Mahim Goyal
49fec57768 Add hotkey for narrowing to next unread topic.
Fixes: #4199.
2017-05-09 10:02:54 -07:00
Steve Howell
70d4ac93ce Add modals.info_overlay_open().
This also removes ui_state.js, since its last function
is now replaced by modals.info_overlay_open().
2017-05-09 09:19:27 -07:00
Steve Howell
742c55f514 Speed up key handling by adding modals.is_active().
The function modals.is_active() can see if modals are open
without having to look at the DOM.  This should make it snappier
to type in the compose box.  Even if the speedup is pretty minor,
not having to worry about jQuery slowness should make it easier
to diagnose future compose box issues.

The new function gets used in other places, too, where performance
isn't so much an issue.
2017-05-08 22:04:56 -07:00
Mahim Goyal
6464514ca9 Break compose.js and drafts.js dependency. 2017-05-08 14:43:49 -07:00
Brock Whittaker
2ae23054ee informational-overlays: Focus overlay body on shortcut "?".
This focuses the body content of the informational overlay after
going to it from "?" so that you can use up and down arrows to then
scroll the content easily.

Fixes: #4480.
2017-05-05 09:53:58 -07:00
Jack Zhang
df817f12f4 emoji: Rename reaction-popover to emoji-popover.
The name emoji-popover should now be more appropiate, as there's no more
need to distinguish between reacting to messages and composing messages.
2017-04-30 15:15:33 -07:00
Jack Zhang
a9505654da emoji: Replace the old compose emoji picker with the reactions picker.
This removes the old compose emoji picker in its entirety, changing
the few callbacks needed to launch the reactions-style emoji picker
instead and hook it up properly.

Callbacks for reactions and composing messages are distinguished by
selecting for, respectively, the .reaction and .composition classes.

Fixes #4122.
2017-04-30 15:14:42 -07:00
Jack Zhang
f8b3ce7d15 emoji: Move all emoji picker logic/events into emoji_picker module.
Added emoji_picker.js to static asset pipeline.
2017-04-30 14:13:36 -07:00
fionabunny
d3e7e6542a home.py: move user_profile full_name to register_ret.
Move the user_profile data section down into fetch_initial_state_data
so it entirely pulls from register_ret for #3853.
2017-04-28 23:31:28 -07:00
Tim Abbott
df8f4a837c home: Get page_params.enable_desktop_notifications from register_ret. 2017-04-28 23:15:35 -07:00
Tim Abbott
2a16cc1d24 home: Get enable_stream_desktop_notifications from register_ret. 2017-04-28 22:01:46 -07:00
Tim Abbott
2a8a101fe2 home: Get page_params.enable_stream_sounds from register_ret. 2017-04-28 21:56:58 -07:00
Tim Abbott
30db811167 home: Get page_params.enable_sounds from register_ret. 2017-04-28 21:54:05 -07:00
fionabunny
78bcbc79d6 home.py: move people_list as realm_users to register_ret.
Simplify the page_params generation logic #3853
2017-04-28 21:33:33 -07:00
fionabunny
84c4d67916 home.py: move bot_list as realm_bots to register_ret.
Simplify the page_params generation logic #3853
2017-04-28 21:24:44 -07:00
fionabunny
70fe2eab60 home.py: move is_zephyr_mirror_realm as realm_is_zephyr_mirror_realm.
Part of #3853.
2017-04-28 21:12:16 -07:00