Commit Graph

1873 Commits

Author SHA1 Message Date
Umair Khan 90099ffeb2 result.json: Upgrade test_reactions. 2017-08-17 09:03:35 -07:00
Umair Khan 351426df8b result.json: Upgrade test_presence. 2017-08-17 09:03:35 -07:00
Umair Khan 4c8933b844 result.json: Upgrade test_narrow. 2017-08-17 09:03:35 -07:00
Umair Khan 7bb9ac0014 result.json: Upgrade test_messages. 2017-08-17 09:03:35 -07:00
Umair Khan 025f7247cf result.json: Upgrade test_external. 2017-08-17 09:03:35 -07:00
Umair Khan 2b7bb6e965 result.json: Upgrade test_events. 2017-08-17 09:03:35 -07:00
Umair Khan de5f43ea47 result.json: Upgrade test_bots. 2017-08-17 09:03:35 -07:00
Umair Khan 1c09f95e0e result.json: Upgrade test_auth_backends. 2017-08-17 09:03:35 -07:00
Steve Howell 47bcedbc1b Fix server searches for is:mentioned and is:alerted.
Before this change, server searches for both
`is:mentioned` and `is:alerted` would return all messages
where the user is specifically mentioned (but not
at-all mentions).

Now we follow the JS semantics:

    is:mentioned -- all mentions, including wildcards
    is:alerted  -- has an alert word

