Commit Graph

7965 Commits

Author SHA1 Message Date
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