Commit Graph

8262 Commits

Author SHA1 Message Date
Tim Abbott 370b38696a test_messages: Fix broken huddle messages test.
The second login call was failing because the user didn't exist.
2016-06-27 11:48:36 -07:00
rahuldeve e985b57259 Add authorization check before serving files. 2016-06-27 11:24:35 -07:00
rahuldeve 674def30ee Add support for serving files using API authentication.
Also remove 'get_uploaded_file' view function and the corresponding
old '/user_upload/' url pattern.
2016-06-27 11:00:41 -07:00
rahuldeve 823bf15c6e Add API route for uploading files. 2016-06-27 10:30:58 -07:00
acrefoot e4ed9195dc Remove rest_dispatch hack and optimize imports.
For a long time, rest_dispatch has had this hack where we have to
create a copy of it in each views file using it, in order to directly
access the globals list in that file.  This removes that hack, instead
making rest_dispatch just use Django's import_string to access the
target method to use.

[tweaked and reorganized from acrefoot's original branch in various
ways by tabbott]
2016-06-24 16:11:03 -07:00
Tim Abbott 45beac7d6c test_decorators: Add test for /json/fetch_api_key. 2016-06-21 16:14:22 -07:00
Tomasz Kolek 7aa45ffa45 Increase send_message_backend coverage. 2016-06-21 14:33:21 -07:00
Tim Abbott 50f723f50b Split test_narrow.py out of test_messages.py. 2016-06-21 12:25:08 -07:00
Tomasz Kolek e3e03e2946 Add NarrowBuilder test cases.
Refactor existing add_term test cases.
2016-06-21 11:53:31 -07:00
Tomasz Kolek f8c368c07f Add default-bot during populate_db. 2016-06-21 11:47:38 -07:00
Tomasz Kolek 9ae68ade8b Add is_webhook option to authentication decorats.
Modified:
authenticated_rest_api_view
authenticated_api_view and validate_api_key.
2016-06-21 11:47:38 -07:00
Vishnu Ks ad1c3894d9 Add interface for creating new realms.
This is controlled by settings.OPEN_REALM_CREATION; if that setting is
off, this feature doesn't do anything.
2016-06-17 16:15:28 -07:00
kunall17 007eee6061 Add route to fetch emails for mobile passwordless login.
[Tweaked by tabbott to rename API to explicitly support not just
Android]
2016-06-17 11:03:19 -07:00
kunall17 7ea0eaed1c Add passwordless login for mobile app development.
[Tweaked by tabbott to rename API to explicitly support not just
Android].
2016-06-17 10:58:33 -07:00
Tomasz Kolek 76cbe89613 Add IFTTT integration. 2016-06-16 15:30:45 -07:00
Tim Abbott 33df0b29d3 Annotate zerver/tests/test_hooks.py. 2016-06-16 14:07:34 -07:00
Tim Abbott 5b05644c95 Run mypy on zerver/tests/test_hooks.py. 2016-06-16 14:07:34 -07:00
Tim Abbott 6723525fd3 Annotate zerver/tests/tests.py. 2016-06-16 14:07:34 -07:00
Tim Abbott 45883386ce AlertWordTests: Cleanup confusing message variable reuse. 2016-06-16 13:55:58 -07:00
Tim Abbott 10dd9addb7 Fix ChangeSettingsTest caching issue causing test failures. 2016-06-15 14:57:58 -07:00
Tim Abbott 06079042d4 ChangeSettingsTest: Move login to test helper method. 2016-06-15 14:28:24 -07:00
Tim Abbott 8f67b7e498 Simplify check_for_toggle_param. 2016-06-15 14:23:51 -07:00
Ashish Kumar 0a98d9edcf Add test_enter_sends_setting. 2016-06-15 14:23:51 -07:00
Ashish Kumar 8a55098ca7 Add test_time_setting. 2016-06-15 14:23:51 -07:00
Ashish Kumar 345df3538f Add test_toggling_left_side_userlist. 2016-06-15 14:23:51 -07:00
Ashish Kumar 24767302c4 Update test_ui_settings to use new abstraction. 2016-06-15 14:23:51 -07:00
Ashish Kumar 006e528e18 Update test_notify_settings to use new abstraction. 2016-06-15 14:23:51 -07:00
Ashish Kumar 5ae06e8c33 Added test helper function: check_for_toggle_param 2016-06-15 14:18:55 -07:00
Tomasz Kolek 4e51a86ea4 Add updownio integration. 2016-06-14 12:14:07 -07:00
Tomasz Kolek 14d69348d3 Add Airbrake integration. 2016-06-13 20:36:40 -07:00
Tim Abbott 6c78036811 Add tests for upload title functionality. 2016-06-13 19:44:56 -07:00
Eklavya Sharma 6f5ed6e7c9 Fix annotations clashing with Stream model fields. 2016-06-13 20:01:02 +05:30
Eklavya Sharma c654c4032d zerver/models.py: Annotate get_display_recipient.
get_display_recipient's annotation clashes with other wrong annotations.
Fix those wrong annotations.
Since get_display_recipient returns a Union, use isinstance checks and
casts to make mypy checks succeed.
2016-06-12 23:34:57 +05:30
Tim Abbott 7c80456321 Fix and re-enable test_file_upload_authed.
Now that we have a working S3 mock and an effective way to toggle the
upload backend that Zulip is using, we can re-enable this important
end-to-end test of the Zulip S3 upload backend.
2016-06-09 23:07:24 -07:00
Tim Abbott 719e5487b9 upload: Use classes to define S3/Local upload backends.
This has no functional changes; we just replace the old hacky
assignment of functions with assignment of the upload backend to a
variable.

I'm not totally happy with this, because we end up having to copy the
type annotations of the three methods 4 times each, but this should
make it a lot easier to test the (non-default-in-tests) S3 backend
using end-to-end tests, which would have caught
13bac1cc2a.

I expect we'll iterate on the interface over time; ideally, I'd like
all the code that checks LOCAL_UPLOADS_DIR to be inside upload.py, and
primarily in these classes.
2016-06-09 22:45:03 -07:00
Vishnu Ks f9f31b79d0 Make default_streams web controllable.
Fixes: #665
2016-06-09 15:24:32 -07:00
Tim Abbott e14732a12c Remove unused test_beankstalk_message function. 2016-06-07 21:27:29 -07:00
Tomasz Kolek 2ac9c792f3 test_hooks: Use an incoming webhook bot for webhook tests. 2016-06-07 21:27:04 -07:00
Umair Khan 5becd53414 Add tests for json_error and JsonableError. 2016-06-07 12:41:59 +05:00
Deborah Hanus a261a6bbac Annotate zerver/views/__init__.py.
Also fix typing errors in a few related files.

[with tweaks from tabbott]
2016-06-05 11:34:19 -07:00
Tomasz Kolek 8411b2e574 Add Crashlytics integration. 2016-06-04 15:18:42 -07:00
Tomasz Kolek 093e5a96d4 Add Transifex integration.
Fixes: #810.
2016-06-04 14:52:57 -07:00
Tim Abbott 6fba0879a4 Annotate much of the rest of zerver/tests. 2016-06-04 11:53:20 -07:00
Tim Abbott 27e9d3f06b Annotate test_external and test_signup. 2016-06-04 11:53:20 -07:00
Tim Abbott 966375d74c Annotate test_events, test_realm_emoji, test_uploads. 2016-06-04 11:53:20 -07:00
Tim Abbott f1d58e767b Annotate zerver/tests/test_subs.py.
This required a number of unique-related changes to test_helpers.
2016-06-04 11:53:10 -07:00
Tim Abbott 2ec0114079 test_bugdown: Add tests for mentions. 2016-06-03 23:18:39 -07:00
Tim Abbott cfff4f1d49 test_bugdown: Add a bugdown test for alert_words functionality. 2016-06-03 23:18:39 -07:00
Tim Abbott 8c757292cf test_bugdown: Add test for nonmatching realm filters. 2016-06-03 23:18:39 -07:00
Tim Abbott 3a0eb01dda test_messages: Fix huddle test failing when not on Internet. 2016-06-03 23:18:39 -07:00
Tim Abbott 68fba3579d test_bugdown: Add testing of subject_links feature. 2016-06-03 23:18:39 -07:00
gregmccoy d77e8df3fa Add tests for zerver/views/realm_emoji.py. 2016-06-03 23:12:53 -07:00
Vishnu Ks 4fd569f910 Change add_default_stream method from PATCH to PUT.
This is more consistent with our other routes.
2016-06-03 09:52:51 -07:00
Nathan Florea 04c71fadc6 More removal of mutable default arguments.
I've left a few that clearly aren't being passed and aren't being mutated, but
I think I've gotten the rest of them.
2016-06-03 09:17:04 -07:00
Tim Abbott 37015fd7c5 Run mypy on zerver/lib/test_auth_backends.py. 2016-06-02 23:01:15 -07:00
Tim Abbott 8cef9675c8 Run mypy on zerver/lib/test_events.py. 2016-06-02 23:00:04 -07:00
Tim Abbott e6d2b0cdbc Run mypy on zerver/lib/test_unread.py. 2016-06-02 22:59:00 -07:00
Tim Abbott f3b07ee9aa Run mypy on zerver/lib/test_subs.py. 2016-06-02 22:57:07 -07:00
Rachel Kelly df36216914 Change instances of 'coworkers' to 'users'.
In order to genericize use of Zulip outside companies,
    all instances of coworkers have been changed to users.
    NOTABLE EXCEPTION: When the Zulip instance is domain-
    locked, the reference to coworkers remains.  The reason
    for this is twofold: first, the majority of Zulip instances
    which require a particular domain will be locked to a
    company, and second, the template variable for the domain
    necessary should be added to the alert so it is clear
    to the user what the domain needs to be for access.

Fixes: #861.
2016-06-02 16:05:27 -07:00
Umair Khan 08fbd57245 [i18n] Make error messages translatable.
Make all strings passing through `json_error` and `JsonableError`
translatable.

Fixes #727
2016-05-31 07:40:42 -07:00
Vishnu Ks 100d885f23 Change default announcement stream to announce.
Fixes #788.
2016-05-31 07:38:07 -07:00
Umair Khan 9a57176ad6 Do shallow testing of backend templates.
Just render the templates without the actual workflow to see if they
don't return a 500 error; this lets us catch various classes of
template bugs automatically.

Fixes #784.
2016-05-31 05:42:17 -07:00
Tim Abbott 572c69f3c2 Move REQ and friends to their own module. 2016-05-30 11:24:17 -07:00
Tomasz Kolek 8c18b8947f Add bot_type field to UserProfile.
This is intended to support creating different types of bots with
potentially limited permissions.
2016-05-19 22:37:37 -07:00
Umair Khan f9bbc5d6ff Enable i18n support in URL configuration.
This supports i18n using all of the following:
- I18N urls
- Session
- Cookie
- HTTP header
2016-05-19 08:33:30 -07:00
Aristeidis Fkiaras 3ee210d9e8 Add setting to only allow admins create new streams.
Fixes: #691.

