Commit Graph

21963 Commits

Author SHA1 Message Date
Steve Howell 2699a6aac9 refactor: Extract people.is_valid_email_for_compose().
It's easier to unit test logic inside of people.js than compose.js.

We allow users to compose emails to any of our cross-realm bots.
Someday we may tighten up which cross-realm bots are valid targets,
since it's not necessarily the case that those bots do anything
useful when you send them messages.
2017-10-26 09:45:08 -07:00
Steve Howell 8cf5e05827 Rename realm_people_dict -> active_user_dict.
This dictionary includes bots, so the reference to
"people" in the name `realm_people_dict` was misleading.

We omit `realm` for brevity sake--it's usually the case
that folks implementing new features can safely ignore
cross-realm bots, and it's on our roadmap to move those
bots into the realm.
2017-10-26 09:26:28 -07:00
Steve Howell 646bd356a3 Rename get_realm_human_user_ids -> get_active_user_ids.
The function name `get_realm_human_user_ids` was a lie--it
includes active bots as well.

The only user of this function is `activity.js`, which wasn't
impacted by the misleading name, because we eventually filter
out bots in the `info_for` function.

It's possible that we actually want to include bots in the right
sidebar, since they can be difficult to discover in other parts
of the UI.  Or, if we want to keep the right sidebar as all
human users, we may eventually want to make the logic to exclude
bots happen higher in the stack (but for real, this time).
2017-10-26 09:17:43 -07:00
Brock Whittaker 03805fdca4 landing-page: Remove incorrect gray text.
This changes some text that would display gray when on a blue body
text page; we considered changing the opacity instead, but probably we
should just delete this..
2017-10-25 16:49:42 -07:00
Brock Whittaker f885ec82db landing-page: Make <ul> formatting consistent.
This changes the <ul> styling so that when not nested in a <p>
tag it'll have the standard font-weight (400) and be the same
color as the body text (blue/gray).
2017-10-25 16:36:31 -07:00
Henrik Pettersson 2f52da7baa test_signup: extract InviteUserBase class
This is a refactor done in preparation for #1180
2017-10-25 16:32:04 -07:00
derAnfaenger 8680541912 embedded bots: Add message flow tests. 2017-10-25 16:13:37 -07:00
Abhijeet Kaur a88178afaf Embedded bots: Add support for creating embedded bots via the API.
Adds support to add "Embedded bot" Service objects. This service
handles every embedded bot.

Extracted from "Embedded bots: Add support to add embedded bots from
UI" by Robert Honig.

Tweaked by tabbott to be disabled by default.
2017-10-25 16:13:29 -07:00
derAnfaenger ce4ba9c178 bot services: Use call_consume_in_tests. 2017-10-25 15:56:12 -07:00
derAnfaenger 0473692abd embedded bots: Properly reply to PMs and streams
This fixes an exception occurring when engaging an embedded
bot in a PM, makes it respond as itself instead of the sender,
and makes it respond to the PM conversation it is engaded in.
2017-10-25 15:56:12 -07:00
derAnfaenger d0c0b148b3 bot services: Rename add_outgoing_webhook_service to add_service. 2017-10-25 15:46:07 -07:00
derAnfaenger e041abd300 tests: Add create_test_bot() helper function. 2017-10-25 15:46:07 -07:00
Tim Abbott 1a0f075136 lint: Fix indentation in portico header HTML. 2017-10-25 15:44:11 -07:00
derAnfaenger 3cf88d8c09 embedded bots: Add virtual_fs bot.
This will be our main bot for testing the StateHandler code.
2017-10-25 15:39:28 -07:00
derAnfaenger 0d0c8fee7e embedded bots: Migrate StateHandler API to use get and put.
This moves away from handling a StateHandler object like a dict
and gives it the methods get, put, and contains.
2017-10-25 15:39:28 -07:00
derAnfaenger 34e3eb8c67 embedded bots: Rename state and state_handler to storage. 2017-10-25 15:39:28 -07:00
derAnfaenger cd600b8677 embedded bots: Add StateHandler marshaling functions. 2017-10-25 15:39:28 -07:00
derAnfaenger 51f1281ee9 docs: Specify the updated bot StateHandler API. 2017-10-25 15:37:28 -07:00
derAnfaenger 81a6b0d72c docs: Update deprecated code in writing bots guide. 2017-10-25 15:29:08 -07:00
Brock Whittaker fd779c1ba6 compose: Remove PM recipient box outline.
This removes the old blue styled outline around the PM recipient
box that was part of the older bootstrap styling in favor of the
dark outline on :focus that had been implemented for the rest of
the recipient boxes recently.
2017-10-25 15:15:58 -07:00
darshanime a14ec17473 dev_login: Don't redirect to realm if it doesn't exist.
Fixes #7132.
2017-10-25 15:13:20 -07:00
Brock Whittaker a9a9333b2a portico: Show whether the user is logged in.
This creates a dropdown in place of the normal register/login links
you get when logged out, with an option to go to the app or log out if
that appears you click on the avatar.