Here is one relevant JS snippet:

        } else if (operand === 'mentioned') {
            return message.mentioned;
        } else if (operand === 'alerted') {
            return message.alerted;

And here you see that `mentioned` is OR'ed over both mention flags:

    message.mentioned = convert_flag('mentioned') || convert_flag('wildcard_mentioned');

The `alerted` flag on the JS side is a simple mapping:

    message.alerted = convert_flag('has_alert_word');

Fixes #5020
2017-08-16 11:29:12 -07:00
Tim Abbott 8600efcf36 test_bugdown: Fix duplicated test name. 2017-08-16 11:29:12 -07:00
Tim Abbott d2288154f6 bugdown: Fully remove mentions matching @name.
Given typeahed and the fact that this only worked if the person had a
full name that didn't contain whitespace, this side effect of the
original @shortname mentionfeature that we removed was experienced by
users as a bug.

Fixes #6142.
2017-08-16 11:18:09 -07:00
Vaida Plankyte 52046d537a auth.py: Add config_error page for misconfigured github/google auth.
Significantly modified by tabbott to use a better system, pass tests,
and clean up the content.
2017-08-16 10:05:19 -07:00
Tim Abbott 46b5c942aa test_narrow: Fix remaining case of search tests flaking with "lunch".
We apparently were using the default of num_before=1, not
num_before=0, which meant that if the very last randomly generated
message was one by cordelia mentioning lunch,
test_get_messages_with_search would fail because there were actually 3
matches.
2017-08-16 07:37:06 -07:00
Umair Khan 3afa8ad6a6 test_users: Upgrade to HttpResponse.json(). 2017-08-16 07:06:58 -07:00
Umair Khan d051bfbcb4 test_urls: Upgrade to HttpResponse.json(). 2017-08-16 07:06:58 -07:00
Umair Khan d3ced34152 test_uploads: Upgrade to HttpResponse.json(). 2017-08-16 07:06:58 -07:00
Umair Khan b9785cd4d6 test_subs: Upgrade to HttpResponse.json(). 2017-08-16 07:06:58 -07:00
Umair Khan b14603249f test_realm_filters: Upgrade to HttpResponse.json(). 2017-08-16 07:06:58 -07:00
Umair Khan bab6893dbb test_realm_emoji: Upgrade to HttpResponse.json(). 2017-08-16 07:06:58 -07:00
Umair Khan ed12419061 test_reactions: Upgrade to HttpResponse.json(). 2017-08-16 07:06:58 -07:00
Umair Khan 02aab6a43f test_presence: Upgrade to HttpResponse.json(). 2017-08-16 07:06:58 -07:00
Umair Khan 70996de415 test_messages: Upgrade to HttpResponse.json(). 2017-08-16 07:06:58 -07:00
Umair Khan 0e119c0ec2 test_bugdown: Upgrade to HttpResponse.json(). 2017-08-16 07:06:58 -07:00
Umair Khan 2b6c6d823d test_bots: Upgrade to HttpResponse.json(). 2017-08-16 07:06:58 -07:00
Umair Khan 366d2927c3 test_attachments: Upgrade to HttpResponse.json(). 2017-08-16 07:06:58 -07:00
Umair Khan 64c961f5de test_alert_words: Upgrade to HttpResponse.json(). 2017-08-16 07:06:58 -07:00
Tim Abbott 7c4eb43f34 test_notifications: Fix reply-to email for test suite.
It turns out that moving NOREPLY_EMAIL_ADDRESS DEFAULT_SETTINGS
unexpectedly changed its value in the test suite.
2017-08-15 18:33:15 -07:00
Brock Whittaker 83184d5c60 /about/: Merge with /authors, redesign page.
This adds the authors to the Zulip repository on GitHub from
/authors/ along with re-styling the page to fit the same
aesthetic as /for/open-source/ and other product-pages.
2017-08-15 16:09:01 -07:00
Tim Abbott 353a61b1d8 test_signup: Clean up re-fetching of user objects. 2017-08-15 12:52:23 -07:00
Jack Zhang 182570d5f3 Deduplicate header markup for portico and portico-help templates. 2017-08-15 12:15:21 -07:00
Tim Abbott 5a63ea0170 decorator: Extract validate_account_and_subdomain and deduplicate.
This fixes the significant duplication of code between the
authenticate_log_and_execute_json code path and the `validate_api_key`
code path.

These's till a bit of duplication, in the form of `process_client` and
`request._email` interactions, but it is very minor at this point.
2017-08-15 10:54:23 -07:00
Tim Abbott 25ec30dcf1 decorator: Deduplicate validate_api_key by using new helper function.
This should eliminate a bunch of duplicated code between these two
code paths.
2017-08-15 10:54:23 -07:00
Tim Abbott 3c37795675 decorator: Add localhost/Tornado hack to access_user_by_api_key.
This should make it possible to share that code with other code paths.
2017-08-15 10:54:23 -07:00
Tim Abbott 842bf77efb unread: Convert mark_topic_as_read to use stream IDs.
This is safer in its handling of potentially renamed streams.
2017-08-15 10:40:02 -07:00
Tim Abbott f3a41ac796 unread: Convert mark_stream_as_read to use stream IDs.
The logic is simpler and more robust.
2017-08-15 10:40:02 -07:00
Steve Howell 89f9017686 Create new endpoints for marking streams/topics as read.
The new endpoints are:
    /json/mark_stream_as_read: takes stream name
    /json/mark_topic_as_read: takes stream name, topic name

The /json/flags endpoint no longer allows streams or topics
to be passed in as parameters.
2017-08-15 10:17:29 -07:00
Steve Howell 60cc8fd58a Extract do_mark_stream_messages_as_read.
This function optimizes marking streams and topics as read,
by using UserMessage.where_unread(), which uses a partial
index on the "read" flag.

This also simplifies the code path for ordinary message
flag updates.

In order to keep 100% line coverage, I simplified the
logging in update_message_flags, so now all requests
will show the "actually" format.

This is an interim step toward creating dedicated endpoints
for marking streams/topics as reads, so we do error checking
with asserts for flag/operation, so we don't introduce a
temporary translation string.
2017-08-15 10:09:10 -07:00
Tim Abbott 9081f2cf44 reactions: Store the emoji codepoint in the database.
This is the first part of a larger migration to convert Zulip's
reactions storage to something based on the codepoint, not the emoji
name that the user typed in, so that we don't need to worry about
changes in the names we're using breaking the emoji storage.
2017-08-15 09:29:27 -07:00
Tim Abbott 3409806b88 test_narrow: Fix nondeterministic test failures with "lunch".
We recently changed the populate_db data set to include more variable
message content, which happened to include the possibility of the word
"lunch" appearing in the test messages.  This caused occasional
failures of the search tests that looked for messages containing
"lunch" starting at the beginning of time, not the beginning of the
test.
2017-08-15 09:20:45 -07:00
Aditya Bansal 25d9c7eea1 soft_deactivation: Add helper functions.
This commits adds new helper functions which are:
* get_users_for_soft_deactivation(): This function can be used to
fetch a list of human users which pass the criteria of minimum
inactivity period (in days) passed as a parameter to the function.
* do_soft_activate_users(): Given a list of users this function
reactivates them and help them catch up with the missing message
rows for them in the UserMessage table.
2017-08-15 08:33:16 -07:00
Aditya Bansal 0cb909b978 events: Fill in missing messages for a returing soft_deactivated user. 2017-08-15 08:33:16 -07:00
Aditya Bansal 658a14d0bb soft_deactivation: Stop creating UserMessage rows when soft deactivated. 2017-08-15 08:33:16 -07:00
Aditya Bansal 57858596ab soft_deactivation: Add new function 'add_missing_messages'.
This function will help us in creating undisturbed experience for
returning soft deactivated users.

Tweaked by tabbott to fix minor performance and clarity issues.
2017-08-15 08:29:51 -07:00
Aditya Bansal dc5510ce44 soft_deactivation: Add helper functions for deactivating users. 2017-08-15 08:29:28 -07:00
Steve Howell 274938bf5f Eliminate approximate_unread_count().
We use page_params.unread_msgs.count in the web
app instead.

Fixes #1300.
2017-08-14 12:39:00 -07:00
Jack Zhang 1e6570fa5d Update integrations doc context relative urls. 2017-08-10 10:21:53 -07:00
Jack Zhang 63ad7b6769 Rename /integrations/doc API endpoint as /integrations/doc-html. 2017-08-10 10:21:53 -07:00
Steve Howell c7b9044ee5 Fix apply_unread_message_event() for mentions.
We were exiting this function in certain cases before updating
mentions. This bug was always there, but it was flaky in terms
of database setup whether the tests would fail, so now the
relevant test sends three consecutive messages.

We also avoid putting duplicate message ids in mentions.
2017-08-10 05:09:04 -04:00
neiljp (Neil Pilgrim) 357c9ed016 mypy: Pass empty dict to makeRecord for args, instead of None. 2017-08-09 18:04:21 -07:00
Tim Abbott 1d10941712 register: Don't display field to enter password unless needed.
This should significantly improve the user experience for new users
signing up with GitHub/Google auth.  It comes complete with tests for
the various cases.  Further work may be needed for LDAP to not prompt
for a password, however.

Fixes #886.
2017-08-09 13:44:57 -07:00
Umair Khan 2c9a57161a registration: Add test for password less remote reg. 2017-08-09 13:44:57 -07:00
Umair Khan 4a3fde023f google: Respect is_signup argument.
This allows us to go to Registration form directly. This behaviour is
similar to what we follow in GitHub oAuth. Before this, in registration
flow if an account was not found, user was asked if they wanted to go to
registration flow. This confirmation behavior is followed for login
oauth path.
2017-08-09 13:44:57 -07:00
Umair Khan bb0eb76bf3 github: Don't ask for password in registration. 2017-08-09 13:44:57 -07:00
Vishnu Ks 6b46762384 management: Fix typo in get_realm CommandError message. 2017-08-08 14:13:19 -07:00
neiljp (Neil Pilgrim) b782db48e1 mypy: Remove superfluous older 'type: ignore' annotations. 2017-08-08 11:27:51 -07:00
neiljp (Neil Pilgrim) 67f1a72aae mypy: Ensure events test fails only due to settings absence. 2017-08-07 21:27:50 -07:00
neiljp (Neil Pilgrim) 334348cbca mypy: Use namedtuples for request objects in test_messages.py. 2017-08-05 17:53:18 -07:00
Tim Abbott fc0144f6e4 test_decorators: Annotate fake Request as HttpRequest. 2017-08-05 17:53:18 -07:00
neiljp (Neil Pilgrim) 6717f361ec mypy: Amend tornado_redirected_to_list calls to use Mapping. 2017-08-05 12:08:59 -07:00
Tim Abbott dd49bec93c Fix changing email addresses back after email change.
We apparently were not correctly clearing the user_profile's email
address from caches when changing email addresses, which meant that
trying to look up the old email in the user_profile caches would still
work.

Fixes #6035.
2017-08-05 10:49:44 -07:00
Rishi Gupta 251bd3e577 registration.py: Remove first_in_realm from accounts_register.
The parent commit implies first_in_realm == realm_creation.
2017-08-05 10:17:14 -07:00
Steve Howell 63f7b9a579 Remove "all" option for flag-updating endpoint.
The "all" option for 'message/flags' was dangerous, as it could
apply to any of our flags.  The only flag it made sense for, the
"read" flag, now has a dedicated endpoint.
2017-08-04 14:10:46 -07:00
Steve Howell 541156792e Add /mark_all_as_read endpoint.
This change simplifies how we mark all messages as read.  It also
speeds up the backend by taking advantage of our partial index
for unread messages.  We also use a new statsd indicator.
2017-08-04 14:10:46 -07:00
Umair Khan b2a2664715 rate_limiter: Upgrade clear_user_history to generic API.
Changes the name of the function to change_history as well.
2017-08-02 18:01:39 -07:00
Vaida Plankyte 02d65a67af frontend: Edit confirm_continue_registration.html to be clearer.
Fixes #5707.
2017-08-02 08:51:25 -07:00
Rishi Gupta 082c3a3c93 portico: Add for-working-groups-and-communities.md. 2017-08-02 00:19:34 -07:00
Rishi Gupta 94f7a5704f portico: Add for/companies. 2017-08-02 00:19:34 -07:00
Tim Abbott 32a5a54ba5 test_docs: Fix test for the redesigned /features page. 2017-08-02 00:09:32 -07:00
Rishi Gupta 852bbfa16a tutorial: Remove tutorial_finale.
Was already orphaned, since skip is always true. This is just removing the
code.
2017-08-01 22:38:22 -07:00
Rishi Gupta a51d8d4251 realm creation: Change initial realm messages and streams. 2017-08-01 22:38:22 -07:00
Tim Abbott a9fa1a5527 api: Migrate /json/messages_in_narrow off legacy API.
This completes the major endpoint migrations to eliminate legacy API
endpoints from Zulip.

There's a few other things that will happen naturally, so I believe
this fixes #611.
2017-07-31 13:08:06 -07:00
Tim Abbott ed10ce70d4 invites: Migrate to non-legacy API format.
This has the side effect of making it possible for a bot user to
invite users with its API key, which seems useful.
2017-07-31 13:08:06 -07:00
Tim Abbott 6a50e13156 uploads: Remove legacy /json/upload_file endpoint.
This migrates Zulip to use the equivalent API endpoint that has been
present for a while.
2017-07-31 13:08:06 -07:00
Tim Abbott 1e5aee054b settings: Migrate main settings-change code to API.
This was one of the few major remaining endpoints that were still on
the old-style legacy API.
2017-07-31 13:08:06 -07:00
Tim Abbott 9bf02fb913 custom_profile: Prevent bot users from accessing endpoint. 2017-07-31 13:08:06 -07:00
Tim Abbott 93261e14b7 hotspots: Prevent bot users from accessing endpoint. 2017-07-31 13:08:06 -07:00
Anna Liao 6a3c8ca2c5 push_notifications: Add human users only decorator.
This is part of #4517.
2017-07-31 13:08:06 -07:00
Tim Abbott 47eb7ee003 push_notifications: Fix incorrect URL being used in bouncer test.
This was actually testing the validation in the direct push
notifications code path, not the push notification boucner code path.
2017-07-31 13:08:06 -07:00
Tim Abbott 4b7c23f133 markdown: Rename bugdown-data.json to a more reasonable name. 2017-07-28 17:54:01 -07:00
Jack Zhang 11c27015f0 hotspots: Refactor backend for hotspots v2. 2017-07-28 16:34:13 -07:00
vaibhav 691aff55a3 bots: Add UI to select Slack compatible interface for webhooks.
interface_type select menu will be used to choose the interface
for outgoing webhooks. It will be displayed only when the selected
bot type is OUTGOING WEBHOOK type. The default value is GENERIC
interface type (1).
2017-07-28 16:22:55 -07:00
Tim Abbott 7778a66171 test_messages: Add a test for unauthorized mirroring of PMs. 2017-07-28 15:55:34 -07:00
Tim Abbott 8d0b743a6f test_messages: Add a test for PMs to deactivated users. 2017-07-28 15:53:33 -07:00
Tim Abbott a9e987f31d test_messages: Add a test for private messages copying self. 2017-07-28 15:49:27 -07:00
Aditya Bansal 452bbd9104 test_helpers: Extract stub for request_event_queue & get_user_events. 2017-07-28 14:50:55 -07:00
Steve Howell e6e3bbb780 Add a "mentions" section to unread message ids. 2017-07-27 16:14:26 -07:00
Jason Michalski 4f0110e081 Add unread_msgs to the initial state data.
We are adding a new list of unread message ids grouped by
conversation to the queue registration result. This will allow
clients to show accurate unread badges without needing to load an
unbound number of historic messages.

Jason started this commit, and then Steve Howell finished it.

We only identify conversations using stream_id/user_id info;
we may need a subsequent version that includes things like
stream names and user emails/names for API clients that don't
have data structures to map ids -> attributes.
2017-07-27 16:14:25 -07:00
Abhijeet Kaur 1deb58b178 bots: Add complete test-coverage for bot_lib.py file.
Also, add error handling for get_bot_handler instead of
throwing an assertion error.
2017-07-27 15:50:29 -07:00
Steve Howell 69fd967c5d topics history: Simplify data in /topics endpoint.
In anticipation of have all unread message ids available to the
web app in page_params (via a separate effort), we are simplifying
the /topics endpoint to no longer return unread counts.

Instead we have a list of tiny dictionaries with these fields:

    name - name of the topic
    max_id - max message id for the topic (aka most recent)

The items in the list are order by most-recent-topic-first.
2017-07-27 14:26:22 -07:00
Harshit Bansal 10265dbbd9 test_reactions: Migrate tests to use default test realm emoji. 2017-07-27 18:59:02 +00:00
Harshit Bansal 543cb11d17 test_realm_emoji: Migrate tests to use default test realm emoji. 2017-07-27 18:59:02 +00:00
Harshit Bansal 8fa861a020 test_realm_emoji: Add test.
Add a test for checking that non-admins can upload a custom emoji when
`add_emoji_by_admins_only` is set to False.
2017-07-27 18:59:02 +00:00
Harshit Bansal b683af2cbb test_realm_emoji: Fix some typos. 2017-07-27 18:59:02 +00:00
Harshit Bansal 4737363f0c test_bugdown: Migrate tests to use the default test realm emoji. 2017-07-27 18:59:02 +00:00
Harshit Bansal f34d4e8f19 test_notifications: Migrate tests to use the default test realm emoji. 2017-07-27 18:59:02 +00:00
Harshit Bansal eeb25b6b4b populate_db: Add a test realm emoji while populating databases.
Add `green_tick` realm emoji which can be used while performing tests.
2017-07-27 18:57:06 +00:00
Tim Abbott 3ff199c613 test_home: Fix test for /apps/ page. 2017-07-26 10:37:54 -07:00
Tim Abbott c9b2ef82c9 test_bugdown: Fix test for Twitter emoji.
Our work on the Twitter emoji added a new instance of our emoji syntax
between when we wrote 2d92f9dc0b and
rebase+merged it.
2017-07-26 10:20:25 -07:00
Tim Abbott 2e74dbf2d9 apps: Fix the documentation tests for /apps/. 2017-07-26 10:08:16 -07:00
digi0ps 2d92f9dc0b emoji: Change emoji image titles to use spaces instead of underscores.
Previously, the emoji images title display `🍼`.
This commit changes the title to display `baby bottle`.
2017-07-26 09:27:17 -07:00