Thanks to Preston Hansen for work on this feature!
2016-05-18 18:53:13 -07:00
Tim Abbott e781136132 Fix subscribing to existing streams when can_create_streams=False.
Previously, a user with can_create_streams=False would be incorrectly
unable to subscribe to streams, whether the streams previously existed
or not.
2016-05-18 18:47:24 -07:00
Tomasz Kolek c4254497b2 Add WebhookTestCase abstract class for writing webhook tests.
This cuts a ton of code duplication and semi-duplication between the
webhook tests, and thus should make it a lot easier to write new ones.
2016-05-18 14:37:31 -07:00
Umair Khan dfc58b0ed0 Upgrade digest email templates to Jinja2.
Fixes: #780
2016-05-13 01:01:28 +05:00
Tomasz Kolek eeeb4d0c92 Add CircleCI integration.
Fixes: #617.
2016-05-11 21:17:37 -07:00
Tim Abbott f2aee961e1 test_auth_backends: Fix unused variables. 2016-05-10 11:46:39 -07:00
Tim Abbott 92bec8cfea Merge Zulip 1.3.12 security release. 2016-05-10 11:32:26 -07:00
Tim Abbott 620debc5fd Change PrincipalError to return status code 403 by default. 2016-05-10 09:50:57 -07:00
Tim Abbott 85c64c9f93 zulip_login_required: Add checks for active users and realms.
Like the recent change blocking JSON endpoints for deactivated users
and users in deactivated realms, this change is a hardening
improvement.  Those users should be unable to get an active session
anyway, but if somehow one is leaked, this means they won't be able to
access any user data.
2016-05-10 09:50:57 -07:00
Tim Abbott be216506a9 Improve api_fetch_api_key error messages.
Previously, api_fetch_api_key would not give clear error messages if
password auth was disabled or the user's realm had been deactivated;
additionally, the account disabled error stopped triggering when we
moved the active account check into the auth decorators.
2016-05-10 09:50:57 -07:00
Tim Abbott 52ddd500f0 Add tests for authentication backends. 2016-05-10 09:50:57 -07:00
Tim Abbott 38c82083de Add test suite for deactivated users. 2016-05-10 09:50:57 -07:00
Tim Abbott df7466e893 Add test suite for deactivate realms. 2016-05-10 09:50:57 -07:00
Tim Abbott b4ccca300b Add tests for whether API keys appear in initial state data. 2016-05-10 09:50:47 -07:00
Tim Abbott b869be9301 style: Use 'not in' consistently rather than `not foo in`. 2016-05-09 17:00:10 -07:00
Tim Abbott f02571202a EventsRegisterTest: display full error diffs. 2016-05-09 10:12:35 -07:00
Preston Hansen 635828069f Add feature to mark all in stream/topic as read with mouse.
Fixes #736.
2016-05-08 09:02:46 -07:00
Tomasz Kolek c2de38239e Add payload validation to has_request_variables and REQ tasks.
[with tweaks by tabbott]
2016-05-07 11:54:09 -07:00
rahuldeve 899bfb97ee Add tests for managing uploads in S3. 2016-05-02 22:14:47 -07:00
rahuldeve 01fb6c77a2 Add test for managing files in Local Storage. 2016-05-02 22:14:47 -07:00
rahuldeve dde832b158 Add Attachment model to keep track of uploads.
This commit adds the capability to keep track and remove uploaded
files.  Unclaimed attachments are files that have been uploaded to the
server but are not referred in any messages.  A management command to
remove old unclaimed files after a week is also included.

Tests for getting the file referred in messages are also included.
2016-05-02 22:14:47 -07:00
Tim Abbott 5bd94c15c7 Use camo to avoid mixed content warnings when displaying emoji. 2016-05-02 17:21:31 -07:00
Tim Abbott 4644967afc dropbox preview: Remove preview_fail.png error condition.
Since we don't have a stable way to get the Dropbox preview failure
image (and it was sorta a weird setup anyway), it seems best to just
remove the condition.
2016-04-29 15:40:52 -07:00
Tim Abbott 4be3c4afd6 Use mocks so we can re-enable Dropbox integration tests. 2016-04-29 15:27:43 -07:00
Ashish Kumar 48be2e33f8 Delete old route for /json/get_public_streams. 2016-04-29 12:57:57 -07:00
Ashish Kumar b5ab4d45f9 Replace /json/get_public_streams with REST style route. 2016-04-29 12:57:57 -07:00
Antek Grzanka 646ea3214a Add Taiga integration. 2016-04-28 13:44:53 -07:00
Tim Abbott aebe7334a4 style: Fix missing :s between dict keys and values. 2016-04-27 22:23:40 -07:00
Tim Abbott 02ab03ec7a MITNameTest: Mock network access from Hesiod lookups.
The purpose of these tests is to check the logic, not that DNS is
working on the relevant machine.
2016-04-27 22:23:40 -07:00
Tim Abbott c9359bd75a test_hooks: Fix missing assert_json_success checks.
Several recently merged webhooks were incorrectly not checking that
the actual webhook result didn't return an error.  While they would
usually still fail in most cases when checking whether the message
came back correctly, this hid the root cause errors and thus made it
much harder to debug.
2016-04-27 13:25:21 -07:00
Vladislav Manchev f5e6176aea Add custom realm emoji UI to administration page. 2016-04-26 13:15:54 -07:00
Tomasz Kolek 12fc4f047c test_helpers: Create get_last_message helper. 2016-04-26 09:54:02 -07:00
Tomasz Kolek 5fbda3a9c1 Add codeship integration. 2016-04-26 09:54:01 -07:00
David Payne 8c62a27769 Add teamcity webhook integration.
This integration relies on the Teamcity "tcWebHooks" plugin which is
available at
https://netwolfuk.wordpress.com/category/teamcity/tcplugins/tcwebhooks/

It posts build fail and success notifications to a stream specified in
the webhook URL.

It uses the name of the build configuration as the topic.

For personal builds, it tries to map the Teamcity username to a Zulip
username, and sends a private message to that person.
2016-04-26 09:45:26 -07:00
David Payne ece96ef3fe Jira's "issue created" message should @-notify the assignee. 2016-04-20 10:54:30 -07:00
Tomasz Kolek 82f1cdb085 Add send_webhook_fixture_message command.
This tool simplifies the process of producing nice screenshots for
documenting webhook integrations.

