Commit Graph

25697 Commits

Author SHA1 Message Date
Tim Abbott 0c9b1dc9ff search: Use select_first_unread when narrowing.
Apparently, our search code was the last holdout that was still using
the pointer to determine where to place a narrow.
2018-04-22 21:33:33 -07:00
Tim Abbott 6bab4e0aad narrow: Fix narrowing behavior when loading a new tab.
In the very early days of Zulip, we didn't have unread counts; just
the pointer, and the correct behavior when opening a new tab was to
place you near the pointer.  That doesn't make any sense now that we
do have unread counts, and this corner case has been a wart for a long
time.

This commit does the main behavior change here.  However, there's a
bug we need to fix, where we might end up trying to pre-render a view
of the narrow based on the `all_msg_list` data before `all_msg_list`
is caught up).  We need to fix that bug before we can merge this; it
should be possible to determine that using `FetchStatus` on
`all_msg_list`, or with better performance by using the `unread_msgs`
structure to determine whether the message we should be selecting is
present locally.

Fixes #789.
Fixes #9070.
2018-04-22 21:33:17 -07:00
Tim Abbott 1d5204c82b narrow: Fix incorrect values for use_first_unread_anchor.
Apparently, we were incorrectly passing through something related to
opts.use_initial_narrow_pointer as the value for `use_first_anchor`.

If you read the logic in narrow.js carefully,
use_initial_narrow_pointer was unconditionally false.

The correct value for this attribute is when we're trying to narrow to
the first unread message in a given context.  There are two things to
check:

* then_select_id is -1; i.e. we don't have a specific message ID we're
  trying to narrow around.
* select_first_unread is True, i.e. we're trying to narrow to the
  first unread message.

A bit more work should allow us to get rid of the second condition,
but I'm not quite confident enough to do that yet.
2018-04-22 21:33:14 -07:00
Steve Howell 6d4855bd6a lint: Prevent accidental use of const.
This prevents us from using const in our JS code, with exceptions
for test code and the portico.  Hopefully this is just a temporary
rule until we make our pipelines with work with ES6.

I tried to prevent "let", but that was too noisy.

This adjusts the one false-negative case of using const in a comment.
2018-04-22 20:11:38 -07:00
Steve Howell 4b3d07c805 node tests: Localize focus logic for activity.js.
This does a few things:
        * removes some unnecessary setup
        * puts some jQuery setup closer to where it's needed
        * renames some variables
        * adds an assertion about highlighting
2018-04-22 20:08:08 -07:00
Steve Howell 76d83af62b buddy list: Extract activity.narrow_for_user.
This change makes a common code path for these two operations:
        * clicking on a user
        * hitting enter when a user is highlighted

The newer codepath, for the enter key, had some differences that
were just confusing.  For example, there's no need to open the
compose box, since that's already handled by the narrowing code.

For possibly dubious reasons, I let each handler still call
popovers.hide_all() on its own, since it makes the code a bit
more consistent with existing code patterns.
2018-04-22 20:08:08 -07:00
Steve Howell 54389f7b41 buddy list: Shrink overly large lists.
If we would have more than 600 people in a buddy list, it's kind of
cumbersome to scroll through it, and it's also expensive to render
it (short of doing progressive rendering, which adds a lot of
complexity).

So, as a short term measure, we filter out offline users whenever the
list would exceed 600 users.  Note that if you are doing a search that
narrows to fewer 600 users, the offline users will appear again.
2018-04-22 20:08:08 -07:00
Steve Howell 3f1930f9c5 buddy list: Extract buddy_data.js. 2018-04-22 20:08:08 -07:00
Steve Howell 536236d9b1 buddy list: Extract buddy_list.js. 2018-04-22 20:08:08 -07:00
Tim Abbott a9fb02b712 test_auth_backends: Add a test for GitHub auth mobile_flow_otp. 2018-04-22 19:55:05 -07:00
Tim Abbott c88163eea8 auth: Make "Continue to registration" actually register you.
The main change here is to send a proper confirmation link to the
frontend in the `confirm_continue_registration` code path even if the
user didn't request signup, so that we don't need to re-authenticate
the user's control over their email address in that flow.

This also lets us delete some now-unnecessary code: The
`invalid_email` case is now handled by HomepageForm.is_valid(), which
has nice error handling, so we no longer need logic in the context
computation or template for `confirm_continue_registration` for the
corner case where the user somehow has an invalid email address
authenticated.

We split one GitHub auth backend test to now cover both corner cases
(invalid email for realm, and valid email for realm), and rewrite the
Google auth test for this code path as well.