A bit more work is needed to make this look really good, but it's a
great start.
2017-10-25 14:59:24 -07:00
Brock Whittaker d5bb4a2265 portico: Add common class between two portico headers. 2017-10-25 14:47:54 -07:00
Brock Whittaker ec43a6e718 portico: Add "porticocustomhead" block to base.html.
This adds a custom header to the base.html strictly for portico assets
that should not be overridden.
2017-10-25 14:47:54 -07:00
Vishnu Ks 9314a7ac8b backends: Move EmailLogBackEnd to email_backends. 2017-10-25 14:35:12 -07:00
Vishnu Ks 1d94119d31 actions: Call send_initial_pms from process_new_human_user. 2017-10-25 14:14:59 -07:00
rht 49ad5c78e6 js: Update minor versions of several node dependencies. 2017-10-25 14:09:28 -07:00
Steve Howell 14d2d4e506 Fix bug in flush_user_profile().
Every time we updated a UserProfile object, we were calling
delete_display_recipient_cache(), which churns the cache and
does an extra database hop to find subscriptions.  This was
due to saying `updated_fields` instead of `update_fields`.

This made us prone to cache churn for fields like UserProfile.pointer
that are fairly volatile.

Now we use the helper function changed().  To prevent the
opposite problem, we use all the fields that could invalidate
the cache.
2017-10-25 11:30:56 -07:00
Steve Howell c8875693c8 Extract changed() helper in flush_user_profile().
The verbose style of `changed` is partly to appease mypy.
2017-10-25 11:29:09 -07:00
Steve Howell 70c053d86f Call get_realm_stream() in access_stream_by_name(). 2017-10-25 11:29:09 -07:00
Steve Howell 1bfc162d64 refactor: Rename get_stream_backend to get_realm_stream.
The name `get_stream_backend` sounded like it was off limits,
but there is no reason not to call this function directly.
2017-10-25 11:29:05 -07:00
Steve Howell 2387fa70af tests: Make test_people() more robust.
This test had a little bug, where we weren't actually
verifying `realm_bots` before, because we weren't using
`field` to look it up.