Fixes #658.
2016-04-20 10:45:27 -07:00
Eklavya Sharma c7a93cba22 Add tests for checking image validity in SetAvatarTest. 2016-04-20 12:27:23 +05:30
Eklavya Sharma af7c3de5f5 Add SetAvatarTest to test_upload.py.
Test multiple file uploads for /json/set_avatar.
Test no file upload for /json/set_avatar.
Add test images for SetAvatarTest.
2016-04-20 12:23:22 +05:30
Eklavya Sharma 126273b1e7 Add a test for local file uploads. 2016-04-20 12:00:13 +05:30
Eklavya Sharma 2d60a1d0f3 Move upload-related tests to test_upload.py.
Move S3Test, FileUploadTest and SanitizeNameTests from
test_external.py to test_upload.py.
2016-04-19 16:48:30 -07:00
Tim Abbott 1bf11f6b7f Split FileUploadTest out of S3Test.
S3Test is now only the S3-specific test (which isn't even run), so we
can now invest in making FileUploadTest have good coverage of the
(local) file upload code paths.
2016-04-14 10:35:10 -07:00
Tim Abbott f6edc21981 Change stream used in test_get_old_messages_with_only_searching_anchor.
This prevents this test from breaking when in a few commits we fix a
nondeterminism issue in the populate_db test fixtures.
2016-04-13 13:19:02 -07:00
Tim Abbott 47879c5e00 Fix nondeterminism in test_successful_subscriptions_add.
Previously this test would fail if the streams list generated by
populate_db contained more than 2 streams.
2016-04-13 13:18:24 -07:00
Tim Abbott fb55fcef1e Fix missing zerver/tests/__init__.py. 2016-04-11 22:34:22 -07:00
Tim Abbott be96cf809d Move Zulip backend tests to zerver.tests. 2016-04-11 22:16:09 -07:00
Tim Abbott f1074aa491 Move frontend tests out of zerver/tests/.
This fixes an unfortunate bug where the backend tests in
zerver/tests.py were not being run automatically, and also makes these
a bit easier to find.
2015-10-28 10:11:47 -07:00
Steven Oud d5435fad1d Consistently use /usr/bin/env python2.7 in shebangs and commands. 2015-10-21 22:58:21 +00:00
Tim Abbott e8e38e911b Fix casperjs tests in Travis CI.
For reasons I don't understand, it appears that in Travis CI we're now
seeing errors using Casper that seem to correspond to a compatibility
issue introduced in PhantomJS 2, even though we're still using 1.9.8.

The solution for that compatability issue of patching casper's
bootstrap.js to get arguments from system.args at a slightly different
time than before seems to work in our setting as well, and that's what
this implements.

Probably the right long-term solution involves upgrading both
phantomjs and Casper to the latest versions.
2015-10-14 21:49:09 -04:00
Tim Abbott eff0d31dcd Fix existing tab-based whitespace in the codebase.
(imported from commit 3bd8f51d1bb303455597d238af47b1b5541aed04)
2015-09-19 23:23:02 -07:00
Tim Abbott 36445d1576 Fix running single frontend tests using just the test-names.
(imported from commit 0b93abc0379b0a2ec900fe317843a7839258f7a9)
2015-09-19 15:51:26 -07:00
Anders Kaseorg 2e5c82203d Fix 05-settings.js test
The tests run as iago, who is now an administrator and therefore has
control over many more bots.  Be specific about which bot to operate on.

(imported from commit 7a9d3e12da905338624747dd402702bb66907cfd)
2015-08-22 12:52:44 -07:00
Reid Barton 3649c7be73 Display instructions for debugging the frontend tests when they fail
(imported from commit 21f7e6adf1f3f500ce1faf3667f40674bf0f3d6e)
2015-08-21 15:04:50 -07:00
Tim Abbott 1880e96a22 Fix tests broken by twenty-four-hour-time feature.
(imported from commit 4f6215b303de8e27323141f687e046048f1456b5)
2015-08-20 17:59:16 -07:00
David Roe e5cb2a468f Enable Lab features for all users
(imported from commit 4e2658d28a5e02067ad472fec76c66f46592d520)
2015-08-20 15:29:45 -07:00
Reid Barton 5a747ab690 Make the CasperJS frontend tests work again
(At least when PhantomJS doesn't crash...)

(imported from commit 62936b12883e4c6bbd3701da80783b4bffe46025)
2015-08-20 13:33:07 -07:00
Waseem Daher 6ff3070c8e Fix test related to bots form.
After I reverted the change to the bot stetings page, this
broke a test. This commit fixes that.

(imported from commit 394b29fea4f75096f7cb8d819145a9adc386276b)
2014-07-29 21:46:34 -07:00
Jason Michalski 80db1b9feb Fix test to not depend on timezones
Use UTC milliseconds from epoch not string formated time in tests.

(imported from commit c1f23367fd9e4d9b11a8fd58efb8b4b4b6980552)
2014-04-01 20:57:06 -07:00
Jason Michalski 55e762b069 Fix bug with date separators when prepending messages
When the date changes between an existing group and a new group the
existing date separator needs to be updated. This is done by rerendering
the existing group.

(imported from commit a3775815e33872b0ec07704dc7ccf5fd2671fa21)
2014-03-29 22:00:00 -04:00
Jason Michalski 94279c0522 is_me_message is an attribute of the message not the message_container
(imported from commit db36e529de92a82bb9c5df97030833ca2e3e0f80)
2014-03-19 11:43:32 -04:00
Jason Michalski 3158075405 Use the match data on the message not the message_container
(imported from commit 1289108c767732c76efc7369206ef065f2395e0d)
2014-03-18 18:24:23 -04:00
Jason Michalski e60f76487f Rename message to message_container
Now that we are not directly using message in the message list view
rename the uses of message that are message_containers.

(imported from commit 5c355703a8934a74864f5de6ecb1e2fd851e5d41)
2014-03-18 15:05:39 -04:00
Jason Michalski 1613cad6f6 Separate the global message data from the list display data
The messages being passed to the handlebars templates were global
messages which we were adding per list details to, show name bar etc.
This causes rendering bugs when you try to rerender a message, because a
different list may have changed it. This commit moves the global message
data to a msg attribute on the message_container which will contain the
per list attributes.

(imported from commit 26b1f0d2c72d6288a6d3e7ed5f8692426f2a97ad)
2014-03-18 15:02:31 -04:00
Jason Michalski c38c9cf894 Me messages should always display the sender
(imported from commit af42ed8dcb9f4bc44e66d4973b9e613302647e12)
2014-03-16 15:14:57 -04:00
Jason Michalski a9235a74f4 Split the group merging logic form the DOM update logic
The goal is to have a more data centric piece that can be unit tested.
We also try to minimise the number of one off jQuery DOM updates and
rerender handlebars fragments instead. This will prevent the
message_group and DOM from drifting apart and not being able to rerender
correctly.

(imported from commit 03f09803f2bc0c3b8187f76f2cfe90be9f7512a3)
2014-03-14 20:48:59 -04:00
Steve Howell 77e7947f61 Add test_random_int()
(imported from commit 67ab9436463b3b4ff63f657fd8cd60cdd25f6047)
2014-03-14 20:48:55 -04:00
Steve Howell 23e791a3b9 Enhance test_array_compare().
(imported from commit c6d44acd2804005a41afe6b283e11905b7e4c7c0)
2014-03-14 20:48:54 -04:00
Steve Howell a8d61fa930 Add test_normalize_recipients.
(imported from commit 9645cb471f8db01e810c9b6c396313ee4c1cf97f)
2014-03-14 20:48:54 -04:00
Steve Howell 84fc8f16dd Add test coverage for util.same_major_recipient.
(imported from commit 0b345679d2bf40c82167ded9968dd653823011bf)
2014-03-14 20:48:54 -04:00
Steve Howell b12b44579c Set up $.fn.expectOne in setup.js
(imported from commit 77922cf8f506d4eb811498d418215eabf74b76ae)
2014-03-14 20:48:53 -04:00
Steve Howell 0e129614cf Remove unused util.recipient_key() function.
(imported from commit cee6a58344971ee1439e6b66ec301f1bd0f80502)
2014-03-14 20:48:53 -04:00
Steve Howell 3dc9ee182f Add test for people.reify()
(imported from commit 3ad061ba52c1fd7fa2c2a053e91de87117370dd6)
2014-03-14 20:48:48 -04:00
Steve Howell cbb5878477 Test people.remove() only removes one person.
(imported from commit 7cd21cd9e4b99d0542bf81737a1c16a346ecc37e)
2014-03-14 20:48:47 -04:00
Leo Franchi 065fcf1a1b Handle out-of-order local ids in message_list
(imported from commit e805837d7d2790be90490cc9ec9415882ff9b549)
2014-03-14 20:48:47 -04:00
Steve Howell 44bb9d58d1 Test startup logic in bot_data.js
(imported from commit 6410c584c2e1d8027a276902c67f34ee6a284e6f)
2014-03-14 20:48:46 -04:00
Steve Howell d4fa917c49 Add has_topic() helper to filter.js
(imported from commit 8d8d9c2b6638968b18c7603e070c001d6b16cf21)
2014-03-12 21:15:22 -04:00
Steve Howell 0376d26c79 Add filter_with_new_topic() method.
(imported from commit 2ed9261ec70edf0a4ee1a25989cabfa9ab7907fd)
2014-03-12 21:15:22 -04:00
Steve Howell dfc34eb074 Allow negated has:* searches.
Before this change, we were incorrectly trying to do local
filtering on negated has searches.

(imported from commit d1a6f1feef6b3cc1c984eb91a73cd16c4e66874e)
2014-03-12 21:15:20 -04:00
Luke Faraone bd20a756f9 Show a mobile icon in the presence list when relevant
We show a user as "on mobile" if:
 * They are only active on mobile
 * They are inactive on all devices and can receive push notifications

(imported from commit 0510b9371727cd19c72f6990df7112921c36ad48)
2014-03-11 13:06:23 -04:00
Zev Benjamin bdee9721ec tests: Delay loading old messages and starting get_updates until phantomjs thinks the page has loaded
This doesn't affect code when not in testing.  It shaves 7 seconds off of casper
test time on my machine.

(imported from commit 7e27fa781bcf16f36d9c8f058427ba57c41068bd)
2014-03-11 13:06:22 -04:00
Zev Benjamin dfa45a3689 tests: Wait until we've actually logged in to try to log out
(imported from commit f1a29520fdb868a91cf5145be49542c8db9b4316)
2014-03-11 13:06:22 -04:00
Zev Benjamin d6f01ed7b9 tests: Clear phantomjs local storage before starting tests
(imported from commit 83ee6f1c95a6f1e4005b36af6be2d60f70c81a1d)
2014-03-11 13:06:22 -04:00
Zev Benjamin 917a4363e7 tests: Only initialize casper once
(imported from commit 849b8cfc0545fb0ff51dbfc32d2bc6081c0a5215)
2014-03-11 13:06:22 -04:00
Zev Benjamin 0fbfbf488b tests: Remove dead test
(imported from commit a85a0877c21b0eba5cdf708fc8d264b11f7a3fd9)
2014-03-11 13:06:22 -04:00
Zev Benjamin e9acdd147f tests: Don't try to edit locally echoed messages
(imported from commit 04760e67b1c18766dc23072b4a735d8cb28a658b)
2014-03-11 13:06:21 -04:00
Zev Benjamin 2f01e9c51d tests: Use then_send_many
(imported from commit 228ee697a54643912eb3846d48c78e4464193632)
2014-03-11 13:06:21 -04:00
Zev Benjamin 719d551de6 tests: Always wait before sending messages
(imported from commit 1860f994b5698ba39ec9b45564c283f932d7502e)
2014-03-11 13:06:21 -04:00
Zev Benjamin 5fd58cf249 casperjs: Immediately check the condition in waitFor and don't wait after the condition is true
Normally, casper delays checking the waitFor condition for 100 milliseconds and
further does not act on that check for another 100 milliseconds.  This is just
silly.

(imported from commit ad046ceda81abda5c609ce25ef0d4fb27d3da716)
2014-03-11 13:06:21 -04:00
Zev Benjamin 39f632134d tests: Rename casper helpers for clarity
send_message -> then_send_message
send_many -> then_send_many
wait_and_send -> then_wait_and_send

Hopefully this makes it clearer that they should not be called inside of steps.

(imported from commit 4fcc971817b25056100311ba55303da2c5527f0f)
2014-03-11 13:06:21 -04:00
Zev Benjamin 0ccb794007 tests: Don't add new steps during execution
Casper can technically handle it, but it's cleaner to create all steps ahead of
time.

(imported from commit 37cda128818d663f57b6e2282a781e8d099fa77d)
2014-03-11 13:06:20 -04:00
Zev Benjamin 80ca037747 tests: Correctly wait for a message to be visible
I'm not sure how it worked at all before.

(imported from commit 608b0574d1a80cd631d9ea8198990d97d72ba64d)
2014-03-11 13:06:20 -04:00
Zev Benjamin c7586a7135 casperjs: Correctly call the `then` callback in Casper.waitFor
Casper was calling casper.then(then) instead of calling the callback directly.
This meant that the callback was being added as a step, which worked, but was
not consistent with the rest of the casper model.

(imported from commit b3bf916f7c56dd3d4e7be3569ebdf9d3045cd085)
2014-03-11 13:06:20 -04:00
Leo Franchi 9d8758557b Use global match in alert word regex to match all matches
(imported from commit aaec296ad6b18b20c1c2d1cb017cffef8e3e0512)
2014-03-11 13:06:16 -04:00
Leo Franchi 65b6c80f07 Don't highlight alert words that are in URLs, breaking them
(imported from commit e20ee33a1687f935482f48f829c19a1606ce6db1)
2014-03-11 13:06:16 -04:00
Waseem Daher a9f01e382a Switch streams page over to use consistent buttons.
(imported from commit c4d7f658f361a759a38951349e027ac3e279fe9b)
2014-03-05 17:23:23 -05:00
Steve Howell 957486cc95 Fix support for searches like "in:home search:foo".
Previously, if you searched for "in:home search:foo", we
weren't making "in:home" a public operator, so the back end
wouldn't know to exclude muted messages, but the front end
also wouldn't exclude muted messages, because it assumed
that queries with "search:" in them were fully narrowed by
the back end.

Prior commits made it so that the back end is now capable
of doing "in:home" narrowing, so to get the properly narrowed
results, we simply needed to make in:home be a public operator
in this commit.  We also made in:all be public for convenience,
although it's essentially a no-op.

(imported from commit e4a8b10813b50163c431b1721bd316b676be1b83)
2014-03-05 14:56:35 -05:00
Jason Michalski fa37e91e5c Add admin status to bot_data
(imported from commit 47b84b3ef1e97e355dee84f0595e94a4612bf4df)
2014-03-05 14:16:20 -05:00
Jason Michalski 3f6e53db6e Add bot_data module that updated with events
(imported from commit b0bd714258132fc81db763d316a15f5a81b1f4ff)
2014-03-05 14:16:20 -05:00
Jason Michalski eebbf0d4ee Show the new bot's default stream settings in the edit view
(imported from commit d6f1872e0dedd57ebde31da2caf075804195dfb0)
2014-03-05 14:16:19 -05:00
Waseem Daher 8efa04437d Remove flaky inline subscribe button tests.
(imported from commit b7be5827a433d66d02a24349ba2fe299ce9e3d9f)
2014-03-05 14:05:40 -05:00
Steve Howell 8efe4c0a1b Support has:attachment/has:image/has:link searches.
This commit finishes up support for has:* searches by adding
the front-end pieces, specifically the part that "has" operators
will not be applied locally.  It also implements basic
descriptions for search suggestions and canonicalization
of operands from plural to singular.

(imported from commit a3285bc33d06d76b5a2b403ebcdd911b4cc03980)
2014-03-05 13:58:53 -05:00
Steve Howell 89f10d7e7a Handle negated person-related operators in search suggestions.
(imported from commit e045a0910ff59d9b8569c5ba3b3b644fe2d7dad7)
2014-03-05 10:54:02 -05:00
Steve Howell e5e0ba9e7c Handle negated topics in search suggestions.
Typing "stream:foo -topic:b" leads to "stream:foo -topic:bar" properly
as a suggestion now.

(imported from commit bb0acf52744f7b13977a3db5d3c130d1402b09b7)
2014-03-05 10:54:02 -05:00
Steve Howell 2da547efc6 Test match_subject/match_content in message_group.handlebars.
The match_subject and match_content template vars are notorious
for causing bugs due to the way handlebars forces the strange
../../.. syntax on us, so now we have some test coverage.

(imported from commit c6b151b964ae8b6fb199d9cdbe533a87c6b58947)
2014-03-04 16:41:28 -05:00
Leo Franchi 6f67d94fc4 Split the recipient row of a message group into a partial
(imported from commit 660514daf932235b7c47ac4c22f963da17c7fc8b)
2014-03-04 10:09:40 -05:00
Jessica McKellar 87635b9e32 Convert settings from static HTML to a template.
This will make life much easier for handling update events.

(imported from commit 66b101eb5fae89b4eec6fc797fee8be26ac99bfb)
2014-03-03 16:08:32 -05:00
Jessica McKellar 07bb7b2fee Give users the option to propagate global stream changes.
This helps the common case of not liking our default of having audible
and desktop notifications enabled, and not making users adjust the
settings on every existing stream to fix it.

(imported from commit be75edb2c1385d1bd9a289416e2dffd8007f5e0a)
2014-03-03 16:08:32 -05:00
Jessica McKellar d89696291f Remove Notification (?) explanation popover.
(imported from commit f261f87c9571a76b8b0e2538ccb3bb4826ef449e)
2014-03-03 16:08:31 -05:00
Luke Faraone 0ac73e4d73 Use a dict in presence_info rather than strings
This allows us to extend it to contain more details, as we will shortly.

(imported from commit 59b14592609810c5ac634a8237928ce029f33a83)
2014-02-27 20:25:38 -05:00
Allen Rabinovich 13045f953f Fix casper tests
(imported from commit 9376ba39e827794e0c7bd2404c08d702596786a4)
2014-02-27 20:25:28 -05:00
Steve Howell 71de0ac565 Add a test for rendering realm-specific emojis in JS.
(imported from commit 5909c02f9a7931f03d7131ae16b5fb70c74746aa)
2014-02-27 20:25:26 -05:00
Steve Howell 7f2f1ad533 Add test coverage for stream_data.home_view_stream_names.
As part of this, I also made test_basics() have a third
stream that makes false positives in the test less likely.

(imported from commit d5ba64ec9346741818e30abe9e9594788c339fab)
2014-02-27 20:25:26 -05:00
Leo Franchi f22885223f Remove message id list from group divs
(imported from commit 620a219b5e11db79bfea971fe40deb09173deb10)
2014-02-27 20:25:24 -05:00
Leo Franchi 7ebe3bf824 Add template unit tests for new message groups
(imported from commit 7e520630b5ae74850fcdd6ecccc114101f9feddb)
2014-02-27 20:25:24 -05:00
Leo Franchi 568c33f294 Render messages as groups of divs instead of individual rows
Now that we no longer use tables for our message list, we can
more logically group messages together.

(imported from commit 9923a092f91a45fe3ef06f2f00e23e4e3fb62a37)
2014-02-27 20:25:23 -05:00
Steve Howell ca92292550 Test people.update() more thoroughly.
(imported from commit 48b1a5af4f3849b7d21960181149dc99b74ba660)
2014-02-27 20:25:21 -05:00
Steve Howell e16da5db45 Add test for people.get_rest_of_realm
(imported from commit 7cda63da29f7764e3932ce677bf3270adb6ea630)
2014-02-27 20:25:21 -05:00
Steve Howell 666252d749 Improve test coverage for get_topic_suggestions.
(imported from commit bba858e1f1f396f42d50e1e823ae0673d8013f53)
2014-02-27 20:25:21 -05:00
Steve Howell ef92c345ea Test that "te" matches "Bob Terry" in search suggestions.
(imported from commit 777b7d554278170765e04fc9e1041826c509e8a2)
2014-02-27 20:25:21 -05:00
Steve Howell 75c3e91a15 Add test_stream_completion() to search_suggestion unit tests.
(imported from commit 84d1b1a7e0a667e3851b46e915a4f87d146013d4)
2014-02-27 20:25:20 -05:00
Steve Howell 2ca0015c0a Cover more variations of narrowing in test_describe()
(imported from commit 145e9f624ea460c62a62f3da2d8e328642c5e2d6)
2014-02-20 11:38:51 -05:00
Steve Howell 55a862cc23 Test that narrow_stream is excluded from filter.public_operators()
(imported from commit 11c38d7108243f1496262a2cce982ec583c41894)
2014-02-20 11:38:51 -05:00
Steve Howell c729965b69 Test negated topic searches in Filter.unparse
(imported from commit 0e1e74b25b7eb1874b93dd7d62e50563caff1ebe)
2014-02-20 11:38:51 -05:00
Steve Howell b67d976809 Add test for parsing negated searches.
(imported from commit 91f79aa9cfdf939f7249c67a37d4420203c2ac63)
2014-02-20 11:38:51 -05:00
Steve Howell 3a9bdec149 Fix false positives in assert_same_operators in filter tests.
(imported from commit 8d15ec1ce113fabafbe791fb1068e4921508abeb)
2014-02-20 11:38:50 -05:00
Steve Howell 47b877357d Fix test to actually test Filter with default parameters.
(imported from commit 55b4557c8742bd2f1c8b1aa1e99a487d581fcfc4)
2014-02-20 11:38:50 -05:00
Steve Howell 1c4dcda639 Add test for in-home search when in our special narrow mode.
(imported from commit e6bc9fbd7b87377c7ed1d42e84a9b5cd369bb4fe)
2014-02-20 11:38:50 -05:00
Steve Howell 2a5dd139c8 Add node tests for hashchange.js
(imported from commit 20309e13dfea28400341e30a42e8f775479de773)
2014-02-19 16:19:16 -05:00
Steve Howell 8ce5404777 Describe negated search terms correctly.
This changes Filter.describe and Filter.operator_to_prefix
to handle negated terms correctly.

(imported from commit 673c0d3a5a77784e95772c14e12534ad2daecda2)
2014-02-19 11:05:31 -05:00
Steve Howell e645574b14 Add more test coverage to Filter.describe()
(imported from commit 9249af23e19b307f2ae168227aa73bba56b1a991)
2014-02-19 11:05:30 -05:00
Jason Michalski 320c2b8eaf Fix casper tests for redesign
Commit "ecf0eb85 Redesign styles for message pane" removed the
right_part class, updates the tests to not use it.

(imported from commit 277eb3748913895b13ab7bdca11e668033c9f9b3)
2014-02-18 12:50:31 -07:00
Steve Howell de8509e40d Fix broken template test.
(imported from commit a5d935ab84fd16d5fb83ff25fd773b251486c5cd)
2014-02-18 12:50:31 -07:00
Steve Howell bbfd33185c Remove narrowing options from message chevron menu.
Remove the options to narrow by topic/person from the menu,
because there are better ways to do this in the UI, and
remove the time travel option, because the "Link to this
conversation" achieves mostly the same effect.

(imported from commit b7e0cfe64c0760e5a7bf7a8c9c05ed1a5b747300)
2014-02-18 13:19:39 -05:00
Steve Howell aa90e265c2 Handle negated terms in operands/has_operand/has_operator.
For the Filter helper functions above, we generally want to
ignore negated search terms, since their existence should
really only impact filter predicates and nothing else on the
JS side.  The exception is search, where even the existence
of a negated search needs to be noted to know that we can't
apply a filter locally.

(imported from commit 8bbb410a85fefed549d359e4c779a134ad830c11)
2014-02-13 14:14:25 -05:00
Steve Howell 76ff3a526c Set negated flag explicity to false in JS code.
For negated search terms, we weren't explicitly setting
"negated" to false when callers left it undefined, which was
mostly fine, since undefined is falsey, but it is better to
define it explicitly for debugging/testing purposes.

(imported from commit 68a2790b510d17caed8ca11c38188545d1dcc347)
2014-02-13 14:14:24 -05:00
Steve Howell 2fb7c0059d Support negated searches on staging.
Behind a feature flag you can now do searches like this:

    -pm-with:othello@example.com is:private

The "-" in front of "pm-with" tells us to exclude messages
with Othello from our search.  We support "-" in front of
all operators, although the behavior for "-search:" and
and "-near:" doesn't really change in this commit.

Note that the filtering out of "negated" predicates only
happens on the client side in this commit.  On the server
side we ignore negated predicates and send back a superset
of the results.

(imported from commit 6cdeaf32f2d493fbbb838630f0da3da880b1ca18)
2014-02-13 14:14:24 -05:00
Steve Howell f4db89c7e9 Supported negated terms in filter predicates (JS).
(imported from commit b50527620b5b451b4d6e0dc073de4036fe2b7e1f)
2014-02-12 16:58:08 -05:00
Jason Michalski bd9cccffce Use pushState where supported to change the URL hash
This this removed one forced relayout of the page on unnarrow. This
saves about 100ms for me.

(imported from commit 0755f425abbe3d99b8a99765549a5bbf3c620b9a)
2014-02-12 15:19:10 -05:00
Steve Howell afe893b324 Remove filter_term() shim function.
The filter_term() function was supporting the transition
from using tuples for search terms to using dictionaries,
but now all of the JS code should be dictionary-compatible.
(We had already abandoned the tuples safety net on staging,
and a couple days of use have given me confidence we can
pull the shim code.)

The one side effect this change has is that search terms will be
initialized to {} instead of [].  This distinction matters
when it comes to calling JSON.stringify on the search terms.

(imported from commit 1fbe11011d8953dbea28c0657cbf88384d343e00)
2014-02-11 13:52:17 -05:00
Zev Benjamin 92b249a0a1 Replace curly quotes with regular quotes on the front-end before performing a search
(imported from commit 1be7384cea8808f9fceec889ecee6434e9bad6c2)
2014-02-11 11:45:44 -05:00
Jason Michalski 3de8bb7f80 Add a detailed description to event loop errors
(imported from commit b842b59912929d08f3d46dafaf49276d311f4ed2)
2014-02-10 17:08:11 -05:00
Steve Howell 6b93315cc3 Prevent browser errors for stream: searches.
When we typed "stream:" into the search bar, the empty operand
triggered an error in the Dict class for an undefined key, because
we were using opts[0] as a "defensive" workaround to opts.operand,
but opts.operand of '' is more correct than opts[0] being undefined.

Now we only fall back to opts[0] whe opts.operand is undefined, and
we emit a blueslip error when that happens.

(imported from commit 88a196d3bc3d67689c36bc036f378da744c652f9)
2014-02-10 15:11:43 -05:00
Steve Howell 9a01c0f3e4 Use new style search operators in node tests.
(imported from commit f54398751c258cd16957885a3bb71256c221715c)
2014-02-10 15:11:43 -05:00
Steve Howell 2fb70eb38c Remove tuples safety net for narrow filters on staging.
We have shim code that makes our internal narrow operators
support both a tuple interface and an object interface.  We
are removing the shim on staging to help expose any dark
corners of the code that still rely on operators being
represented as tuples.

(imported from commit f9d101dbb7f49a4abec14806734b9c86bd93c4e1)
2014-02-10 13:23:27 -05:00
Steve Howell fc78a2cc66 Stop using tuples in search_suggestions.js and Filter.unparse().
This is yet another change related to phasing out the
[operator, operand] tuple data structure for representing
terms in a narrow.

(imported from commit 508e58fc4eebae8a24a8ae59919ba5d94fc66850)
2014-02-06 16:42:38 -05:00
Steve Howell 90f6eb0661 Keep track of subs by stream_id inside of stream_data.js.
The JS code can now call stream_data.get_sub_by_id() to get
a sub from a stream_id.  Subs have stream_id due to a prior commit,
and we keep track of the mapping in stream_data's subs_by_stream_id
variable.

(imported from commit 409e13d6d2e79d909441a66c85ee651529d15cd2)
2014-02-06 12:09:52 -05:00
Steve Howell 583dae72a3 Change how the tutorial overrides the default stream color.
The tutorial introduces "engineering" messages that might not
be in the user's normal subscription, and they would get a gray
border if we did not override the stream color.  Before this change,
we accomplished this by overriding the core data structure in
stream_data.js.  Now we are a bit more future-proof; we only
override stream_color.default_color.

(imported from commit 0d0845b72f766912679f5aa7641ae9a60fdbb4ce)
2014-02-06 12:09:51 -05:00
Steve Howell 89ea079dce Allow Filter to accept non-tuple-based terms.
We make this happen inside of canonicalize_term.

(imported from commit 0571f6cac8ffdc806af56423cc98134c7493139e)
2014-02-04 13:16:25 -05:00
Steve Howell 112bc5ceda Rename canonicalize_tuple to canonicalize_term.
(imported from commit 07e0c4a6802b0d4b4fbb8ffd3965cab6457d4aeb)
2014-02-04 13:16:25 -05:00
Steve Howell eea8c0d1d5 Allow admins to change the realm's name in the UI.
(imported from commit 2873f872069a41c91beb87728f64fa526dd8a326)
2014-02-04 11:33:19 -05:00
Jason Michalski 0e1909f489 Prevent errors in get_updates_success from stopping the event loop
Add try/catch blocks to get_updates_success and send a blueslip error on
errors we catch. This will let get_updates_success return successfully
so that the next call to get_updates will start immediately.

(imported from commit 44d8b85d9d8e930a5552a5fbf4af1d0e5e8c07e8)
2014-02-03 15:28:27 -05:00
Jason Michalski 7b8acfea8e Add support for patching globals in the node tests
Add a helper to patch_global to change a global and then reset it to the
original value after a test file is complete.

(imported from commit 1b65ff6ea8693ad61b7f18f35dafa942429252a8)
2014-02-02 00:47:50 -05:00
Steve Howell 4b095cbad1 Make "assert" global in the node tests.
In the early days of the node tests we didn't have an index.js
driver, so each test set it up its own environment.  That ship
has long since sailed, so now we just require assert in index.js
as a global and make it so that the linter doesn't complain.

(imported from commit 1ded3d330ff40603cf4dd7c5578f6a47088d7cc8)
2014-02-03 10:54:38 -05:00
Steve Howell b52749d2ce Add admin_tab to template test output.
(imported from commit c364ea731f9833061b4fcc3551d5cc5a6a64e739)
2014-02-03 10:30:24 -05:00
Steve Howell 001d447e0f Add stream_member_list_entry to template test output.
(imported from commit cfd420f7337e315a5b3f1665fdc09faaadf0bfab)
2014-02-03 10:30:24 -05:00
Steve Howell ac57c3c16b Move stream_member_list_entry() code in templates.js
(imported from commit 8cca602597a3277d5e80bc1b314cd3fb16ea013c)
2014-02-03 10:30:24 -05:00
Steve Howell 2faf29408a Add scrolling to body of .test-js-with-node.html
(imported from commit 3836ecf6c73576bf9efc021dc091e685a7d0cdb2)
2014-02-03 10:30:23 -05:00
Steve Howell fa69047613 Add node test for people.js (just the basics for now).
(imported from commit 2f4714bedd54c731667160c65280f386061ce803)
2014-02-03 10:16:18 -05:00
Steve Howell d8eb8792ef Make node tests have _ and Dict automatically as global vars.
Having to explicitly call out the underscore/Dict dependencies
in nearly every test has proven to be more cumbersome than helpful.
We never monkeypatch those modules in the tests.

(imported from commit 49ef70c835edd4e22a5869eda9235ef3ffc3c59b)
2014-02-03 10:16:17 -05:00
Steve Howell 945df53280 Remove unneeded expectOne() stub in activity test.
(imported from commit c4d51a16c5dba65491729a648dd5c285f51061c3)
2014-02-03 10:16:17 -05:00
Steve Howell c8a573a0f2 Remove console.log call in echo.js test.
(imported from commit 67fc38b89b2c31974d2121555f6066b095d4279e)
2014-02-03 10:16:16 -05:00
Jessica McKellar ec88b3abaf Give admins the ability to unsubscribe people from streams.
(imported from commit 7ec130a233a2976ad0be6f8a7b59c33ce0e0cf3f)
2014-01-31 11:23:14 -05:00
Jessica McKellar c4c5ac210e Convert stream member list to a handlebars template.
We had been concatenating strings.

(imported from commit 2d50d3f750a450029d39553ea9cd99ef824a149b)
2014-01-31 11:23:13 -05:00
Tim Abbott e505583f52 Split out new module people.js for tracking people.
(imported from commit fb9b769819ade25d1d3d6e452e68c7ee8651cfdd)
2014-01-30 17:32:58 -05:00
Steve Howell de7708ed6e Handle id:<msg id> searches with multiple terms.
If you do a search like id:5 topic:foo and message #5
does not have the topic "foo", we now return zero results.

(imported from commit 8121fac1dbd79024c51af1f310d831dab9242e36)
2014-01-30 15:57:32 -05:00
Steve Howell b18307b667 Start using operator/operands internally in Filter class.
By having Filter.canonicalize_tuple() call filter_term(),
we make it so that Filter objects get operator/operand
fields in their terms when we initialize this.

This mostly caused test breakage for tests that were doing
assert.deepEqual; now we just check to make sure that the
field we need are there.

(imported from commit 63b2516dc72edeb11e76a1fa4442570b9c605baa)
2014-01-30 12:53:08 -05:00
Steve Howell 12626ead66 Populate terms with named fields in filter_term().
Consumers of Filter.parse() can now reference
search term parts like so: term.operand, term.operator

(Legacy code can still use term[0] and term[1].)

(imported from commit 06d0da65f13f1eb7e3ba8eac0e69448aab2735ab)
2014-01-30 12:53:08 -05:00
Steve Howell df19f4283d Split up test_parse_and_unparse() into two tests.
(imported from commit da0fd90de110b4789dbcc99d2ce7337169273bd3)
2014-01-30 12:53:07 -05:00
Jessica McKellar 7085dca1ce Fix the Admin page not working for newly-knighted users.
Previously, while you'd get the event saying you'd been knighted,
which would make the Administration tab visible, clicking on the tab
would error out because the admin page HTML was never sent over on
page load (since you weren't an admin at that point).

(imported from commit 90ad351533515bebece630d67baf4b142d320754)
2014-01-29 12:41:22 -05:00
Jessica McKellar 20f2baa614 admin: Show a lock icon next to private streams.
(imported from commit 26829016cf219b55aef0ef45187667b0a9bd86fd)
2014-01-29 12:41:21 -05:00
Leo Franchi e716a75d22 Properly render at-all and at-everyone mentions locally
(imported from commit 9533b83dba6a61f6c09da755fca54e8a24ad61e6)
2014-01-28 17:37:10 -05:00
Leo Franchi ffb816391c Use our own fenced code preprocessor, fixing output mismatches
(imported from commit 3d4abb1043349e30adf265342ee7c946a99b3ce2)
2014-01-28 15:35:32 -05:00
Leo Franchi b83be2cd32 Properly avoid realm filter work in non-local-echo case
(imported from commit 9c01109e6900509690841306fb4a23464321de61)
2014-01-27 12:30:42 -05:00
Leo Franchi a82bc689e8 Render /me message on the frontend
(imported from commit ce4a44624b7084464d5c6ce8e04eef03ee23c9e3)
2014-01-27 12:30:42 -05:00
Leo Franchi 5441409044 Consolidate emoji tests and test on frontend as well
(imported from commit 3244a93209b56b655b80633713a3f58ae46d06ff)
2014-01-27 12:07:48 -05:00
Leo Franchi 3b07c164fb Fix realm filters with multiple groups
(imported from commit 9652cf8acbe51e25bcf053980b6caa9565b57e45)
2014-01-24 16:09:44 -05:00
Leo Franchi 97fb3e74af Support subject links in local echo
(imported from commit 916fecccc834053ea0354936119c6591af273938)
2014-01-24 16:09:44 -05:00
Jason Michalski 0c9271212d Added a admin settings div to the subscription template
(imported from commit 8aaa55d90a78ab1c4b182efeb4cac5b7d0677822)
2014-01-24 14:47:44 -05:00
Jessica McKellar ebd6408ec7 Make the tutorial shorter, and visually highlight important concepts.
(imported from commit 543d0ff838edbc2148df4b8d08331c793c7af4f6)
2014-01-23 17:06:27 -05:00
Leo Franchi 1c9a59fd3f Add newlines outside code blocks in marked.js to match bugdown
(imported from commit 7618260dbfa11209b3cc45d007407476897c2a20)
2014-01-23 16:50:29 -05:00
Leo Franchi aee127cdbe Share bugdown test data across frontend and backend tests
(imported from commit b278a60b5899cd336840e71d8e632e2b31338d82)
2014-01-23 16:50:29 -05:00
Leo Franchi 07dae5fcb9 Locally echo messages that are loaded from storage and resent
(imported from commit 474a0994d82bdbff9c98b453d3e1e4dc7732f5bd)
2014-01-23 16:28:59 -05:00
Leo Franchi 97a69cbc12 Convert realm filters in client-side markdown parser
(imported from commit ef12b9ed28cf0176881d33caa1973fe4d9b90d0b)
2014-01-23 16:28:57 -05:00
Leo Franchi b7b322d8cd Parse user mentions client side
(imported from commit b2919912792b8a02afad45f48e1c8df4783b93a9)
2014-01-23 16:28:56 -05:00
Leo Franchi 0f8cb25d89 Parse emoji client-side
(imported from commit 3bf150d866689b301ee31218cb3d570119b766cf)
2014-01-23 16:28:56 -05:00
Leo Franchi 87ce2bd0be More standardization of client-side markdown parsing
(imported from commit bc010d69ee92758481d3645f84f2a68dcafacf7a)
2014-01-23 16:28:56 -05:00
Leo Franchi 0b2ba855f9 Add helper for rough determination of markdown client-side
(imported from commit 3b6439f54e55fbca0f586392d1a0add4d7f694b8)
2014-01-23 16:28:54 -05:00
Jason Michalski d4aece75a5 Add JS to for the inline subscribe button
Add javascript to handle the button clicks and update the status based
on the subscribe and unsubscribe events from the server.

(imported from commit 6b9c0b40d9084e3d8b64bed701ebc786bef6d432)
2014-01-22 11:28:31 -05:00
Steve Howell 8f9d29189c Fix undefined operator in search suggestions.
There was a bug where you would type "is:private je" into the search
suggestion and see undefined:jesstess@zulip.com.  Now we use
the "pm-with" operator.  The search suggestions for people are kind
of complicated now, because there is some overlap between
get_private_suggestions and get_person_suggestions.

(imported from commit 7d330f34f4a433995420de6eb90cb41229b70272)
2014-01-21 17:07:50 -05:00
Steve Howell bca0311b53 Created stream_list.redraw_stream_privacy().
This function can redraws the lock icon (or lack of lock icon)
for a stream in the stream sidebar.  It can be called when
admins change the stream privacy.

(imported from commit 880133d02525137094c48ecad8cf2dfff59f3307)
2014-01-17 16:38:06 -05:00
Steve Howell a9e621fff4 Extract stream_privacy.handlebars partial template.
(imported from commit 77d614a549f5a337442936a002d422db1913e298)
2014-01-17 16:37:47 -05:00
Steve Howell 56dc4e0b8e Add test_add_stream_to_sidebar().
This is a node test that verifies that
stream_list.add_stream_to_sidebar() creates the right
DOM when it renders the stream_sidebar_row template.
The test also makes sure that the DOM gets put in the
correct place to be retrieved by stream_list.get_stream_li()
calls.

(imported from commit ed4c0148da2261870e3db5a9b553913788b4eccd)
2014-01-17 16:37:43 -05:00
Steve Howell 06cb0c8d22 Ensure handlebars templates have test coverage.
The node tests will now throw an exception if you haven't
at least compiled one of the handlebars templates as part
or running template.js.  This includes a one-line fix to
include tutorial_welcome.handlebars.

(imported from commit 51b4cae293d54c1f374a84623b4928519775e228)
2014-01-17 14:20:19 -05:00
Steve Howell f60d5c64c3 Improve admin_user_list.handlebars node test.
Add in "Make admin" button and a couple hasClass checks.

(imported from commit 2f6ccc9bb7f7b589d126911803bdfd7bd8ea3f2d)
2014-01-16 14:41:17 -05:00
Waseem Daher 4d5d0d636f casper-tests: Stop looking for full name.
We've removed it from the layout, so we should stop searching
for it in our tests.

(imported from commit 456c9794423d304f31a1d06215a51fae425df826)
2014-01-15 16:05:53 -05:00
Steve Howell b52d9c8c00 Add test for bug that was in Handlebars 1.0.9.
(imported from commit 56901dd0615938c9d061faf3f43ca23031c4d215)
2014-01-10 21:39:04 -05:00
Steve Howell 175aeef09a Simplify code by using message.alerted.
(imported from commit 10eaca36cd3d60ce3cdd36be62dff02217f0b6c6)
2014-01-10 21:39:02 -05:00
Leo Franchi 685ab1a583 Add message_list.remove_and_rerender
(imported from commit 68da0ad74f797fae3257577bbf415fd1fe9488a6)
2014-01-07 17:33:33 -05:00
Jason Michalski 2a8f0b4b3b Fixed expected_messages in casper tests
expected_messages was ltriming headings but we had a newline at the end
innerText. The ltrim was changed to a trim to correct this.

(imported from commit 5e411c5fc46a2cb675c1268041e95bbb2522c8f9)
2014-01-07 12:32:52 -05:00
Steve Howell badeb70be2 Allow admins to change public/private on streams.
This is the UI piece that finishes the features to let admins
make streams private or public.

(imported from commit 1a193165a6304dc358982e9850a75965fb3a03fd)
2014-01-06 11:59:48 -05:00
Steve Howell 34af2b0828 Extract subscription_setting_icon.handlebars
(imported from commit 574f43d8479e066687312a7a232f243347bd1d7f)
2014-01-06 11:59:47 -05:00
Steve Howell b3d307b465 Extract subscription_type.handlebars
(imported from commit 1a16ed0d51dae23f830043f52046c8fb50f91a48)
2014-01-06 11:59:47 -05:00
Steve Howell 2079cb995a Improve unit test for subscription template.
(imported from commit 607524b47d5fec7bd8630158b1060f0855d845aa)
2014-01-06 11:59:47 -05:00
Steve Howell 492159c312 s/allow_rename/is_admin/ in subscription.handlebars
(imported from commit e5af8d97d0bcd63efd85e5745a8bb131b091f752)
2014-01-06 11:59:47 -05:00
Steve Howell 8c15b89278 Fix handlebars.handlebars typo.
This was my fault.  It is just a label for test output, so it
was harmless.

(imported from commit aff11f411bc14275cb9b8ce339b7100eaebeb49d)
2013-12-26 11:07:01 -05:00
acrefoot 0d08acaa1b Transition from tables to divs for the message list.
This breaks our casperjs tests.

(imported from commit c63181c73a24eed4a80bfa56966d1f0871c5edb2)
2013-12-19 18:28:11 -05:00
Steve Howell 1c67fdb95d Move user list unread-count logic to templates.
When we rebuild the user list from scratch, set the unread
counts in the templates to avoid multiple DOM updates.

(imported from commit 2d0c9b0fb99b382332e464ba7c3caad95e05363e)
2013-12-17 10:59:25 -05:00
Tim Abbott 2276c6e524 Add support for loading a narrows-only embedded Zulip window.
Features:
* Only shows messages in the narrow
* New messages in the narrow will arrive as they are sent
* Works even for streams you're not subscribed to
* Automatically subscribes you to a stream on send
* Doesn't update your pointer
* All searches etc. automatically have the narrow added

(imported from commit 2e12b76849f6ca0f53dda5985dad477a04f7bbac)
2013-12-16 17:46:02 -05:00
Jessica McKellar b6e46986f0 Remove unused message_tour.js.
(imported from commit e25a9315377ad11d47ad78a5d466df40e306f713)
2013-12-12 11:47:09 -05:00
Steve Howell 680cd159c5 Add more template testing.
This adds coverage on all of our handlebars templates.  It renders
each template with representative data and generally performs at
least one sanity check on the DOM that gets created.

Also, the tests output the rendered HTML to .test-js-with-node.html,
which can serve as a way of documenting all of our templates.

(imported from commit 63dd7502457a8199dd35277fc5ab80cd53e2af22)
2013-12-12 11:32:46 -05:00
Steve Howell bc2848b41e Rename messages.js test to templates.js
(imported from commit fcd08cd862db0d7f7f212c6211dc8b259390393c)
2013-12-12 11:32:46 -05:00
Zev Benjamin 6f0477f491 Increase number of names shown in group PM list from 2 to 3
(imported from commit eff308fb1405290488f74d9064fd859d33c99558)
2013-12-06 17:54:05 -05:00
Steve Howell 70b0e73a24 Support sender:me and pm-with:me search syntax.
We convert sender:me to sender:steve@zulip.com at parsing time,
so users will see the canonicalization in the search bar.  Likewise
for pm-with.

(imported from commit aa9951f13d4633cfef85f03e5486d607fdef414f)
2013-12-05 13:49:04 -05:00
Tim Abbott 16f3f585c3 Fix composebox typeahead tests.
(imported from commit ca6e7ea00d79139a0d7db0f1dd5f3ba8d8da5ce3)
2013-12-02 17:42:24 -05:00
Steve Howell bbda1d93c4 Add test for message.handlebars
(imported from commit b02f0c8a6b1d79c868248598e8b9a829245d95a1)
2013-11-27 16:11:16 -05:00
Steve Howell 6a3089a803 [jquery] Add assertion to validate HTML is correct.
This requires the nodes.js version of jquery.  Talk to Luke if you are having issues
installing it.

(imported from commit 86dc91a9a41b2ef9c2dbcc4fb0085109250d7af7)
2013-11-27 15:09:21 -05:00
Steve Howell 4f2b292289 Add HTML output file for JS unit tests.
The node tests can write to .test-js-with-node.html now, so that
when you are unit-testing template-related code, you can use
the browser to inspect the output.

(imported from commit 3cbd7470ec0da1973124f79acb665c3a3e17c580)
2013-11-27 15:09:21 -05:00
Steve Howell c53845a69c Add unit tests for stream_list.
(imported from commit 1d04a2e6115f29b7949466260ec2ba3126b882e6)
2013-11-27 15:09:20 -05:00
Jeff Arnold 3a41184533 Revert "Make c/C compose to a new destination instead of being identical to r/R"
This reverts commit 755c92aed79ab79089b2e35d2c100582f012736a.

(imported from commit b7790fc63a2cea0a8e294c3f0a881ed6f06ed061)
2013-11-27 10:43:10 -05:00
Jeff Arnold c0a8fc459a Make c/C compose to a new destination instead of being identical to r/R
R means "I want to send a PM, you can guess the destination"
r means "I want send a stream message, you can guess the destination"
C means "I want to send a PM and specify the destination"
c means "I want to send a stream message and specify the destination"

(imported from commit 755c92aed79ab79089b2e35d2c100582f012736a)
2013-11-27 10:35:37 -05:00
Allen Rabinovich ca4e6a0ff8 Updates to stream list
(imported from commit 426a8035e9661598f9bbfa6ae83883ca3ac6106e)
2013-11-13 14:59:07 -08:00
Steve Howell 7bde1f7716 Add activity.short_huddle_name().
(imported from commit e3f0389298631fd06169dbc9559691470ac19d00)
2013-11-07 16:54:13 -05:00
Steve Howell 9adcba1e6d Add activity.huddle_fraction_present().
Add a method that lets us know what percentage of a huddle is
present.  (We can use this later to set the opacity of huddles
in the UI.)

(imported from commit 8a2383951807d7bfbf9d730a8980d977cf23b379)
2013-11-07 16:54:13 -05:00
Kevin Mehall d93c7545f6 Revert rendering window changes related to summarization
This reverts commit c10d9c1a0d23891acce88bf8d79866c08cb75681.
This reverts commit 9259a246946cd968a8725c38ff5ef2d4b4793717.

(imported from commit 50e9e0136c2487cc63d75ae2b78df0c70a1b0be1)
2013-11-07 11:04:27 -05:00
Steve Howell 4fb4e04501 Add activity.full_huddle_name().
(imported from commit 304e47ac88d7497fcde49f448912a2e063dd0bd1)
2013-11-05 15:34:29 -05:00
Steve Howell e628efff6c Fix people_dict in activity.js tests.
The simulated people_dict in the activity.js test was not
matching the production code, and going forward, we'll want to
share the people_dict setup for all of our tests.

(imported from commit fc21a02216b9422130b9fe9c11bcf80590612844)
2013-11-05 15:34:28 -05:00
Steve Howell 6d511486cb Add activity.process_loaded_messages() and get_huddles().
Activity.js now has the capability to track huddles that
come through in loaded messages and return them in reverse
chronological order by their most recent message.  Right
now this only connected to a unit test, not any production
code.

(imported from commit 59957086fa2e454e5711472df091f178217aed2b)
2013-11-05 15:34:28 -05:00
Jessica McKellar 8684c98eef tests: add basic navigation Casper tests.
(imported from commit 66ebb76123213167e551fb0d776a824e218a9032)
2013-10-31 17:34:34 -04:00
Tim Abbott 901a5c342c Use os.path directly rather than sometimes importing it separately.
(imported from commit 48486c4ea64d02a15faeebb0f490d31e9b113d62)
2013-10-28 15:44:13 -04:00
Steve Howell 9979d884e5 Remove 06-unread.js.
This test has been broken for a couple months, and nobody has taken
ownership of fixing it.  It's always slow, sometimes it fails
randomly, sometimes it fails for things that aren't really problems,
and it's generally been way more trouble than it's worth.

(imported from commit 8080e81b226a372e763a2558f4e5668c3a4d087c)
2013-10-25 11:27:25 -04:00
Zev Benjamin a04ac35012 casper: Marginally improve page loaded detection
We really should be setting a variable in Javascript to indicate that
we've finished loading, but this hasn't bitten us yet.

(imported from commit ee1f7c76d9f3c482561cc5c44b81537c7e9636be)
2013-10-22 18:45:11 -04:00
Kevin Mehall bd58861b09 Ignore summarized messages when calculating rendering windows.
Summary blocks can contain hundreds of messages. When the rendering window
code didn't take this into account, it would lead to all kinds of
unpleasant behavior when you scroll.

Trac #1888

Unfortunately, this replaces a subtraction with a function that iterates
through all the messages.

(imported from commit 9259a246946cd968a8725c38ff5ef2d4b4793717)
2013-10-21 11:48:57 -04:00
Steve Howell b7eba8fe5c Test unread.update_unread_subjects() more thoroughly.
(imported from commit 5f1bbdbc6822615d487404930f5e50c970536761)
2013-10-15 14:57:38 -04:00
Steve Howell 7076258b15 Get stream_data.js to 100% branch coverage
(imported from commit fa1fa18271ba280d819bcec8cdea6337230f1953)
2013-10-15 14:57:38 -04:00
Leo Franchi 6e188fb067 Tweak alert_word matches and add some more tests
(imported from commit 63dc4064c15d5d33a7ec0c992b183bf323dd4ee8)
2013-10-10 10:58:21 -04:00
Leo Franchi 51e0bea608 Autocomplete emails in sender: completion
(imported from commit 44dc337842d46349b103cf9631faa7d439be682c)
2013-10-07 14:55:58 -04:00
Leo Franchi 0d6ad56c29 Decode operand in filter.js in operator-aware way
When decoding an operand, a + can be converted to a space
only if the operand is not an email address.

(imported from commit 08fc36a579bbe6409137c60c0fa9579fe3ab2c43)
2013-10-02 12:11:15 -04:00
Steve Howell 8f1498c766 [important] Fix stacktrace in unread.js.
There is a scenario where we call process_read_message()
for a message that we haven't recorded as unread before.
I'm not sure how it happens, but I put back code to
guard against crashing.  The regression happened in
5752458c821.

(imported from commit 5ce15d2e236b738b445ed88f1733aa0612be0ff3)
2013-09-29 22:42:33 -04:00
Steve Howell 2a4cd3c69a Exclude muted topics from stream/home unread counts.
Update get_counts() so that it ignores counts for muted topics
when calculating stream/home unread counts.

(imported from commit 9b4e4da4346c225c535e97d709d3dee032603cc5)
2013-09-28 14:53:11 -04:00
Steve Howell c7b7f8d79a Inlined unread_hashkey() function.
The indirection was more confusing than helpful, especially
since the function had side effects, despite its getter-like
name.

(imported from commit 85d9cf642b4177f62488136f0e0f7f6c9304942e)
2013-09-28 14:53:11 -04:00
Leo Franchi d9dba41767 Add some tests for composebox_typeahead.compose_content_begins_typeahead
(imported from commit 01e71ebe87da6e866817dc56555a7e6ee61cb003)
2013-09-27 13:52:13 -04:00
Steve Howell 49a55ca6fa Call blueslip.warn from stream_data.js functions.
It used to be calling blueslip.warning(), i.e. the wrong name,
and would crash.

(imported from commit ddc953488cdb22dd37ddf674dddf1e05f34eaec9)
2013-09-24 16:19:53 -04:00
Steve Howell 660475bd0c Hide muted messages.
Instead of collapsing muted messages, just hide them altogether
in view where it makes sense to hide them.

(imported from commit 1c2c987ff302ceb135a025753cf421b4de1aea71)
2013-09-23 10:53:06 -04:00
Steve Howell 022ef6e9b9 Add narrow.muting_enabled()
(imported from commit 8972d1e3ca347397664094a7f150ec86fd2f8f8e)
2013-09-23 10:53:06 -04:00
Steve Howell e79e74ade4 Add narrowed_to_topic() helper function.
(imported from commit 9190caa9b183893fb7ae883686b9bdbd661d5895)
2013-09-19 15:41:00 -04:00
Steve Howell a4e2ed9fd2 Add test_narrowed() to narrow.js unit tests.
(imported from commit 060032ac00d0c28a9625e2885ee3156bc94ff130)
2013-09-19 15:40:59 -04:00
Steve Howell 51b8caf442 Add set_filter() to narrow unit tests.
(imported from commit 60734fa1a9d0d28e8c0277a41cc69186bc2b6c0e)
2013-09-19 15:40:59 -04:00
Steve Howell c6a9297f1a Add blueslip warnings to stream_data functions.
Warn inside these functions when you get data on streams that you
are not subscribed to:

  add_subscriber
  remove_subscriber
  user_is_subscribed

The back end should be smart enough not to spam us with subscriber
info that we don't care about.

(imported from commit b27644be2abc37c11ddff884ef392ea208bd1bd3)
2013-09-19 08:52:54 -04:00
Steve Howell e1b881629c Use fold_case:true for subscribers Dict
(imported from commit 8acc794cb5369baadef512a9fcdb3537231dd604)
2013-09-17 10:32:13 -04:00
Steve Howell 4b90f1685d Add stream_data.set_subscribers() method.
This allows us to encapsulate our use of Dict for the internal
data structure.

(imported from commit e8acc50b4c17d339015cb9db9939b9452a62cc8b)
2013-09-17 10:32:11 -04:00
Steve Howell e83c026a27 Set focus-related flags correctly after a server reload
(imported from commit 408469c0da0cfa5513e6838329816cd88665981f)
2013-09-16 12:29:34 -04:00
Steve Howell 5eaeddea12 Get stream_data.js back to 100% coverage
(imported from commit 5b82a10d50b6599c0c42604fe86275b21f9a6396)
2013-09-12 17:23:52 -04:00
Steve Howell 0165dc54ad Create blueslip error for undefined keys in Dict.
We create a blueslip error for undefined keys in Dict.  This led
to a straightforward change in the unit tests for Dict.  For the
unread test, to avoid the blueslip error, we had to be more specific
in setting up a user in one place, but this reduced our coverage,
leading to another small test being added.

(imported from commit 33e14795500d9283de2a7c03c4c58aec11cea4b8)
2013-09-11 18:07:37 -04:00
Steve Howell 9eefc8ae62 Test fold_case option of Dict
(imported from commit 630643767a21818c1ef4adb557c794e560783c3e)
2013-09-11 18:07:37 -04:00
Steve Howell e9adaaa0c0 Avoid Dict crashes for undefined keys when fold_case is true.
The exceptions were cryptic before, and they were inconsistent with
the fold_case: false behavior.

(imported from commit a40704d1a22bcdc60d91be832ee3c81eb416c6dd)
2013-09-11 18:07:37 -04:00
Steve Howell a8ebd80c89 Test that vanilla Dict handles undefined keys
(imported from commit 09846eafa55f2321ca10db950ad3785ce78ae2c6)
2013-09-11 18:07:37 -04:00
Steve Howell c6131b630b Handle undefined keys in muting.is_topic_muted
(imported from commit 96a9f0253e1c0e72a2b05577118dac438d190994)
2013-09-11 16:47:36 -04:00
Steve Howell f616148181 Make muting case insensitive for streams and topics
(imported from commit 6e731a5305a6d19896c61300aedf0fb4a387e148)
2013-09-11 16:47:36 -04:00
Steve Howell 0641e693fa Add muting.set_muted_topics
(imported from commit c84cd085e513d57e3913543d40cd8fd6b5d45b67)
2013-09-11 16:47:36 -04:00
Steve Howell 04c6a8198a Add muting.get_muted_topics
(imported from commit 5edb1d36ae66dfc42cf534edc452959df8306661)
2013-09-11 16:47:36 -04:00
Steve Howell 8626276dc3 Add muting.unmute_topic
(imported from commit c3aa08b7d50c70cba86b43c12d618ba1d96832b4)
2013-09-11 16:47:35 -04:00
Kevin Mehall 7fea9e0755 Fix race condition in 06-unread
There was nothing to ensure that the changes resulting from scrolling
happened before the unread counts were checked. We already had a long
wait there; might as well do those checks after it to ensure that the
DOM is updated.

(imported from commit 0d4014ae6a74dd684521fecabefc4bf79015f842)
2013-09-10 18:06:57 -04:00
Kevin Mehall 5991b0003f Fix 06-unread PM count selector for changes in 2b82fbb
(imported from commit 0d8e52f17fb06092efff7cdf4fc4b01ab4901e2f)
2013-09-10 18:06:57 -04:00
Leo Franchi a1d7e6336c Add stub for .on() in activity test
(imported from commit 82727e18739cb8bed7b2c64f8013e7f0fe386b94)
2013-09-10 13:25:59 -04:00
Steve Howell 5bcc403ea4 Add filter tests for is:alerted predicate
(imported from commit 077fdab5437f498f015da7ed81a77036c9ff6361)
2013-09-10 13:13:18 -04:00
Scott Feeney 17cad06a2d Add Dict.from_array()
(imported from commit 0650edb2217afa2c37be1bbc4f9e2ac40f4c0e2c)
2013-09-06 23:13:47 -04:00
Leo Franchi 663fd4653f Feature-flag alert words to staging + reddit
(imported from commit 1fe9c596b26ce6676514719e4ed2e185108685cb)
2013-09-05 10:21:39 -04:00
Leo Franchi 41b286232d Allow filtering to alerted messages with is:alerted
(imported from commit 99834f1ee1b9b2e0f5c7427afa1494bf404e3626)
2013-09-05 10:18:41 -04:00
Leo Franchi 897dd87b94 Add a span around alert words to mark them visually
(imported from commit 9b8fbbd957086f1eeaa3409e5830aa6d7974fbe8)
2013-09-05 10:18:40 -04:00
Steve Howell 1e88bb914e Add test_private_suggestions() to search_suggestion.js
(imported from commit db89f8574a4f7e169e66ebaff3a9c2cd49a4b0dc)
2013-08-28 17:41:17 -04:00
Steve Howell 8363b7c59a Add test_subset_suggestions() to search_suggestion.js
(imported from commit db9173ffa92ca225baf24a1103807034e4f31a7f)
2013-08-28 17:41:16 -04:00
Steve Howell 857680102f Remove enforce_arity checks from Dict
(imported from commit 8fdb6d8807e5c16349c7fcf71f25ce73348a5fe1)
2013-08-28 12:29:11 -04:00
Jessica McKellar b27f27f932 node tests: add some asserts for stream_data.delete_sub.
(imported from commit 3428f32206105b240e230e1050e7c16cd9c3729c)
2013-08-28 10:24:52 -04:00
Steve Howell 667372068c Add idempotency test coverage for muting.js
(imported from commit 50496866fa11df433150ff28f0f1e58e9e8b33bc)
2013-08-27 15:40:54 -04:00
Allen Rabinovich 2bb6f45af2 Add a data-name attribute to stream elements in the stream list and modify the test accordingly
(imported from commit 24791703015a47ae89fdf628d6511736b9d0f026)
2013-08-27 09:44:57 -07:00
Steve Howell a2bf6c3dd7 Test stream_data.in_home_view()
(imported from commit 29f1a187000e1818797c1a4781afaabca0ed29de)
2013-08-26 13:59:33 -04:00
Steve Howell b486f06e71 Test stream_data.get_invite_only for unknown stream
(imported from commit fb4e51b44b8c20844a7575af1a471a626273ae39)
2013-08-26 13:59:33 -04:00
Steve Howell 5e2de02dfc Test stream_data.get_color() for unknown stream
(imported from commit 7507e43de3f261a19d210c58863d1e614567f4bc)
2013-08-26 13:59:32 -04:00
Steve Howell ca5cf073f4 Add test_get_and_set() to stream_data tests
(imported from commit 007486f08879ea8b98524a91ef3fc02565cc4d86)
2013-08-26 13:59:32 -04:00
Steve Howell 96a2f0d907 Test TypeError exception in Dict.from
(imported from commit 088bf04ecf10338e2d1cff1b86d5beb263ee19dc)
2013-08-26 11:21:30 -04:00
Steve Howell 5dda9a5816 Test is_subscribed=false path of unread.get_counts
(imported from commit 7fb6531fb6d2d475bf43de6267fd018cc7347d7a)
2013-08-26 11:21:30 -04:00
Steve Howell 1821005dfe Restore subject counts for Uppercase streams
(imported from commit ef0e78d39c56da67544441a73ea257f215fefd94)
2013-08-26 11:21:29 -04:00
Steve Howell ffa9cfd492 Test that unread.process_loaded_messages ignores read messages.
(imported from commit 262f20933551e786022de564f46c75f901d8123f)
2013-08-26 11:21:29 -04:00
Steve Howell 582eef8305 Add test_message_unread()
(imported from commit 7f26cafb90757a9c490a148b6dd7b4f4f0fb5f95)
2013-08-26 11:21:29 -04:00
Steve Howell 06065d50bf Add dict.num_items()
(imported from commit 209a01b61d18d4b65b54e473cf727065aada68e8)
2013-08-26 11:21:29 -04:00
Steve Howell 63fa194139 Turn off the "muted" topic special case
(imported from commit ea34ea060eb29864c4816d0f14ee106dcb10be9d)
2013-08-23 18:33:48 -04:00
Steve Howell 4a7bab9a6f Allow collapsing of recipient sections.
This is experimental, for staging only.  There might be a better
way to model this than dueling force_expand/force_collapse flags,
but it works for now.  The code in collapse_recipient_group()
could also be DRYed up relative to expand_summary_row().

(imported from commit 107151d1ecd640970fb7700d41278a003bd1abaa)
2013-08-23 15:57:31 -04:00
Steve Howell b3ebb13469 Remove some ".d" suffixes in predicate tests.
I was saying bar.d in places where I wasn't really specifically
testing the .d feature, and it was distracting and just an
unintentional consequence of copy/paste.

(imported from commit 7b137b28cb33c72b83f02fe1d2961c5c6accc263)
2013-08-23 14:10:03 -04:00
Steve Howell 439e984f3d Break up Filter predicate tests
(imported from commit 780559045d6ea84612617db9249d7f191dbd86d9)
2013-08-23 13:56:28 -04:00
Steve Howell 3239efd864 Simplify MIT regex code and harden tests
(imported from commit 96c988fb8c90d04dd4bcd7d2bbc04f1b1c8d8cb7)
2013-08-23 13:32:10 -04:00
Steve Howell df812b40f9 Have test excercise Filter.predicate caching code.
(imported from commit 504abea7c1ef3a9cdb58b5bbcf2d751c5d98b1ea)
2013-08-23 13:32:10 -04:00
Steve Howell f8c3b70ced Clarify Filter tests dealing with bogus operators
(imported from commit db8327eb6df70bc8ffee7fb8166bc6491bd2fe70)
2013-08-23 13:32:09 -04:00
Steve Howell ec5bfa2a10 Test Filter.public_operators()
(imported from commit 47e08ffb3eb7f91b95b84b91a249bcf99157998e)
2013-08-23 12:56:09 -04:00
Steve Howell c205b8b29f Test Filter.predicate better.
(imported from commit d32a1e0d7a638bc5bd010b902475a27527e699ba)
2013-08-23 12:56:08 -04:00
Steve Howell 795248a1d0 Mute any topic named "muted" on zulip.com.
This change will allow us to test the muting feature on
staging.  Any topic named "muted" will automatically be
muted.  You can also mute any other topic on the console:

    muting.mute_topic('devel', 'ios');
    current_msg_list.rerender();

More UI around this experiment will be coming soon, as well
as support for muting entire streams.

The muting module keeps track of which topics are muted, but a
user can expand muted messages, and once that happens, the
messages are marked with the "force_expand" flag that gets
persisted to the back end.

Muted messages are rendered in similar fashion to the summarized
rows, and as part of unifying some of that code, we have
made it so that expanding a summarized section doesn't remove
individual flags related to summaries; instead, the messages
get the force_expand flag set.

(imported from commit acee4190e63813d46850415c41ff8ebfae4a6953)
2013-08-23 12:10:27 -04:00
Steve Howell dca1ffdf96 [bugfix] Restore toString() call in Filter.unparse().
I regressed this recently, thinking that all our operators are
strings, but I forgot about the "near:" operator used in the
"Narrow messages around this time" feature.  The user facing
symptom was that the search bar showed up empty instead
of saying near:50, which might actually be the better
behavior, but it certainly was not intentional. :)

(imported from commit fcb93cecbe9a052bb9bc1af7fcac5aecaba5aafb)
2013-08-22 14:55:43 -04:00
Steve Howell c4d598b36e Move parse/unparse from narrow to Filter.
I'm trying to move well-isolated methods out of narrow.js, so that
narrow.js is more strongly focused on UI/ajax interactions and
big, heavy lifting stuff.  The logical home for parse/unparse
seemed to be Filter, and they brought along two private methods
with them.  The big code moves involved trivial follow ups
like s/exports/Filter/.

(imported from commit ace0fe5aa1c7abce0334d079ba9eb8d9a57bd10f)
2013-08-22 14:53:00 -04:00
Scott Feeney f0e9786c08 Test user-sidebar unread counts & fix broken tests
This is hard to break up into separate commits; sorry about that.

Before this commit we had 3 tests:

1. Claims to check that an unread count was 3, but actually doesn't.
2. Checks that scrolling down causes the left-sidebar stream unread
   count to decrease.
3. Claims to check that unread counts are correct, but actually doesn't.

From talking to Leo, it seems that he originally tried to actually do
what tests 1 and 3 claim to do, but found it too fragile to check an
exact unread count because of font sizes, layout, etc.

We now have 4 tests. For each of the stream sidebar and user sidebar, we
test that:

1. Scrolling down causes the unread count to decrease
2. Logging out and back in again leaves the unread count unchanged

I've removed the two bogus tests and some other code that didn't seem to
serve a purpose.

(imported from commit 9f8e4b521e2765099510426d0b7e2960885e6f19)
2013-08-22 14:46:13 -04:00
Scott Feeney d4661b22c8 Remove deprecated parameter in Casper unread test
You used to have to call casper.test.done(N) where N was the number of
tests run. This is no longer required and is deprecated in CasperJS 1.1.

(imported from commit 0de9ecb1930cbce416fa02c24a882e926cdc8e87)
2013-08-22 14:46:13 -04:00
Scott Feeney f41f042127 Remove an outdated comment in CasperJS unread test
The test now works standalone, contrary to what the comment said.

(imported from commit 1280923dd522518689624628df5f3063fbdc1a1d)
2013-08-22 14:46:13 -04:00
Steve Howell 58c141ad79 Avoid side effects in ui.set_presence_list().
Have ui.set_presence_list() only touch the presence list.

Before this change, it was calling update_unread_counts(), which
has a bunch of side effects unrelated to the presence list.

(imported from commit 690f754d78874a03fa36f8ff8765d5a63e431d28)
2013-08-22 14:46:13 -04:00
Steve Howell 7b9d9bcdae Avoid monkeypatching in search_suggestion tests.
(imported from commit 5b36a8e7effce9f174c4f7aa0447b7c570db1ffc)
2013-08-21 18:18:58 -04:00
Steve Howell 3e259e028b Avoid monkeypatching stream_data object.
(imported from commit 4755cf44736190b566645a83a7fc576d3c8451cb)
2013-08-21 18:18:58 -04:00
Steve Howell 0202ca0261 Run unit tests in deterministic order.
(imported from commit 74e1690e3bd401730313e66611423dcdf4709f81)
2013-08-21 18:18:58 -04:00
Steve Howell d21cbac611 Clean up globals after each unit test.
The functions add_dependencies() and set_global() are convenience
methods that allow you to modify the global namespace while
the current file is running but then have it be cleaned up
by index.js when you're done.

(imported from commit f75b8a10c19f773a8d2d3a8fa4bc39b1679566fe)
2013-08-21 18:18:58 -04:00
Zev Benjamin 3f95e54dc1 dict: Add setdefault method
This is like Python's dict.setdefault.  I don't love the name, but
the consistency is nice.

We have lots of places where we do things like:

    if (! dict.has('foo')) {
      dict.set('foo', []);
    }

    var arr = dict.get('foo');
    arr.push(3);

We can now write:

    var arr = dict.setdefault('foo', []);
    arr.push(3);

(imported from commit b8933809c69ba47ec346ed51d53966793403e56c)
2013-08-21 14:11:39 -04:00
Zev Benjamin 62aec87962 dict: Make set() return the value passed
We were accidentally leaking our internal representation.

(imported from commit 08ddc42583fb13a2ad51eea7ed1b30bf5ccb4645)
2013-08-21 14:11:39 -04:00
Zev Benjamin 59041d993b dict: Move Dict.from(otherdict) functionality into clone method
(imported from commit 6a3981a726922d7acf55b49ea2d477271da430d3)
2013-08-20 15:37:08 -04:00
Zev Benjamin 2c775d0894 Make recent_subjects case-insensitive
(imported from commit 36c423f506c1e8dc0536c80a4a085b689623191a)
2013-08-20 15:37:08 -04:00
Zev Benjamin 3a70c4e928 dict: Make copying Dict constructor a class constructor method
(imported from commit 7bd5f6029c1290036a47688cf2b80f9317fe9c13)
2013-08-20 15:35:53 -04:00
Steve Howell edda967100 Leave casing alone in search suggestions.
The function narrow.unparse() is used in a bunch of places in
the search suggestion code, and now it no longer lower cases
operands.  This change contributes to fixing trac #1659.

(imported from commit 6b44b8a818482b5c8b4f9a45bc7d3a9d21e04eba)
2013-08-20 14:27:44 -04:00
Steve Howell 890a4f0ac0 Remove unused var in search_suggestion.js test
(imported from commit 2298d4c8642ac031cd98729c23eed79e2b994876)
2013-08-20 14:27:43 -04:00
Steve Howell 0a22094e24 Change operator canonicalizations.
Streams are converted to their "official" names now.
Topics are not canonicalized at all.
All other operands continue to be lowercased.

Since we don't lowercase stream/topic at the parsing stage,
we have to modify the predicate function to do the lowercasing
of stream/topic to enable case-insensitive comparisons.  This
is slightly more expensive.  The server-side predicate
functions are already case-insensitive.

(imported from commit 286f118c6c3ff9d23b37c7f958cab4c0eacd5feb)
2013-08-20 14:27:43 -04:00
Steve Howell 767a8ae400 Add test_predicates() to filter.js tests
(imported from commit 551f396b4458ac529858f91f693b424bc7d06b8c)
2013-08-20 14:27:43 -04:00
Steve Howell 33c70f0f69 Extract Filter.canonicalize_tuple().
(imported from commit 96b8dc8c27c07d6d13f1e02c88a164abcab5a5c2)
2013-08-20 14:27:43 -04:00
Steve Howell d5f997eb58 Use the correct stream name in compose defaults.
If we have a stream named "Denmark" and we're narrowed to it,
then use "Denmark" as the default stream name in the compose box
even if the narrow operators are lowercase.

(imported from commit e9f06b7307c73231aa887dc95849e0307984e6f0)
2013-08-20 14:27:42 -04:00
Steve Howell 18857f6601 Added stream_data.get_name().
This function returns the stream's actual name, if we can get it;
otherwise, it's the identity function.

(imported from commit 7a981adba9632d6c6eba54cb6514a9226d1e83e8)
2013-08-20 14:27:42 -04:00
Steve Howell eccd7e90ab Add unit tests for stream_data.js.
(imported from commit 9a91aea1db3afc7936b1dbaeb4c014a3df6cd633)
2013-08-20 14:27:42 -04:00
Steve Howell 579f53845e Have search_suggestion clean up after itself
(imported from commit def5797f02868ecdb7dc3ffcc25caf1e532e2764)
2013-08-20 14:27:42 -04:00
Steve Howell 3d20f6478c Add unit test for narrow.set_compose_defaults().
(imported from commit 819b326bb10b4126438c9336d41e4aadce94d381)
2013-08-20 14:27:42 -04:00
Steve Howell f593c551da Add tests for Filter canonicalizations
(imported from commit def24dda1f178b658f6e49f3d2c67db779059c89)
2013-08-20 14:27:42 -04:00
Steve Howell 2491a80aa6 Fixed comment in in index.js
(imported from commit d28abf87d80f53038f1273529fcfe758fe7db2af)
2013-08-20 14:27:41 -04:00
Kevin Mehall d29484daa7 Casper tests for message editing
(imported from commit 4a62267241099432b40ef2cd592e0d5c20384f75)
2013-08-20 14:07:49 -04:00
Scott Feeney 69efe2a695 Add a Node.js-based test runner
There are no functional changes; you can still use the shell script
tools/test-js-with-node. It just delegates now to the new index.js to
iterate through all the other .js files in the test directory and run
them. This sets the stage for Istanbul to correctly compute test
coverage.

(imported from commit 6f521c78b7a314d010fa113f9c2c971ab999b637)
2013-08-20 10:46:22 -04:00
Steve Howell 53f62bd71c Created MessageListView class.
(The code for MessageListView  was extracted from message_list.js.)

(imported from commit 60c0bac4c734d3850f8b8c047a978c292b19cc13)
2013-08-19 12:17:56 -04:00
Steve Howell 29c012dc74 Create stream_data.js module.
This pulls a lot of data-centric functions out of subs.js.

(imported from commit 0deed7d4bf5697e893af9bc9d888c2d5da8d9fa2)
2013-08-19 12:17:55 -04:00
Steve Howell a4af6c7062 Add unit tests for composebox_typeahead.add_topic().
This tests topics_seen_for() as well.

(imported from commit a748134af8068d9e4ae223fb7ecbbbc6c170137e)
2013-08-16 17:59:40 -04:00
Steve Howell 3e1cdaaded Add MessageList.nth_most_recent_id().
(imported from commit 69a424d4990402b9e77fbfa57fa573a002cf04ce)
2013-08-15 08:20:29 -04:00
Steve Howell 947ca3a0e0 Add Dict.each().
Dict.each() allows to iterate through values and keys of a Dict.
The callback function is passed value as the first parameter to
be similar to _.each()'s calling sequence.

(imported from commit e745e8b5d2f167b8b8acf7542b767494e354b037)
2013-08-14 14:24:38 -04:00
Steve Howell 878ee2b3fd Move Filter class to filter.js from narrow.js.
1) The class Filter now lives in its own module.
2) The function canonicalized_operators() is now a class method on Filter.
3) The function message_in_home moved to filter.js and became private.
4) Various calling code had to change, of course.
5) Splitting out Filter helped simplify a few tests.