Fixes #5895.
2018-04-22 19:55:05 -07:00
Tim Abbott c65a4e8f0b test_signup: Remove unnecessary LoginOrAskForRegistrationTestCase.
This test class is basically a poor version of the end-to-end tests
that we have in `test_auth_backends.py`, and didn't really add any
value other than making it difficult to refactor.
2018-04-22 19:41:18 -07:00
Tim Abbott 2dcec3704c auth: Introduce confirmation_link local variable.
This is just a prepartory refactor in maybe_send_to_registration.
2018-04-22 16:24:43 -07:00
Tim Abbott 8026b4f9db auth: Refactor login_or_register_remote_user interface.
By moving all of the logic related to the is_signup flag into
maybe_send_to_registration, we make the login_or_register_remote_user
function quite clean and readable.

The next step is to make maybe_send_to_registration less of a
disaster.
2018-04-22 16:24:43 -07:00
Tim Abbott 64023fc563 auth: Fix incorrect use of get_realm_from_request.
The code in maybe_send_to_registration incorrectly used the
`get_realm_from_request` function to fetch the subdomain.  This usage
was incorrect in a way that should have been irrelevant, because that
function only differs if there's a logged-in user, and in this code
path, a user is never logged in (it's the code path for logged-out
users trying to sign up).

This this bug could confuse unit tests that might run with a logged-in
client session.  This made it possible for several of our GitHub auth
tests to have a totally invalid subdomain value (the root domain).

