Commit Graph

1620 Commits

Author SHA1 Message Date
Steve Howell 06f4857221 buddy list: Make Group PMs appear more quickly.
It used to be the case that you would get new messages for a
huddle, but the huddle wouldn't show up on your buddy list until
the every-50-seconds mass update of the buddy list.

Now we make sure to work with non-stale jQuery objects, and,
more importantly, we resize ourselves if we add new huddles.

(The resize issue arises due to some complicated heuristics
where we don't want group PMs to take up too much of the buddy
list for users who don't have many in their history.)
2016-11-11 12:02:48 -08:00
Steve Howell eef633efa0 minor: Make get_huddles() internal to activity.js. 2016-11-11 10:41:18 -08:00
paxapy ade3bda025 markdown: Fix stream link handler in corner cases.
* Fixes handling of multiple stream links and invalid stream names.
* Fixes text regex so it handle hash sign the right way.
* Adds tests for these stream link cases.
2016-11-10 19:22:19 -08:00
Igor Tokarev 852bc6b491 bugdown: Re-enable support for italics in bugdown.
Fixes: #1103.
2016-11-10 19:14:40 -08:00
Steve Howell f923320de8 topic lists: Add get_stream_name() to topic list widget. 2016-11-10 15:55:31 -08:00
Steve Howell d8b5558699 topic lists: Refactor handling of parent element.
The widget that gets built in topic_list.build_widget()
now knows how to add itself to its parent element and expose
an interface to retrieve the parent.
2016-11-10 15:55:31 -08:00
Steve Howell 853126344e Add narrow.topic() helper method.
This has similar semantics to narrow.stream().
2016-11-10 15:55:31 -08:00
Steve Howell 16e37f8874 Limit compose at-mention typeaheads to realm users.
Fixes #2240
2016-11-09 19:20:58 -08:00
Steve Howell 5e51a93688 Change stream_data.remove_subscriber() to accept user ids. 2016-11-09 15:03:08 -08:00
Steve Howell 00068f3164 Extract stream_data.unsubscribe_myself(). 2016-11-09 15:03:08 -08:00
Steve Howell 537a3b8ca8 Change stream_data.add_subscriber() to accept user_ids.
We no longer require passing in an email to
stream_data.add_subscriber(), since we only track user ids
in stream_data.js.
2016-11-08 15:49:23 -08:00
Steve Howell a03a7d4c95 peer_remove: Send user_id, not email, for unsubscribe events. 2016-11-08 15:36:29 -08:00
Igor Tokarev 07d05390bf markdown: Fix client usermention regular expression.
Fixes #993.
2016-11-06 18:37:09 -08:00
umkay f4c621ffe3 admin: Enable admins to toggle supported auth methods via UI.
Add a table to the administration page that will allow realm admins to
activate and deactivate the supported authentication methods for that
realm.
2016-11-06 16:29:35 -08:00
Steve Howell 165b6c1ff3 topic lists: Improve node test to show HTML correctly. 2016-11-05 10:38:37 -07:00
Steve Howell 1119a24ea3 node tests: Extract node_tests/topic_list.js
This moves one method over from stream_list.js.  There's still a
lot of boilerplate here, unfortunately, as topic lists have a lot
of dependencies on other parts of the system--narrowing state,
muting state, jQuery, handlebars, etc.
2016-11-05 10:38:37 -07:00
Steve Howell e17cb79701 node tests: Remove compile-settings code from templates.js. 2016-11-04 21:23:35 -07:00
Steve Howell 6a1b53a195 node tests: Remove compile-settings code from i18n.js. 2016-11-04 21:23:35 -07:00
Steve Howell 2088e8420f User user_id, not email, in peer_add events. 2016-11-04 11:37:14 -07:00
Steve Howell 17e39a88ef Remove people.test_set_people_name_dict().
We use a cleaner approach to setting up test data in echo.js to
allow us to remove the one call to test_set_people_name_dict().
2016-11-04 11:37:14 -07:00
Steve Howell 8c47f7f7db Remove people.test_set_people_dict(). 2016-11-04 11:37:14 -07:00
Steve Howell 3941334d00 Use user_ids for subscribers in stream_data.js.
We still shim a lot of methods to keep using emails, but the
internal data structure now has user_ids.
2016-11-04 11:37:12 -07:00
Steve Howell 7509f73f02 Clean up stream renaming in the JS code.
We now use stream_id as our key to rename streams, which
should prevent a few race conditions long term.  (We are
still possibly contending with other events that use
stream_name as a key, so this is not perfect.)
2016-11-04 11:30:18 -07:00
Steve Howell e1372ddf5d Add people.get_user_id(). 2016-11-04 11:30:18 -07:00
Steve Howell 2f4c7d2ef9 Clean up page_params initialization in node_tests/echo.js. 2016-11-04 11:30:18 -07:00
Steve Howell 4cd39010d1 Add people.get_person_from_user_id().
This requires the introduction of people_by_user_id_dict
and changes to people.add() and people.remove().
2016-11-04 11:30:18 -07:00
Steve Howell a2874a3fe9 node tests: Simplify compiling of templates.
Now we just have two methods of importance:

    compile_template
    render_template

The compile_template() function will automatically
(and recursively) compile any partials it depends
on and mark those as compiled.
2016-11-04 11:23:11 -07:00
Steve Howell dd4a8eeebd node tests: Extract render.find_included_partials(). 2016-11-04 11:23:11 -07:00
Steve Howell 9b97b5da13 Improve test coverage for people.get_recipient_count(). 2016-11-04 10:05:11 -07:00
Steve Howell 30e01306d9 Eliminate people.reify() and mostly ignore unknown users.
If I try to send a message to an unknown user (which is possible
for some types of realms), then I simply ignore them during the
send codepath, so that I don't later need to patch up their attributes.
2016-11-03 16:20:45 -07:00
Steve Howell 15d44f8d71 Encapsulate pm_recipient_count.
We no longer store pm_recipient_count on person objects, but we
instead use a Dict to store them.  Then the new API is this:

    people.get_recipient_count()
    people.incr_recipient_count()
2016-11-03 16:20:45 -07:00
Brock Whittaker 1432c6613b zjsunit: Remove manual need to call global.use_template.
When the render function is run now, it uses the partial_finder
function to search recursively through files for partials and add them
so that test writers don’t have to.

This means that we no longer have to do any manual work to maintain
the templates.js check that all handlebars templates are rendered by
the node tests.
2016-11-02 22:08:47 -07:00
paxapy 2f711a070d bugdown: Add autocomplete for #StreamName links.
Fixes #1858.
2016-11-01 20:19:44 -07:00
Steve Howell 8c9488a904 Add topic_list.build_widget().
This gets us closer to a component model for topic lists.
2016-11-01 19:30:41 -07:00
Steve Howell aca6ba182e Render topic list items individually.
This is a precursor to being able to find topic list
items without the complexity of iterate_to_find().
2016-11-01 19:30:41 -07:00
Steve Howell d70ac2fc0d Remove obsolete code for page_params.people_list.
The only module that uses people_list now is people.js, and that's
only during the page load process.
2016-11-01 13:55:48 -07:00
Steve Howell 40ec0189e4 Use people.get_all_persons() in at-mention typeaheads.
This is more robust than using page_params.people_list.
2016-11-01 13:55:48 -07:00
Steve Howell 06d7012113 Use people.get_all_persons() for search_suggestion.js.
This is better than using page_params.people_list, which may
go out of sync when live updates happen.
2016-11-01 13:55:48 -07:00
Steve Howell 2d945d7296 Add people.get_realm_persons(). 2016-11-01 13:55:48 -07:00
Steve Howell aa07b32d58 Add people.get_all_persons(). 2016-11-01 13:55:48 -07:00
Tim Abbott 66e2632809 subs: Rename .subscription_name to .stream-name. 2016-10-28 14:47:22 -07:00
Steve Howell 5fd71a6381 Rename var in sidebar_subject_list.handlebars.
s/subjects/topics/
2016-10-28 13:52:25 -07:00
Steve Howell 0a4579711d Add stream_data.get_recent_topics().
This removes the last remaining references to
stream_data.recent_subjects() outside of stream_data.js.
2016-10-28 13:52:25 -07:00
Steve Howell 6a54dfc127 Remove recent_subjects from node tests.
We now use stream_data.populate_stream_topics_for_tests(),
which hides some of the implementation details of initializing
the data structure.
2016-10-28 13:52:25 -07:00
Steve Howell 8acdf718bc Move process_message_for_recent_topics() to stream_data.js. 2016-10-28 13:52:25 -07:00
Steve Howell 10bc093375 Stop using server data to draw "Manage Streams".
We have all the data we need on the client side.
2016-10-28 13:44:46 -07:00
Tim Abbott 2834a2bbbb subs: Extract subscription_settings.handlebars.
This is an early step towards being able to decouple the subscription
settings section from the slideout behavior.
2016-10-27 22:07:42 -07:00
Steve Howell f7e6cfc892 Extract topic_list.build_list().
This used to be stream_list._build_subject_list().  The code
didn't change except for one s/subject/topic fix.
2016-10-27 15:49:25 -07:00
Tim Abbott 14dc98d8b9 server_events: Switch to using REST-style URLs.
This eliminates our use of /json/get_events; we'll remove that
endpoint in a future commit.
2016-10-25 18:02:16 -07:00
Steve Howell de727245aa subs: Add subscriber counts to the /#subscriptions page.
This borrows some work from krtkmj in #525.

Fixes #483.
2016-10-25 14:40:00 -07:00
Tomasz Kolek 4790316b57 Add user setting option to always send push notifications.
Add option in user's settings for getting mobile push notifications
even if a Zulip browser is online.  Default is False.

Fixes: #1596.
2016-10-25 10:52:29 -07:00
sonali0901 1bc7990327 Extract people.filter_people_by_search_terms()
This code used to be in subs.js, but now it's in people.js and has
some unit tests.

I did this w/showell as part of live coding on Zulip.
2016-10-20 21:44:26 -07:00
hackerkid bca1953aa4 Add support for !gravatar syntax in echo.js. 2016-10-20 14:40:45 -07:00
hackerkid 95b5ac1d5d Add support for !avatar syntax in echo.js. 2016-10-20 14:40:33 -07:00
Steve Howell d26942e72d Extract stream_list.create_sidebar_row().
This replaces add_stream_to_sidebar(), which was kind of a misleading
name, and it also adds a couple lines of code that were always
called right after calling add_stream_to_sidebar().
2016-10-17 19:58:23 -07:00
Steve Howell 869a124d7d Extract stream_data.get_streams_for_settings_page().
This function will make it easier to unit test upcoming
changes related to stream counts.

This was mostly moving code, but one change is that we
don't call create_subs() in subs.js any more (which would
have been kind of circular dependency), since the only thing
that it did besides calling a more appropriate function
in stream_data.js was to generate a trigger that was
subsequently ignored and possibly a UI trap, as we don't
want to be messing with the stream sidebar when we go into
the stream settings page.