(imported from commit e41d792b46d3d6a30d3bd03db0419f129d0a2a7b)
2013-08-12 13:58:32 -04:00
Zev Benjamin ec9322fc87 Use Dict everywhere we have keys based on potentially dangerous, user-supplied data
There are also one or two places we don't need to use it for security
purposes, but we do so for consistencey.

(imported from commit aa111f5a22a0e8597ec3cf8504adae66d5fb6768)
2013-08-09 17:35:14 -04:00
Zev Benjamin 0cfc8fae9f Add basic Javascript Dict implementation
(imported from commit 9f2fb089eb6e269549de26b37bd588355757d22c)
2013-08-09 17:20:14 -04:00
Zev Benjamin e0eddabeb1 Add util.enforce_arity
util.enforce_arity takes a function and returns a new version which
throws an error if an incorrect number of arguments (as determined by
the function prototype) are passed.

(imported from commit 20e69a6dc7b6f8455726ab4fae8d5b7b04dc4103)
2013-08-09 17:12:23 -04:00
Steve Howell 6790ed79cc Add a unit test for activity.js.
This includes slightly invasive, but harmless, changes to
the production code.

(imported from commit ff40af504de2360ada866508da262e0d2e9f7ad9)
2013-08-09 13:11:59 -04:00
Steve Howell db33028b98 Added tools/test-js-with-casper symlink.
The test-all script now calls the symlink, and the run script
has been cleaned up to be symlink friendly.