Fixing that bug in the tests, in turn, let us delete a code path in
the GitHub auth backend logic in `backends.py` that is impossible in
production, and had just been left around for these broken tests.
2018-04-22 16:24:43 -07:00
Tim Abbott b36298efda mypy: Fix a missing type annotation in auth code. 2018-04-22 16:24:43 -07:00
Tim Abbott 00c9f45821 auth: Remove dead invalid_subdomain code path.
This code path has actually been dead for a while (since
`invalid_subdomain` gets set to True only when `user_profile` is
`None`).  We might want to re-introduce it later, but for now, we
eliminate it and the artificial test that provided it with test
coverage.
2018-04-22 14:44:06 -07:00
Tim Abbott 65025e8327 auth: Add return_data for RemoteUserBackend.
This is done mainly because this backend has the simplest code path
for calling login_or_register_remote_user, more than because we expect
this case to come up.  It'll make it easier to write unit tests for
the `invalid_subdomain` corner case.
2018-04-22 14:44:06 -07:00
Tim Abbott 6df821a40f tests: Replace messy direct test of login_or_register_remote_user.
This code path is much more naturally tested with the existing
end-to-end test for the function that we have for the RemoteUser auth
backend.
2018-04-22 14:44:06 -07:00
Tim Abbott f806526551 auth: Remove unused request.verified_email variable.
This has never been used since it was introduced in the very first
version of our Google auth code in April 2013.
2018-04-22 14:44:06 -07:00
Tim Abbott fb6cc4cb65 secrets: Make it a bit easier to do GitHub auth in development. 2018-04-22 14:44:05 -07:00
Tim Abbott b91de0e283 i18n: Pass the name of the single-sign on system into strings.
This should avoid us needing to add a new set of translated strings
every time we add a new authentication method.
2018-04-22 13:34:37 -07:00
Utkarsh Patil 955d03b8a0 emoji: Prefix sort for emojis.
Emoji prefix sort for "popular emojis first". Fixes #7625.
2018-04-21 22:28:45 -07:00
Utkarsh Patil 59f5af6b62 emoji: Export popular emojis list.
Provisions to export popular emojis list.
2018-04-21 22:24:07 -07:00
Cynthia Lin ff88712db8 portico: Fix broken mobile responsive design on Plans page. 2018-04-21 22:15:56 -07:00
Cynthia Lin 323e2faac8 css: Change `*-device-width` to `*-width` selectors.
See https://stackoverflow.com/questions/18500836/should-i-use-max-device-width-or-max-width
for an explanation on why this isn't optimal.
2018-04-21 22:15:56 -07:00
Eeshan Garg ca5ea20ab7 doc tests: Add portico pages to tools/test-help-documentation.
Fixes #9117.
2018-04-21 21:51:32 -07:00
Tim Abbott f90b765824 docs: Document what's involved in doing your own push notifications.
We've had a few folks ask about this recently, and it seemed like it'd
be good to cover this a bit more explicitly.
2018-04-21 21:42:24 -07:00
Priyank Patel 55ff9a6806 quick fix: Revert ES6 idiom that istanbul warns about. 2018-04-20 16:33:33 -07:00
Shubham Dhama 26d2ffa821 populate_db: Add new user of "guest" type.
The purpose of this user is to act as a guest.
(This is a preliminary step in adding the guest type of user
and is a part of #8385.)
2018-04-20 16:20:00 -07:00
Shubham Dhama 1191f1730a guest: Add a model field for guest users.
This adds new field `is_guest` to UserProfile model and
is meant for the new type of user i.e. "Guest Users".

(Part of #8385).
2018-04-20 16:08:29 -07:00
Steve Howell 5f53fb1561 refactor: Remove factory code for toggle component.
We now have components.toggle simply return an object, without
putting the object into a lookup table.  The consumers of the
objects have all been changed to just store the object in their
own module scope.

The diff is a bit hard to read here, but it's mostly de-denting
code and removing these things:

        - we don't have opts.name
        - we don't have __toggle.lookup
        - we don't have keys
        - we don't create a sibling object to the prototype object
2018-04-20 13:45:58 -07:00
Steve Howell f73bfd2a5c refactor: Extract settings_toggle.js.
This mostly moves code, and we also abandon the lookup mechanism
for finding our toggler.
2018-04-20 13:45:58 -07:00
Priyank 02dddd6b35 node_test: Use let/const instead of var in activity.js.
This was left in previous cleanup.
2018-04-20 15:46:28 -04:00
Priyank 2dd2ab4f7e node_tests: Update alert_words.js to use es6. 2018-04-20 15:46:28 -04:00
Priyank 3174827f93 node_tests: Update channel.js to use es6. 2018-04-20 15:46:28 -04:00
Priyank b1c5f6c07d node_tests: Update bot_data.js to use es6.
bot_data.js uses let/const for variables, and uses rest operator
instead of _.extends.
2018-04-20 15:46:28 -04:00
Priyank 6c8753ef25 eslint: Update eslint config to have es6 env.
This will allow us to use spread operator.
2018-04-20 15:46:28 -04:00
Rishi Gupta 6c8a266119 portico: Update meta tags. 2018-04-20 12:13:50 -07:00
Tim Abbott 49f58583a4 models: Introduce can_access_public_streams field.
This is a simple computed field.  It's intended to more clearly
capture the meaning of this restriction for the users in zephyr mirror
realms, and eventually support guest user accounts in normal Zulip
realms.
2018-04-20 12:06:57 -07:00
Tim Abbott dc6d7d0d12 actions: Use presence_disabled for presence zephyr_mirror code path.
This is part of the effort to remove the use of is_zephyr_mirror_realm
across the code path for situations that might be relevant for other
users.  It helps keep the code readable.
2018-04-20 12:06:57 -07:00
Tim Abbott 09f995e966 left sidebar: Fix clipping of private message users with "g" in name.
This fixes an issue where users whose names had a "g" in them would
have the "g" clipped in the "private messages" section in the left sidebar.

We avoid a change in the effective visible line-height by shrinking
the margin.
2018-04-20 11:28:18 -07:00
Tim Abbott 7ef23a0139 slack import: Document how to send password resets to all users.
This is likely to be an important follow-up step after one finishes
the Slack import.
2018-04-20 10:56:06 -07:00
Tim Abbott 7e91e66987 import: Fix ordering of subdomain availability check.
When you're importing with --destroy-rebuild-database, we need to
check subdomain availability after we've cleared out the database;
otherwise, trying to reuse the same subdomain doesn't work.
2018-04-20 10:39:30 -07:00
Cynthia Lin 0886424ed3 analytics: Eliminate slider-focused text selection in Firefox.
Fixes #9151.
2018-04-20 09:19:43 -07:00
Tim Abbott 360d708340 gitlab: Document the local network security setting.
This should help users debug issues with the GitLab webhook not
working with recent GitLab releases.
2018-04-20 08:34:38 -07:00
Tim Abbott e25d6968a5 docs: Expand documentation on our other test suites.
This is long overdue, and I was actually kinda surprised how many of
these we have at this point :).

Fixes #7461.
2018-04-19 23:49:28 -07:00
Cynthia Lin d963fd8180 night-mode: Change coloring for compose close button. 2018-04-19 23:04:15 -07:00
Tim Abbott d1cc442404 compose: Move colorblock CSS to compose.css. 2018-04-19 22:51:25 -07:00
Cynthia Lin f1db3a681a compose: Refactor compose box from `<table>` to `<div>` structure.
`<td>` elements are fixed-width, so we refactor the entire
`<table>` structure for responsive design.

This fixes a bug with how the `To:` block looks in other languages.

Fixes #9152.
2018-04-19 22:51:13 -07:00