We now simply call exports.create_sub_from_server_data() for
newly encountered unsubscribed streams (which don't belong in
the sidebar anyway.)
2016-10-17 19:58:23 -07:00
Steve Howell 965c6047db Move add_admin_options() to stream_data.js.
This function used to live in subs.js.  It's mostly a code move,
but I simplified the logic to determine whether it's subscribed
not to do a lookup into the same data structure that the sub
already came from.

I also added some tests.
2016-10-17 19:58:23 -07:00
reyha 537c9755bf search: Fix searching for URLs.
Previously, URLs were being incorrectly treated as unknown search
operators (since they had exactly one ":" in them, just like foo:bar
for an invalid choice of foo).

Fixes #1743.
2016-10-16 15:25:46 -07:00
Tim Abbott d2be9241f2 feature_flags: Eliminate always true negated_search feature. 2016-10-11 20:50:47 -07:00
Kartik Maji 9807ec6539 Fix phrasing when re-subscribing user to a stream. 2016-10-11 18:19:57 -07:00
Umair Khan 36c6a5d758 Add support for changing user's name by admin.
Fixes: #1553
2016-10-11 16:36:48 -07:00
Ilona Brand 4bf908c2d6 Add emoji map to the compose box.
- Expand a box full of emojis into the
compose window for users to graphically select emojis.