This commit fixes that bug and adds additional checks,
particularly for the recently added `realm_non_active_users'.
2017-10-25 11:18:30 -07:00
Steve Howell 305fe6106b Add `realm_non_active_users` data to initial payload.
We now add `realm_non_active_users` to the result of
`do_events_register` (and thus `page_params`).  It has
the same structure as `realm_users`, but it's for
non-active users.  Clients need data on non-active users
when they process old messages that were sent by those
users when they were active.  Clients can currently get
most of the data they need in the message events, but it
makes for ugly client code.

Fixes #4322
2017-10-25 11:18:30 -07:00
Steve Howell b94c062368 Make the realm user cache include non-active users.
This is a prepatory commit that adds non-active users to
the realm user cache.  It mostly involves name changes and
removing an `is_active` filter from the relevant DB query.

The only consumer of this cache is `get_raw_user_data`, which
now filters on `is_active` in a dictionary comprehension (but
this will get moved around a bit in a subsequent commit).
2017-10-25 11:18:30 -07:00
Steve Howell 769c741c7c refactor: Simplify event updates for `realm_users`.
We make a few things cleaner for populating `realm_users`
in `do_event_register` and `apply_events`:

    * We have a `raw_users` intermediate dictionary that
      makes event updates O(1) and cleaner to read.

    * We extract an `is_me` section for all updates that
      apply to the current user.

    * For `update` events, we do a more surgical copying
      of fields from the event into our dict.  This
      prevents us from mutating fields in the event,
      which was sketchy (at least in test mode).  In
      particular, this allowed us to remove some ugly
      `del` code related to avatars.

    * We introduce local vars `was_admin` and `now_admin`.

The cleanup had two test implications:

    * We no longer need to normalize `realm_users`, since
      `apply_events` now sees `raw_users` instead.  Since
      `raw_users` is a dict, there is no need to normalize
      it, unlike lists with possibly random order.

    * We updated the schema for avatar updates to include
      the two fields that we used to hackily delete from
      an event.
2017-10-25 11:18:30 -07:00
Shekh Ataul d239f77966 refactor: Replace mkdir_p functions with Python 3 builtin.
This didn't exist in Python 2, but it does in Python 3, so we get to
reap the rewards of dropping Python 2 support.

Fixes #7082.
2017-10-25 11:06:11 -07:00
Eeshan Garg bd814eea2b webhooks/taiga: Support relateduserstory events.
This commit adds support for the following:

1. When a user story is added to an epic.
2. When a user story is removed from an epic.
2017-10-25 10:59:58 -07:00
Aditya Bansal 0ddad98c98 features.html: Cleanup to use 4 space and consistant indentation. 2017-10-25 10:58:57 -07:00
Aditya Bansal 3fb0f7c092 home.html: Cleanup to use 4 space indentation.
Tweaked by tabbott to also make the translation tags make more sense.
2017-10-25 10:58:49 -07:00
Tim Abbott a03f322028 version: Bump version following 1.7 release. 2017-10-25 10:37:51 -07:00
Tim Abbott ff6a502200 Release Zulip Server 1.7.0. 2017-10-25 09:27:39 -07:00
Tim Abbott 10dc9ecc92 i18n: Update translation strings for 1.7 release. 2017-10-25 09:20:29 -07:00
Tim Abbott 9cc561e442 docs: Update changelog with a few last entries for the 1.7 release. 2017-10-24 16:45:00 -07:00
Cynthia Lin 0f2a05e081 integrations: Remove link underline from back arrow icon.
Fixes #7137.
2017-10-24 16:38:59 -07:00
Tim Abbott b1301cdfec node_tests: Restore 100% coverage on people.js. 2017-10-24 16:24:03 -07:00
Steve Howell 74081ff2d5 Add assert() on stream_topic in get_recipient_info(). 2017-10-24 16:02:33 -07:00
Tim Abbott 11eba1173c popovers: Don't show bots as deactivated in user popovers.
Apparently this is a bug that slipped in when we started showing
normal users as deactivated in the user popovers: all bot users were
treated that way as well.

We'll want to do #7153 as a follow-up to get things fully working how
we want them.
2017-10-24 15:59:51 -07:00
Steve Howell 6ed2a9b9f2 refactor: Rename user_ids -> message_to_user_ids.
This renaming sets the stage for the next change (and passes
all tests).
2017-10-24 14:32:17 -07:00
Steve Howell 420ca5a470 tests: Test out-of-stream mentions. 2017-10-24 14:31:58 -07:00
Tim Abbott 6b1eb647e4 nginx: Fix bugs in new nginx configuration checks. 2017-10-24 14:29:36 -07:00