(imported from commit 8abb5c1e5744416e94ff843e50c53e0d0f7e1316)
2013-08-09 13:04:52 -04:00
Steve Howell cf1d94edef Add a test for stream_color.js (pick_color).
(imported from commit a49f96a4a7b61ef51c057e8a3f11c116d77ebb49)
2013-08-09 12:29:02 -04:00
Steve Howell cef72fd8b8 Add tests for the Filter class.
(imported from commit ef0917bd7911c5cc6f6d20d356c156d483ba723f)
2013-08-09 12:04:43 -04:00
Steve Howell cc73619a9d Add unit tests to narrow.js.
This includes slightly invasive, but harmless, changes to
production code.

(imported from commit 847557c11088b75c836cc399d0af75353a8faa3a)
2013-08-09 11:59:32 -04:00
Steve Howell 50b28dec49 Add node-based unit tests for util.js.
(imported from commit df666a5b96d378787e911c2cd6e509b7d42e1cb4)
2013-08-08 17:25:24 -04:00
Steve Howell 0b4c37ef8d Autocomplete names w/spaces in search.
See trac #1356.

(imported from commit 6aaf122c0f6d7b1d92bb074e8f3fbb93d0b63ceb)
2013-08-08 12:54:20 -04:00
Kevin Mehall 0b9497305f Add defensive checks against undefined messages to _is_summarized_message.
Should fix the issue with empty realms.