- Append an emoji to the end of the message when a user
clicks the emoji in the emoji box.

- Trap the escape key to always close the emoji box
before closing anything else if the box is open.

- Fixes: #147.
2016-10-10 16:12:25 -07:00
Brock Whittaker ff3d5ca4db Separate display settings from settings_tab.handlebars.
This separates the display settings module from the
settings_table.handlebars template.

Additionally, it fixes the node tests to search in the
static/templates/settings directory and initialize any templates in there
while running tests on the settings templates.
2016-10-05 22:26:40 -07:00
Tim Abbott 49bea381b7 zjsunit: Fix running stream_data and node tests individually.
These tests failed if you ran them along with:
 `ReferenceError: $ is not defined` errors.

Fixes #1909.
2016-10-04 18:38:17 -07:00
Sahil Dua 058587da77 Remove extra new lines at the ends of Zulip authoried files.
Fixes #1627.

[tweaked by tabbott to avoid patching third-party modules, for now]
2016-09-26 21:05:24 -07:00
umkay 82d03d603a Update Pygments to latest upstream version.
In HTML, the line break immediately following a start tag is ignored
(see: https://www.w3.org/TR/html4/appendix/notes.html#h-B.3.1). An
extra span tag has been introduced in the upstream Pygments
HtmlFormatter in order to preserve the first new line. The Bugdown
Tests as well as our fenced_code.js frontend markdown processor have
been updated to reflect this new behavior.
2016-09-12 21:58:25 -07:00
Steve Howell e53b0f564f subject/topic: Rename unread_subjects to unread_topics. 2016-08-26 20:26:24 -07:00
Brock Whittaker 64079b382f Channel popup unsubscribe button.
From the popups that appear when clicking the down-arrow in the left
column's streams, you can now unsubscribe from that particular
channel. This runs on the same function that unsubscribes you from
streams in the "Subscriptions" tab.

Fixes: #1554.

[tweaked by tabbott to fix some errors]
2016-08-26 20:22:11 -07:00
Brock Whittaker 8f73701b96 Upgrade jQuery to 1.12.1 and fetch from node_modules.
Fixes: #1196.
2016-08-25 15:32:08 -07:00
Steve Howell 4dbeb66a4c tests: Add render.init() to node tests.
This makes sure we are explicit about partials in
individual test modules.  Eventually, we should figure
out a way to make partials automatically compile as
part of the node tests.
2016-08-25 13:56:08 -07:00
Steve Howell 8e38503d8c tests: Add sidebar_private_message_list() template test. 2016-08-25 13:56:08 -07:00
Tomasz Kolek b1b864341c Fix @all spam warning when typing @all in backticks.
When user'd like to send a message with @all in backticks
they see spam warning in spite of the fact that nobody
would be alerted.

Fixes: #1505.
2016-08-18 16:10:09 -07:00
Steve Howell 01d28458fc Add frontend_tests/node_tests/dispatch.js.
This tests the dispatching code in server_events.js.
2016-08-09 18:49:13 -07:00
Steve Howell 48af751e8d Clean up server_events.js (minor stuff).
Make exceptions more clear and upstream patching of builtins to index.js.
2016-08-09 18:49:13 -07:00
Steve Howell ebe76dd2c3 Add stub_out_jquery() for node tests. 2016-07-30 14:54:30 -07:00
Steve Howell 6ce8f3da6d Fix node tests to be able to run standalone.
These tests would work as part of the whole suite, but
not standalone, because they were getting objects out
of node's require cache that a previous test had cleaned up.

Now they should work standalone as well, and the tests
are more explicit about their dependencies.
2016-07-30 14:54:30 -07:00
Steve Howell 55d8a1e960 Remove unneeded require in node_tests/activity.js 2016-07-30 14:54:30 -07:00
Steve Howell 6a65b3482c Move index.js to frontend_tests/zjsunit. 2016-07-30 14:54:30 -07:00
Steve Howell c57bbf6c77 Introduce index.html for test-js-with-node output.
We now have an index.html for test-js-with-node output
that links to specific HTML files for various handlebar
tests.
2016-07-29 22:07:24 -07:00
Steve Howell 1d7a6c9941 Fix output from test_tr_tag_settings().
For its HTML output, it was using a wrong label and a CSS
setting that clobbered other output.
2016-07-29 22:07:24 -07:00
Steve Howell f301ccdb3e Move source code for settings_tab() in templates.js 2016-07-29 22:07:24 -07:00
Steve Howell b3553859f9 Move source code for propagate_notification_change() in templates.js 2016-07-29 22:07:24 -07:00
Steve Howell 9e8bff5628 Move source code for message_edit_form() in templates.js 2016-07-29 22:07:24 -07:00
Steve Howell 83a92704ee Move source code for admin_tab() in templates.js 2016-07-29 22:07:24 -07:00
Steve Howell ec12ea5773 Consolidate bookend tests in node_tests/templates.js.
In templates.js we want to enforce outputting just
one output file per template, and we also keep the source
alphabetical by template name.  This isn't a permanent
decision, but it makes organizing the ouput a little
easier for now.
2016-07-29 22:07:24 -07:00
Steve Howell 5a3a4595f1 Move source code for admin_emoji_list() to top of its file.
We alphabetize the functions in node_tests/templates.js.  This
makes it easier for the test output to be rendered in order.
2016-07-29 22:07:24 -07:00
Steve Howell 87dbdaac68 Extract write_handlebars_output() in node tests. 2016-07-29 22:07:24 -07:00
Steve Howell 6b8e2c406b Write node test output to var/test-js-with-node/output.html
This also fixes some CSS path issues that were regressed
when files were written to 'var.'
2016-07-29 22:07:24 -07:00
Tim Abbott beedfb2939 Revert "[third] Upgrade jquery to version 1.8.3."
This reverts commit be93b6ea28.

Unfortunately, the newer jquery comes with a huge performance
regression affecting the hotkeys code, which has the effect of making
typing super slow.

Fixes: #1449.
2016-07-28 11:39:06 -07:00
Tim Abbott 375551aaa6 Clean up most hardcoding of mit.edu domain checks.
This moves all this code to be gated on a few virtual realm settings.
2016-07-26 20:30:12 -07:00
Taranjeet Singh 9b31f0a67a node tests: Move .test-js-with-node.html to var/." 2016-07-20 18:23:56 -07:00
Tim Abbott be93b6ea28 [third] Upgrade jquery to version 1.8.3.
Also use the modern NPM name of 'jquery' (all lower case), which is
required as part of this migration.

Fixes #1141.
2016-07-08 11:09:54 -07:00
Tomasz Kolek c15695e514 Add support for running test-js-with-node on particular files.
Fixed: #1127.
2016-07-07 14:32:07 -07:00
Kartik Maji f8bb7503e6 Add ability to pin streams to top of the streams sidebar list.
Based on work by Lauren Long, with some tweaks by tabbott.
2016-06-30 22:26:09 -07:00
Alex Wilson b040839c76 Add unicode emoji to frontend markdown parser.
Fixes 2nd half of #1011.
2016-06-30 15:48:02 -07:00
Alex Wilson 434c8d4b08 Add codepointat.js, a polyfill for String.prototype.codePointAt(). 2016-06-30 15:48:02 -07:00
Preston Hansen 57dec15c6c Update alert word UI to match the style of bots.
Resolves #1075.
2016-06-24 16:43:19 -07:00
Umair Khan c8d139b2b1 Fix emoji urls interaction with i18n.
When accessing emojis with relative urls we should start the urls with
a slash so that language code doesn't become part of these urls.

Fixes #1014.
2016-06-13 09:10:11 -07:00
Vishnu Ks f9f31b79d0 Make default_streams web controllable.
Fixes: #665
2016-06-09 15:24:32 -07:00
Caroline Liu 60e5140406 Add warning for @all / @everyone.
* The warning contains a count of the number of people in the stream.
* An error appears if the warning is ignored and the user tries to
  send the message anyway.
* The message cannot be sent until the warning is acknowledged or @all
  / @everyone is removed.
* This only applies to stream messages and not private messages.

Fixes #853.
2016-06-09 14:38:58 -07:00
Tim Abbott b25562ca1d Add and use util.is_current_user helper function.
Previously, we were checking if a particular user was the current user
in dozens of places in the codebase, and correct case-insensitive
checks were not used consistently, leading to bugs like #502.
2016-06-07 21:58:44 -07:00
Givorenon 0bf2d171ae Fix fading of messages in dialog and users in side-bar.
Make comparison of emails in compose_fade.js and util.js
case-insensitive to fix fading of users and messages respectively.
2016-06-07 21:31:47 -07:00
Vishnu Ks d30ea0bc44 Move recent_subjects to stream_data. 2016-06-07 17:50:16 -07:00
Umair Khan 82b5d9304b [third] Integrate i18next with Handlebars 2016-05-19 22:58:25 -07:00
Kartik Maji 3d77aa49db Add subscribe button in narrowed view when stream has no messages.
A temporary message appears on successful subscription, with a button
offering to unsubscribe in case the user subscribed by accident.
2016-05-18 20:06:30 -07:00
Kartik Maji 206452c867 Add stream subscription button added narrowed views.
Fixes: #273
2016-05-18 20:06:23 -07:00
Tim Abbott 5bd94c15c7 Use camo to avoid mixed content warnings when displaying emoji. 2016-05-02 17:21:31 -07:00
Vladislav Manchev f5e6176aea Add custom realm emoji UI to administration page. 2016-04-26 13:15:54 -07:00
Vishnu Ks ae49ad383d Rename all function on MessageList to all_messages. 2016-04-25 13:45:18 -07:00
Vishnu Ks 35b0af2852 Move all_msg_list to message_list.js. 2016-04-21 17:46:21 -07:00
Vishnu Ks ee39f5009f Make message_list.js work like the other modules. 2016-04-20 15:29:30 -07:00
Tim Abbott a72385246e Fix missing whitespace after '=' in python/js code. 2016-04-20 11:36:14 -07:00
Tim Abbott 93b3feda43 Fix node test broken by reloading changes. 2016-03-30 23:40:00 -07:00
Kartik Maji 2b3312cd6e Update unread counts for streams when muting topics.
Fixes #427.
2016-03-27 13:49:52 -07:00
Tim Abbott 29b8d71871 Remove throttling of presence updates coming from server events.
Now that we're doing presence updates in a performant fashion, we
don't need to throttle processing these events, and in fact the
throttling of these events created a correctness problem, since we're
now doing incremental updates rather than just rerendering everything
after each event.
2016-03-21 20:28:05 -07:00
Varshit 72033069ed Extend lint-all to check for newlines at the end of files. 2016-03-17 23:03:56 -07:00
Vladislav Manchev 668d0d9dfa Fix performance issues with user presence list in large realms.
Whenever a user became active, this triggers an immediate presence
update event (to show that user as active).  The implementation for
that event (running on the browsers of all other users in the realm)
would fully rerender the presence list, which can be an expensive
operation in a large realm, just to update the status for that one
user.  This fixes that case to just remove the user from the list and
then re-insert it at the appropriate index.

[Commit message expanded with more details by Tim Abbott]
2016-02-12 20:04:43 -08:00
Kara McNair fd66d9f703 Show 5 most recent "Private messages" when clicked.
Like the Stream Subject lists, Private messages are now shown
when the user clicks on the "Private message" link. User can drill in
to get more than 5 conversations. Selecting PMs from the user or group
PM lists on the right sidebar also opens the list & highlights the
selected conversation.

[Edited by tabbott@mit.edu to fix some small bugs.]
2015-12-15 07:52:54 -08:00
Allie Jones 4de0325a9d Install node dependencies using npm.
The node packages 'jQuery' and 'jquery' are different--'jQuery' is the
legacy support package that is needed for Zulip so the require statements
in the tests were updated.

Travis uses node 4.0 by default and we are using 0.10, so the command to
install the correct version had to be added to the .travis.yml file.
2015-11-06 09:08:59 -08:00
Tim Abbott 10657c1d53 Move node tests to node_tests/. 2015-10-28 10:11:47 -07:00