(imported from commit afca70ebf3b7b74ae0d0c269c72b4f8d54fc254b)
2013-08-08 12:47:23 -04:00
Tim Abbott 9181c7c75b Move generate-fixtures to tools/.
(imported from commit 3d452b17e315ba9adf91e33408a7711d16b069a2)
2013-08-08 10:22:32 -04:00
Tim Abbott 7b9305b06f Rename Django project to zproject.
This includes a hack to preserve humbug/backends.py as a symlink, so
that we don't need to regenerate all our old sessions.

(imported from commit b7918988b31c71ec01bbdc270db7017d4069221d)
2013-08-07 11:04:03 -04:00
Tim Abbott 41433e552f Remove old sqlite path zephyrdb from .gitignore files.
(imported from commit 1d9c9849de46854ace1caa4c32d5fe4c86d2ff5c)
2013-08-07 10:00:08 -04:00
Tim Abbott 1f1af26048 Change Humbug => Zulip in text/comments.
(imported from commit 2f9d73431ae40e1b9e9e11bc2f4f62f566ae758a)
2013-08-07 10:00:07 -04:00
Steve Howell 57f518c9c2 Add node JS unit tests for MessageList.
(imported from commit 486a343add91fd5037431504e1ce4a750bfa9fbf)
2013-08-07 09:25:13 -04:00
Steve Howell 3aa5930191 Streamline search suggestions when query has trailing space.
If you entered "stream:Denmark " in the search box, we would show
you two suggestions for "stream Denmark", despite our duplicate
detection, because we didn't canonicalize the suggestion that is
literally based off the user typed query, and so the other way
of generating the "stream Denmark" suggestion created a duplicate.

Now all the suggestions we generate are canonicalized, so the
generalized duplicate detection can work.

(imported from commit 52bf08ccf9bb2e2260ca8c20690169aead3732ab)
2013-08-06 14:04:29 -04:00
Tim Abbott e111a2f9a5 [manual] Rename Django app from zephyr to zerver.
This needs to be deployed to both staging and prod at the same
off-peak time (and the schema migration run).

At the time it is deployed, we need to make a few changes directly in
the database:

(1) UPDATE django_content_type set app_label='zerver' where app_label='zephyr';
(2) UPDATE south_migrationhistory set app_name='zerver' where app_name='zephyr';

(imported from commit eb3fd719571740189514ef0b884738cb30df1320)
2013-08-06 07:39:36 -04:00