Compare commits

...

3077 Commits

Author SHA1 Message Date
Tim Abbott
38d2d23ad3 Release Zulip server 2.1.0-rc1. 2019-11-22 15:33:36 -08:00
Tim Abbott
c367e55892 i18n: Update translation data from Transifex. 2019-11-22 15:33:36 -08:00
Mohit Gupta
452e226ea2 narrow: Fix to show last message in narrow when narrow allows.
Fixes commit id 648a60baf6. When
allow_use_first_unread_when_narrowing() is false last message of
narrow is shown in view.

Comments rewritten by tabbott to explain in detail what's happening.
2019-11-22 12:31:43 -08:00
Anders Kaseorg
c81f967a1f docs: Use ZULIP_VERSION.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-22 12:26:54 -08:00
Anders Kaseorg
35e2013199 tsconfig: Fix typescript-eslint memory usage disaster.
typescript-eslint was using hundreds of megabytes to track `*.js`
files that it shouldn’t be checking.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-22 11:38:25 -08:00
Tim Abbott
bf117fed96 api docs: Fix link to client libraries.
This should have been caught by CI.
2019-11-22 11:08:44 -08:00
Tim Abbott
c9a3e4e872 docs: Reorganize and refocus section on management commands. 2019-11-22 10:48:37 -08:00
Tim Abbott
5a7b5f1337 docs: Rework text for scalability and monitoring sections.
This text is very old and hadn't been edited in a long time, in large
part because it was buried within old docs.  This change cleans it up
to give accurate and better-organized information.
2019-11-22 10:22:07 -08:00
David Rosa
87a2831b83 docs: Split maintain-secure-upgrade into dedicated docs.
* Moves "Management commands" to a top-level section.
* Moves "Scalability" as a subsection at the bottom of "Requirements".
* Moves "Monitoring" as a subsections at the bottom of "Troubleshooting".
* Replaces "API and your Zulip URL" with a link to REST API docs.  This
  documentation text has been irrelevant for some time.
* Removes maintain-secure-upgrade from the TOC but the file remains to
  avoid breaking old links from release blog posts and emails.
2019-11-22 10:21:20 -08:00
David Rosa
1c45e4ac11 docs: Add top level page for language bindings.
Lists API client bindings/libraries/wrappers and makes a distinction
between official core projects and community projects.

Tweaked by tabbott to sort the community and outdated libraries, and
restructure how we talk about other projects.

Fixes #2093.
2019-11-22 04:33:18 -08:00
Tim Abbott
263ac0eb45 pm_conversations: Initialize using server data.
This simple change switches us to take advantage of the
server-maintained data for the pm_conversations system we implemented
originally for mobile use.

This should make it a lot more convenient to find historical private
message conversations, since one can effectively scroll infinitely
into the history.

We'll need to do some profiling of the backend after this is deployed
in production; it's possible we'll need to add some database indexes,
denormalization, or other optimizations to avoid making loading the
Zulip app significantly slower.

Fixes #12502.
2019-11-21 17:01:41 -08:00
Tim Abbott
93b83b28a7 pm_conversations: Refactor to sort by message ID.
message_id, rather than timestamps, is our standard way to sort by
time.  And this refactor is important because we're about to start
using data from the server to populate this data structure.
2019-11-21 17:01:41 -08:00
Tim Abbott
89ff62dafa topic_list: Limit number of unread topics shown at once.
This avoids a stream having potentially near-infinite height when
opened in a stream with a large number of unread topics; the benefit
is that you can easily access the next stream.

We show an unread count next to "more topics" to make it hard to miss
that there might be more, older topics with unread messages.

With CSS work by Anders Kaseorg.

Fixes #13087.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-21 13:12:33 -08:00
Tim Abbott
1dfbeaf05b version: Update LATEST_RELEASE_VERSION for 2.0.7. 2019-11-21 12:52:00 -08:00
Mateusz Mandera
67b6179df2 ldap: Fix error while updating a user registered in multiple realms.
Previously, the LDAP code for syncing user data was not
multiple-realm-aware, resulting in errors trying to sync data for an
LDAP user present in multiple realms.

Tweaked by tabbott to add some extended comments.

Fixes #11520.
2019-11-21 11:13:31 -08:00
Tim Abbott
68d9ed8c4c docs: Update changelog for Zulip 2.0.7 release. 2019-11-21 10:36:09 -08:00
Anders Kaseorg
bae5e40f25 version: Set ZULIP_VERSION = "2.1.dev+git".
Since we don’t support downgrading from master to any 2.0.x release,
we shouldn’t set a ZULIP_VERSION that might lead someone to mistake
any such downgrade for an upgrade.  ZULIP_VERSION should always be at
least a minor version ahead of LATEST_RELEASE_VERSION, except on the
release branch.

`.dev` is a decreasing suffix that sorts before `alpha`, `beta`, `rc`
according to PEP 440/`packaging.version.Version`.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-21 10:33:55 -08:00
Mateusz Mandera
06c2161f7e auth: Use zxcvbn to ensure password strength on server side.
For a long time, we've been only doing the zxcvbn password strength
checks on the browser, which is helpful, but means users could through
hackery (or a bug in the frontend validation code) manage to set a
too-weak password.  We fix this by running our password strength
validation on the backend as well, using python-zxcvbn.

In theory, a bug in python-zxcvbn could result in it producing a
different opinion than the frontend version; if so, it'd be a pretty
bad bug in the library, and hopefully we'd hear about it from users,
report upstream, and get it fixed that way. Alternatively, we can
switch to shelling out to node like we do for KaTeX.

Fixes #6880.
2019-11-21 10:23:37 -08:00
Mateusz Mandera
0c2cc41d2e CVE-2019-18933: Fix insecure account creation via social authentication.
A bug in Zulip's new user signup process meant that users who
registered their account using social authentication (e.g. GitHub or
Google SSO) in an organization that also allows password
authentication could have their personal API key stolen by an
unprivileged attacker, allowing nearly full access to the user's
account.

Zulip versions between 1.7.0 and 2.0.6 were affected.

This commit fixes the original bug and also contains a database
migration to fix any users with corrupt `password` fields in the
database as a result of the bug.

Out of an abundance of caution (and to protect the users of any
installations that delay applying this commit), the migration also
resets the API keys of any users where Zulip's logs cannot prove the
user's API key was not previously stolen via this bug.  Resetting
those API keys will be inconvenient for users:

* Users of the Zulip mobile and terminal apps whose API keys are reset
  will be logged out and need to login again.
* Users using their personal API keys for any other reason will need
  to re-fetch their personal API key.

We discovered this bug internally and don't believe it was disclosed
prior to our publishing it through this commit.  Because the algorithm
for determining which users might have been affected is very
conservative, many users who were never at risk will have their API
keys reset by this migration.

To avoid this on self-hosted installations that have always used
e.g. LDAP authentication, we skip resetting API keys on installations
that don't have password authentication enabled.  System
administrators on installations that used to have email authentication
enabled, but no longer do, should temporarily enable EmailAuthBackend
before applying this migration.

The migration also records which users had their passwords or API keys
reset in the usual RealmAuditLog table.
2019-11-21 10:23:37 -08:00
Anders Kaseorg
16ea89ad89 js: Automatically convert var to let and const in remaining files.
This commit was automatically generated by `tools/lint --only=eslint
--fix`, except for the `.eslintrc.json` change itself.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-20 23:04:01 -08:00
Jack Tiggleman
1682d75ea8 message_edit: Add message edit local echo.
Updates the message editing process to do a local 'echo'.

On slow connections, now there is visual confirmation of the edit,
similar to when sending messages.  The contains_backend_only_syntax
logic and check are the same as there.

We showing "(SAVING)" until the edit is completed, and on successful
edit, the word "(EDITED)" appears.  There's likely useful future work
to do on making the animation experience nicer.

Substantially rewritten by tabbott to better handle corner cases and
communicate more clearly about what's happening.

Fixes: #3530.
2019-11-20 17:40:19 -08:00
Tim Abbott
f0fd812cc5 tornado: Add transitional code for sender_delivery_email.
This issue was introduced in 54e357e154.
2019-11-20 17:31:11 -08:00
Anders Kaseorg
a681ca6cf5 queue: Update error callback signatures for Pika 1.1.
The expected signatures for these callbacks seem to have changed
somewhere in https://github.com/pika/pika/pull/1002.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-20 17:23:48 -08:00
Tim Abbott
bf1386405c settings_notifications: Fix linter issue. 2019-11-20 17:16:43 -08:00
Tim Abbott
55a262d47d message_edit: Move save lower in the file. 2019-11-20 17:06:08 -08:00
Tim Abbott
124f5d12a4 message_edit: Adjust API of edit_locally.
This makes it more extensible for future use of locally echoing edits
to fully sent messages.
2019-11-20 17:06:08 -08:00
Vinit Singh
19234f8705 sidebar: Move the buddy list tooltip content logic to JS.
Moved the logic from static/templates/buddy_list_tooltip_content.hbs to
the get_title_data function to simplify the template.

Fixes #13426.
2019-11-20 17:04:31 -08:00
Tim Abbott
1fe4f795af settings: Add notification settings checkboxes for wildcard mentions.
This change makes it possible for users to control the notification
settings for wildcard mentions as a separate control from PMs and
direct @-mentions.
2019-11-20 16:58:46 -08:00
Tim Abbott
67efed0b64 node tests: Reformat some notification settings lists.
This just cleans up line-wrapping.
2019-11-20 15:44:44 -08:00
Anders Kaseorg
0a75fdff6d buddy_data: Fix node tests.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-20 15:16:08 -08:00
Anders Kaseorg
f9f104a4f8 js: Automatically convert var to let and const in more files.
This commit was automatically generated by `tools/lint --only=eslint
--fix`, after an `.eslintrc.json` change.

A half dozen files were removed from the changes by tabbott pending
further work to ensure we avoid breaking valuable PRs with merge
conflicts.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-20 14:10:47 -08:00
Vinit Singh
329d0126bd user status: Add JS tooltips for Buddy List and PM List.
Hovering over user names (and user circles for PM List) now displays
Name, Status Message and Last online time in a js tooltip.
Hovering over group names displays the names of all group members.
Unavailable users are shown as "Last active: Today".

Hovering on a user circle in the Buddy List results in a js tooltip
with Active/Idle/Offline/Unavailable for
green/orange/white/white-with-line.

Resolves #11607.
2019-11-20 12:49:37 -08:00
Tim Abbott
cb29fae27c docs: Update changelog with recent changes in master. 2019-11-20 12:24:57 -08:00
Dinesh
c2e0c492f8 i18n: Fix translation of multi-line strings.
When strings are tagged for translation using `tr this`, the strings
were passed into the frontend i18n as-is (including new line and tab
characters that are not functional in the text, existing just to
format the HTML files reasonably).

This did not match the algorithm used in `manage.py makemessages` for
extracting strings for translation, which (correctly) removed that
whitespace to provide a good experience for translators.  The fix is
for the `tr this` implementation to use that same whitespace-stripping
algorithm.

Tested manually by checking if those strings that were not translated
earlier were translated, and also fixed an automated test that had the
wrong result, which should help prevent regressions.

Fixes #13389.
2019-11-20 10:58:15 -08:00
Mateusz Mandera
c3e83a0e6b push_notifications: Update link to google's upstream API docs.
Due to the migration to Firebase, the old link now gives 404. We replace
that with a working link to the migrated legacy API.
2019-11-20 10:50:24 -08:00
Hashir Sarwar
cc56147c44 actions: Removed redundant assignment of message['mention_data']. 2019-11-20 10:49:01 -08:00
Tim Abbott
6407d0b1f9 push_notifications: Clear PushDeviceToken on API key change.
This includes adding a new endpoint to the push notification bouncer
interface, and code to call it appropriately after resetting a user's
personal API key.

When we add support for a user having multiple API keys, we may need
to add an additional key here to support removing keys associated with
just one client.
2019-11-19 15:37:43 -08:00
Anders Kaseorg
6717daf4a6 test_events: Fix apparent typo.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-19 15:34:05 -08:00
Tim Abbott
0338e8a6f6 send_custom_email: Add support for specifying reply-to. 2019-11-18 17:34:01 -08:00
Tim Abbott
73cb03b1ea send_custom_email: Commit the base template.
This should have been included in
e266fb4343.
2019-11-18 17:27:12 -08:00
Tim Abbott
f83871c182 corporate: Consistently use delivery_email for billing.
This is yet another corner case where EMAIL_ADDRESS_VISIBILITY_ADMINS
broke existing code.
2019-11-18 17:02:57 -08:00
Tim Abbott
6d17fea076 docs: Document a few management commands around email. 2019-11-18 15:45:21 -08:00
Tim Abbott
e266fb4343 management: Add command to send a custom email to users.
This allows us to email sets of users on a server with a nicely
formatted email similar to our onboarding emails, built off of a
Markdown template.

The code was based on send_password_reset_email, but it doesn't
replace that use case, since one cannot include special values like
password reset tokens in these emails.
2019-11-18 15:35:54 -08:00
Matheus Melo
39bd565941 test_realm: Automate tests for invalid integer values in Realm.
Fixes #13362.
2019-11-18 15:21:11 -08:00
Matheus Melo
a890652bfd realm: Use check_int_in validator for enum format views.
This lets us remove some ugly semi-duplicated code.

Modified by tabbott to include some additional endpoints in the
changes.
2019-11-18 15:21:00 -08:00
Matheus Melo
678c3a89d0 validators: Add check_int_in validator.
This is a useful helper for our enum format fields where we want to
only allow a fixed list of integer values.
2019-11-18 15:14:56 -08:00
Matheus Melo
31558cb8b9 decorator: Extract require_user_group_edit_permission.
We move the check that the user is a member or admin inot this
decorator.

This name better communicates that this may do other checks beyond
just verifying the policy.
2019-11-18 15:13:29 -08:00
Matheus Melo
21ed834101 decorator: Extract OrganizationAdministratorRequired common exception.
This eliminates significant code duplication of error messages for
situations where an organization administrator is required.
2019-11-18 15:10:56 -08:00
Vishnu Ks
08103544cc tests: Remove upload-file from curl test exclude_list. 2019-11-18 12:23:38 -08:00
Vishnu Ks
76c610c953 tests: Remove upload-custom-emoji from curl test exclude_list. 2019-11-18 12:23:38 -08:00
Vishnu Ks
4c5e9e8eb0 tests: Add support for patching requestBody in curl example test. 2019-11-18 12:23:38 -08:00
Vishnu Ks
742de73bde tests: Remove update-notification-settings from curl test exclude_list. 2019-11-18 12:23:38 -08:00
Vishnu Ks
c4525cceee tests: Remove get-user-groups from curl test exclude_list. 2019-11-18 12:23:38 -08:00
Vishnu Ks
3468764415 tests: Remove remove-linkifiers from curl test exclude_list. 2019-11-18 12:23:38 -08:00
Vishnu Ks
258089bdc3 tests: Remove add-linkifiers from curl test exclude_list. 2019-11-18 12:23:38 -08:00
Vishnu Ks
ec53b8c574 tests: Unescape the html generated in curl example test.
Curl examples generated in test_generated_curl_examples_for_success
used to be html escaped. This commit removes the escaping in the test
since curl examples are not html escaped when run from terminal.
2019-11-18 12:23:38 -08:00
Vishnu Ks
a478e861a2 tests: Remove create-user from curl test exclude_list.
The API test client uses an admin client since
0f64fe530667fd3b96a434842b124075dea84300
2019-11-18 12:23:38 -08:00
Ivan Mitev
0f582dfe1f portico: Add return to login button to password reset end.
Previously, we had a "Return to login" button on the previous page of
the password reset flow, but none on the final page.

Note that this button is only shown in the Zulip Electron app.

Fixes #13378.
2019-11-18 12:21:40 -08:00
Tim Abbott
8ed57f8897 integrations: Fix BOT_PREFIX in errbot docs. 2019-11-18 12:14:43 -08:00
Tim Abbott
2e6e187c16 integrations: Deduplicate gogs and gitea integrations. 2019-11-18 12:08:09 -08:00
Jan Koscisz
b88192d5bb integrations: Add Gitea integration.
Gitea integration adopted from Gogs integration with minor
adjusting. More events are now handled.

Fixes #13346
2019-11-18 11:55:24 -08:00
Jan Koscisz
ace1503cb6 integrations: Add missing event handling to Gogs.
Issues event where not handled by Gogs integrations.
This added them to supported events.
2019-11-18 11:54:44 -08:00
Tim Abbott
4e421ebe12 scripts: Move inline-email-css from tools to scripts.
We'll be soon documenting a production workflow that involves using
it, and that means it needs to live under scripts/ (since tools/ isn't
present in release tarballs).
2019-11-15 17:39:42 -08:00
Tim Abbott
f34a40581f actions: Fix a few references to user_profile.email.
The only functional change here is for what is sent to the signups
queue worker, which at present isn't used in production anywhere.
2019-11-15 17:31:41 -08:00
Tim Abbott
6618cec9db logging: Switch various logging code paths to use user IDs.
This fixes EMAIL_ADDRESS_VISIBILITY_ADMINS support as well as being
more reliable/stable over time.
2019-11-15 17:24:01 -08:00
Tim Abbott
5edc5ae1fb create_test_bot: Use delivery_email for login.
The `email` field won't actually work if
EMAIL_ADDRESS_VISIBILITY_ADMINS is enabled.
2019-11-15 17:20:23 -08:00
Tim Abbott
0e317a8773 registration: Use delivery_email in logging code path.
This is essentially an assertion failure code path, so it doesn't
really matter, but it seems best to use the value that's the cause of
the problem here.
2019-11-15 17:18:19 -08:00
Tim Abbott
caf4c7af8f get_user_by_id: Use delivery_email when finding cross-realm bots.
When actually looking for bots, it doesn't matter, but this feels more
consistent with the other lookup code.
2019-11-15 17:17:05 -08:00
Tim Abbott
b85c9b0810 tornado: Use delivery_email in logging.
Eventually, we'll want to replace emails with user IDs here entirely,
but until we make that happen, we should at least use the same email
address present in our other logging.

I think we won't miss updating these in a future migration thanks to
mypy types.
2019-11-15 17:16:05 -08:00
Tim Abbott
7935b3cbd7 archive: Fix calculation of gravatar URL.
This is mostly dead code right now, but in case we revive it, I found
this error in an audit.
2019-11-15 17:14:44 -08:00
Tim Abbott
993ed9c2b1 tornado: Remove stale user_profile_email field.
Since years ago, this field hasn't been used for anything other than
some logging that would be better off logging the user ID anyway.

It existed in the first place simply because we weren't passing the
user_profile_id to Tornado at all.
2019-11-15 17:07:52 -08:00
Tim Abbott
df90533eef home: Switch invalid pointer logging to by user ID. 2019-11-15 17:07:52 -08:00
Tim Abbott
093e9394dd find_account: Use delivery_email when searching emails.
Previously, this code wouldn't work with
EMAIL_ADDRESS_VISIBILITY_ADMINS.
2019-11-15 17:07:52 -08:00
Tim Abbott
3bc7ba1767 digest: Switch from emails to user IDs for logging.
This is better practice.
2019-11-15 17:07:52 -08:00
Tim Abbott
bb64b0fa4d queue processors: Switch SignupWorker to logging user IDs.
This is a better setup than logging emails, especially with
EMAIL_ADDRESS_VISIBILITY_ADMINS.
2019-11-15 17:07:24 -08:00
Tim Abbott
b14b18b76f soft_deactivation: Remove 'email' from logging.
The value wasn't correct with EMAIL_ADDRESS_VISIBILITY_ADMINS, and in
any case we really just need the user ID.
2019-11-15 17:06:51 -08:00
Tim Abbott
8b45756dd2 onboarding: Fix welcome emails not using delivery_email.
For organizations with EMAIL_ADDRESS_VISIBILITY_ADMINS, we were using
the wrong email address in the notice telling the user how to login in
the future.
2019-11-15 16:49:28 -08:00
Tim Abbott
e124837cdc management commands: Fix incorrect use of user_profile.email.
All of these management commands should be interacting with
.delivery_email; this results in buggy behavior with
EMAIL_ADDRESS_VISIBILITY_ADMINS.
2019-11-15 16:43:51 -08:00
Vishnu Ks
0632d26e5e tests: Remove update-stream from curl test exclude_list. 2019-11-15 15:53:31 -08:00
Vishnu Ks
be49dd4f30 tests: Remove delete-user-group from curl test exclude_list. 2019-11-15 15:53:31 -08:00
Vishnu KS
ee2d20ff3c tests: Remove update-user-group from curl test exclude_list. 2019-11-15 15:53:31 -08:00
Vishnu Ks
4b212efba6 tests: Remove create-user-group from curl test exclude_list. 2019-11-15 15:53:31 -08:00
Vishnu Ks
473d178fbc tests: Remove delete-stream from curl test exclude_list. 2019-11-15 15:53:31 -08:00
Vishnu Ks
4e15dabcfa tests: Remove remove-subscriptions from curl test exclude_list. 2019-11-15 15:53:31 -08:00
Vishnu KS
3efe35e35b tests: Remove delete-message from curl test exclude_list. 2019-11-15 15:53:31 -08:00
Vishnu Ks
00455df7f9 tests: Use admin client for curl examples test. 2019-11-15 15:53:31 -08:00
Vishnu Ks
bb5463b29a tests: Run test_generated_curl_examples_for_success after test_the_api.
Upcoming changes in test_generated_curl_examples_for_success modifies
various data of iago user heavily. So it's much easier to run
test_the_api initially than making various changes in tests of
test_the_api function.
2019-11-15 15:53:31 -08:00
rht
517534777d export-and-import: Update repo url of Zulip Archive. 2019-11-15 11:39:52 -08:00
rht
cdd035eac7 for/open-source: Update the repo url of Zulip Archive. 2019-11-14 14:04:51 -08:00
Tim Abbott
a41a4fcc33 onboarding: Use delivery_email in "new login" notifications.
Since we implemented EMAIL_ADDRESS_VISIBILITY_ADMINS, the intent is
that `delivery_only` should be used for accessing a user's actual
email address; with `email` used only in the Zulip API where we
haven't migrated to interacting with other users by ID.

This fixes a place we neglected to migrate.
2019-11-14 12:19:47 -08:00
Anders Kaseorg
428956c086 zjsunit: Remove set_global side effect from zrequire.
ES6 and TS modules don’t insert themselves into `window`, so our tests
shouldn’t insert them either.  Since the test `window` behaves like
`global` now, we can rely on legacy modules that do insert themselves
to do it themselves.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-13 14:29:17 -08:00
Anders Kaseorg
99563eb150 zjsunit: Make window a Proxy for global.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-13 14:27:13 -08:00
Anders Kaseorg
0ce4de0421 lint: Run mypy with --no-error-summary.
This suppresses the mypy message “Success: no issues found in 1085
source files” or “Found 1 error in 1 file (checked 1085 source files)”
in the output of lint.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-13 13:26:02 -08:00
Anders Kaseorg
2c4101dbc5 dependencies: Upgrade simplebar from 4.2.3 to 5.0.7.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-13 12:46:29 -08:00
Tim Abbott
0f4b6dd0c1 settings: Fix an out-of-date comment on EVENT_LOG_DIR. 2019-11-13 12:38:45 -08:00
Anders Kaseorg
0d20145b93 mypy: Upgrade from 0.730 to 0.740.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-13 12:38:45 -08:00
Anders Kaseorg
40f4ead738 mypy: Upgrade from 0.720 to 0.730.
Fixes #13269.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-13 12:38:45 -08:00
Anders Kaseorg
43bba63549 upgrade-python-dependencies: Remove.
This tool doesn’t match our current workflow for Python requirements
upgrades as of commit ec9bf6576a (#13213).
It also has a type error with mypy 0.730, which would be easily fixable,
but removing it is easier.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-13 12:38:45 -08:00
Anders Kaseorg
1a622f91f9 list-outdated-packages: Remove.
This tool provides no value over `pip list --outdated`.  It also has a
type error with mypy 0.730, which would be easily fixable, but
removing it is easier.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-13 12:38:45 -08:00
Anders Kaseorg
892e69b7ad settings: Turn on mypy checking.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-13 12:38:45 -08:00
Anders Kaseorg
ff1ef097a6 settings: Extract default settings to a module.
This allows mypy to understand their types.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-13 12:38:45 -08:00
Anders Kaseorg
93b1c3d94b settings: Extract config file functions to a module.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-13 12:38:45 -08:00
Anders Kaseorg
8e88e2ce15 settings: Move SERVER_EMAIL and ADMINS defaults into DEFAULT_SETTINGS.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-13 12:38:45 -08:00
Anders Kaseorg
6fe5e44b35 settings: Define logging paths with, like, normal human variables.
This makes these variables available for type-checking.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-13 12:38:35 -08:00
Anders Kaseorg
cafac83676 request: Tighten type checking on REQ.
Then, find and fix a predictable number of previous misuses.

With a small change by tabbott to preserve backwards compatibility for
sending `yes` for the `forged` field.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-13 12:35:55 -08:00
Anders Kaseorg
b0a7b33f9b push_notifications: Declare token of type str, not bytes.
Declaring a CharField of type bytes made no sense.

Signed-off-by: Anders Kaseorg <andersk@zulipchat.com>
2019-11-12 23:21:20 -08:00
Gloria Elston
f8855ca179 api: Remove legacy emoji reactions endpoint.
The original/legacy emoji reactions endpoints made use of HTTP PUT and
didn't have an API that could correctly handle situations where the
emoji names change over time.  We stopped using the legacy endpoints
some time ago, so we can remove them now.

This requires straightforward updates to older tests that were still
written against the legacy API.

Fixes #12940.
2019-11-12 13:07:06 -08:00
Tim Abbott
ddd1a0eb00 actions: Convert do_delete_messages to take a Realm.
The function only used the user's realm anyway, so this is a cleaner
API.

This should also make it more convenient to permanently delete
messages manually, since one doesn't have to fetch a random user in
the realm in order to delete a message using the management shell.

No functional change.
2019-11-12 12:20:31 -08:00
Tlazypanda
6945ced76f slack import: Map Slack guest users to Zulip guests.
Slack's Single-User Guest and Multi-User Guest users should be
imported as Zulip guests during data import.

Fixes #13255.
2019-11-12 12:12:59 -08:00
Anders Kaseorg
7d71fc9fb3 requirements: Add comments with explanatory links for forked packages.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-11 17:19:46 -08:00
Anders Kaseorg
5179e65493 requirements: Upgrade Python requirements.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-11 17:19:46 -08:00
Anders Kaseorg
5e89a7d646 install-shellcheck: Upgrade ShellCheck from 0.6.0 to 0.7.0.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-11 16:26:31 -08:00
Anders Kaseorg
ac49736311 install-node: Upgrade Node 12.11.1 to 12.13.0, Yarn 1.19.0 to 1.19.1.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-11 16:26:31 -08:00
Anders Kaseorg
60aebc4b55 dependencies: Upgrade nearly all JavaScript dependencies.
Keep handlebars at 4.2.x because
https://github.com/wycats/handlebars.js/issues/1598 breaks our test
suite, and simplebar at 4.2.x because of
https://github.com/Grsmto/simplebar/issues/406.  Upgrade everything
else.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-11 16:26:31 -08:00
Anders Kaseorg
fffef412bc dependencies: Upgrade to-markdown 3.1.1 to turndown 5.0.3.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-11 16:26:31 -08:00
Anders Kaseorg
cce85f6ec7 dependencies: Upgrade katex from 0.10.2 to 0.11.1.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-11 16:26:31 -08:00
Anders Kaseorg
ffe8ec3450 dependencies: Upgrade eslint from 6.0.1 to 6.6.0.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-11 16:26:31 -08:00
Sophie
2eba3e7827 org_settings: Change new user 24-hour setting to dropdown.
These should work consistently with how the individual user setting
works; see the last commit.

With changes from tabbott to fix real-time sync.

Fixes #12553.
2019-11-08 17:39:59 -08:00
Sophie
9d3ebf22ef settings: Change 24-hour setting to dropdown.
The previous checkbox UI gave more of an impression that we considered
12-hour time to be the default model.
2019-11-08 17:35:52 -08:00
Tim Abbott
44f9ce92e9 bots: Fix rendering of bot owner fields in admin settings.
This fixes two regressions in 1946692f9a.

The first bug was actually introduced much earlier, namely that we
were not sending a `bot_owner_id` field at all for bot users without
an owner.  The correct behavior would have been send `None` for the
owner field.

The second bug was simply that we needed to update the webapp to look
for the `bot_owner_id` field, rather than an old email-address format
`bot_owner` field.

Thanks to Vinit Singh for reporting this bug.
2019-11-08 15:09:44 -08:00
Anders Kaseorg
b978638c11 package.json: Move typescript to devDependencies.
This is only needed in development as of commit
f54a63e2f9 (#12838).

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-08 14:08:50 -08:00
Anders Kaseorg
51589e5273 package.json: Remove unused dependencies imports-loader, lazysizes.
imports-loader is unused as of commit
218c60ae86 (#12749).

lazysizes is unused as of commit
8a15b9ee87 (#12112).

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-08 14:08:50 -08:00
Mateusz Mandera
ed40d37e44 ldap: Fix realm_creation=True registration flow.
When creating realm with the ldap backend, the registration flow didn't
properly handle some things - the user wouldn't be set as realm admin,
initial subscriptions and messages weren't created, and the redirect
wasn't happening properly in the case of subdomains.
2019-11-08 14:01:45 -08:00
Mateusz Mandera
9ca26e91e0 ldap registration: Refactor, renaming auth_result to user_profile. 2019-11-08 14:01:45 -08:00
Mateusz Mandera
fc4ad44dae registration: Refactor, reordering some conditional blocks. 2019-11-08 14:01:45 -08:00
Mateusz Mandera
071038f111 test_signup: Check that user is admin in RealmCreationTest. 2019-11-08 14:01:45 -08:00
Mateusz Mandera
3daec7783a ldap: Fix development environment configuration.
The state of the FAKELDAP setup for the dev env has fallen behind the
backend changes and updates to fakeldap (which implemented
SCOPE_ONELEVEL searches), as well as having some other minor issues.
This commit restore it to a working state and now all three config modes
work properly.
2019-11-08 14:00:24 -08:00
Tim Abbott
b5f78b6c94 docs: Improve heading sections for development authentication.
This adds discussion of EmailAuthBackend and also avoids framing
things as only OAuth or Google/GitHub, which hasn't been true for some
time.
2019-11-08 13:56:53 -08:00
Tim Abbott
da1359394d docs: Simplify discussion of rebasing schema migrations.
The long manual tutorial is likely now unnecessary, and the article
was missing some helpful heading content.
2019-11-08 13:49:24 -08:00
David Rosa
b041948132 docs: Reorganize auth and migrations subsystems.
- Moves "Authentication in the development environment" from subsystems
to "development/authentication.md".
- Moves "Renumbering migrations" to a section within "Schema migrations".
2019-11-07 09:42:36 -08:00
Tim Abbott
9692df4024 test_classes: Add sending_client argument to send_*_message.
This makes it possible to simlulate messages sent by specific clients,
rather than just "test suite".  Relevant for sending messages where
`message.sent_by_human()` is True.
2019-11-06 17:52:53 -08:00
Tim Abbott
509da6c9a6 get_recipient_info: Simplify user_ids_muting_topic handling.
Rather than subtracting sets in multiple places, it's simpler/cleaner
to just check which users are in the set when processing them.

This refactoring be helpful when we extend the get_recipient_info
logic to handle wildcard mentions as well.
2019-11-06 16:25:34 -08:00
Tim Abbott
43a965ff19 test_event_queue: Remove a stray print statement. 2019-11-06 16:25:34 -08:00
Tim Abbott
fb7a0fe40f i18n: Update translation data from Transifex. 2019-11-06 14:45:03 -08:00
David Rosa
af4d7b4b52 docs: Merge "Upgrading" with modifying-zulip.
Merges the "Upgrades" section from production/maintain-secure-upgrade.md
with production/modifying-zulip.md.

Contains significant textual changes by tabbott to read more clearly.
2019-11-05 17:43:00 -08:00
Anders Kaseorg
62f86d4935 THIRDPARTY: Correct wrong paths; remove entries for deleted files.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-05 15:47:30 -08:00
Mateusz Mandera
b05a0d0177 social_backends: If no icon is to be displayed, set display_icon to None. 2019-11-05 15:44:07 -08:00
Mateusz Mandera
c228f7ebcb email_notifs: Take full advantage of django_to_ldap_username.
django_to_ldap_username is now able to find the correct ldap username in
every supported type of configuration, so we can remove these
conditionals and use django_to_ldap_username in a straight-forward
manner.
2019-11-05 15:32:00 -08:00
Mateusz Mandera
8edbbe7b3c ldap: Make email search config obligatory without LDAP_APPEND_DOMAIN.
Having to account everywhere for both cases of having and not
having email search configured makes things needlessly complicated.
It's better to make the setting obligatory in configurations other than
LDAP_APPEND_DOMAIN.
2019-11-05 15:25:58 -08:00
Mateusz Mandera
bfe800b11a ldap tests: Move test_ldap into test_auth_backends.
These tests belong more in test_auth_backends rather than deserving
their own separate file.
2019-11-05 15:25:58 -08:00
Mateusz Mandera
bb3ddb9576 ldap tests: Put django_to_ldap tests in DjangoToLDAPUsernameTests.
test_auth_backends had a few random django_to_ldap_username tests laying
around, they belong in DjangoToLDAPUsernameTests.
2019-11-05 15:25:58 -08:00
Mateusz Mandera
9f330fba8e ldap: Move ZulipLDAPAuthBackendBase.get_or_build_user definition.
This function is inherited by ZulipLDAPUserPopulator and overriden by
ZulipLDAPAuthBackend, so it's more clear to have it simply defined in
ZulipLDAPUserPopulator directly.
2019-11-05 15:25:58 -08:00
Tim Abbott
54e357e154 avatars: Fix gravatar URLs with EMAIL_ADDRESS_VISIBILITY_ADMINS.
Previously, we were using user_profile.email rather than
user_profile.delivery_email in all calculations involving Gravatar
URLs, which meant that all organizations with the new
EMAIL_ADDRESS_VISIBILITY_ADMINS setting enabled had useless gravatars
not based on the `user15@host.domain` type fake email addresses we
generate for the API to refer to users.

The fix is to convert these calculations to use the user's
delivery_email.  Some refactoring is required to ensure the data is
passed through to the parts of the codebase that do the check;
fortunately, our automated tests of schemas are effective in verifying
that the new `sender_delivery_email` field isn't visible to the API.

Fixes #13369.
2019-11-05 12:33:20 -08:00
Tim Abbott
fb59f98304 test_events: Fix handling of client_gravatar flag.
Previously, we weren't properly passing through the value of the
client_gravatar flag from the caller, resulting in buggy results if
the caller passed client_gravatar=False to do_test().

We happened to not have any uses of this before, but we're about to
add one.
2019-11-05 12:33:20 -08:00
Tim Abbott
399acea755 outgoing webhooks: Call finalize_payload on payloads.
Apparently, the refactor months ago that introduced finalize_payload
wasn't applied to the outgoing webhook code path, resulting in message
dicts with an unexpected format with no avatar_url and some extra
values that were intended to be internal details not relevant to
external clients.

Because this API is not widely used, we expect there to be little to
no impact of converting this back to matching the `get_messages`
interface, as it once was and has always been intended to be.

The one somewhat tricky detail is that we include both the `content`
and `rendered_content` fields, rather than asking the client to pick
which they want via the `apply_markdown` flag, because there is no
place for the client to configure that setting.
2019-11-05 12:26:33 -08:00
Tim Abbott
9bf947846e tests: Improve outgoing webhook testing strategy. 2019-11-05 11:49:00 -08:00
Anders Kaseorg
0584a7938f tsconfig: Move to top level.
This way, webpack.config.ts is type checked.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-04 18:12:11 -08:00
Anders Kaseorg
de4685441c typescript: Type webpack.config.ts correctly.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-04 18:12:11 -08:00
Tim Abbott
aad99ce951 mattermost import: Fix handling of channels with no subscribers.
Previously, we skipped setting the list of subscribers to the channel,
which could result in problems if any messages had been posted there
in the past (e.g. because the channel used to have members, but now
doesn't).  It could be correct to skip importing dead channels
altogether, but probably simpler is to just set an empty subscriber list.
2019-11-04 18:10:37 -08:00
Tim Abbott
dc682da47a mattermost: Handle replies to private messages.
Previously, our logic to handle Mattermost's "replies" feature didn't
copy the right fields for private messages, where `channel_members` is
included on the message body rather than a `channel` name.
2019-11-04 18:10:37 -08:00
Tim Abbott
47cf99a970 realm: Prevent setting invalid enum policy values.
As discussed in the comment, ideally these checks should be added
completely automatically, rather than needing to be manually added
every time we add a new setting.  But hopefully the example code for
all of the similar enums that this provides will at least provide some
help.
2019-11-03 17:11:56 -08:00
Tim Abbott
4066b58faa send_message: Remove long-obsolete comment about @require_login.
All of our view functions work this way, so it doesn't need a special
comment.
2019-11-03 16:52:28 -08:00
Matheus Melo
c96762b7a9 settings: Add setting for who can edit user groups.
Fixes #12380.
2019-11-03 16:45:13 -08:00
Mateusz Mandera
849c925dc9 social_auth tests: Test registration with ldap populator enabled.
Finishes testing for the last remaining case and thus closes #13298.
2019-11-03 16:15:49 -08:00
Mateusz Mandera
c1095474c6 social_auth tests: Extract some common logic in the long signup tests. 2019-11-03 16:15:49 -08:00
Mateusz Mandera
5aded51b73 register: Pre-populate Name in social backend flow.
By adding some additional plumbing (through PreregistrationUser) of the
full_name and an additional full_name_validated option, we
pre-populate the Full Name field in the registration form when coming
through a social backend (google/github/saml/etc.) and potentially skip
the registration form (if the user would have nothing to do there other
than clicking the Confirm button) and just create the account and log
the user in.
2019-11-03 16:15:48 -08:00
Mateusz Mandera
34a540bacb context: Rename social_backends to external_authentication_methods.
The main purpose of this is to make that name change happen in
/server_settings. external_authentication_methods is a much better, more
descriptive name than social_backends from API perspective.
2019-11-03 15:55:44 -08:00
Mateusz Mandera
a62d084247 social_backends: Rename display_logo to display_icon. 2019-11-03 15:54:05 -08:00
Mateusz Mandera
15126dbe31 docs: Describe the name field of social_backends in /server_settings. 2019-11-03 15:54:05 -08:00
Mateusz Mandera
5a39e70bce social_backends: Remove sort_order from social backend dicts.
These are returned through the API, at the /server_settings
endpoint. It's better to just return the list of dicts with a guarantee
of being sorted in the correct order, than to clutter things with the
sort_order field.
2019-11-03 15:51:49 -08:00
Mateusz Mandera
339f742578 test_signup: Add test for a non-covered case in accounts_register. 2019-11-03 15:51:19 -08:00
Anders Kaseorg
28f3dfa284 js: Automatically convert var to let and const in most files.
This commit was originally automatically generated using `tools/lint
--only=eslint --fix`.  It was then modified by tabbott to contain only
changes to a set of files that are unlikely to result in significant
merge conflicts with any open pull request, excluding about 20 files.
His plan is to merge the remaining changes with more precise care,
potentially involving merging parts of conflicting pull requests
before running the `eslint --fix` operation.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-03 12:42:39 -08:00
Anders Kaseorg
f7245e9ec6 unminify: Update for webpack chunk splitting.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-01 18:25:30 -07:00
Mateusz Mandera
2e1529e879 registration: Fix logic disabling password requirement in the form.
This small block of code was over-indented. It should be run in this
part of the function unconditionally, not inside an "else" block.
We obviously want it to run regardless of whether
request.POST.get('from_confirmation')
is True or not.
2019-11-01 16:59:06 -07:00
Hashir Sarwar
35561c7fa8 docs: Replace username with YOUR_USERNAME in Git clone.
The other similar commands in this file use this style.
2019-11-01 16:39:50 -07:00
Mateusz Mandera
a4838d8b97 urls: Reorder where the accounts/login/google/ endpoint is defined.
Needed so that the google entry in social_backends in /server_settings
shows the new url rather than the legacy accounts/login/google/ url as
the login url.
2019-11-01 16:30:52 -07:00
Mateusz Mandera
29314f3195 api: Remove unused /get_auth_backends endpoint.
This legacy endpoint was designed for the original native Zulip mobile
apps, which were deprecated years ago in favor of the React Native
app.

It was replaced by /server_settings for active use years ago, so it's
safe to remove it now.
2019-11-01 12:30:59 -07:00
Lobster
7e4f8a42cf docs: Update redmine integration documentation.
With some textual tweaks by tabbott.
2019-11-01 12:21:37 -07:00
Anders Kaseorg
87b23720f5 blueslip: Apply ESLint.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-11-01 12:13:59 -07:00
Mateusz Mandera
8fd51a0ab5 docs: Improve SAML development environment docs. 2019-10-31 14:16:41 -07:00
Thomas Ip
c93522d847 blueslip: Make stack trace more readable.
The stack trace popup is now sourcemapped and each stackframe have a
expandable code context window.

[anders@zulipchat.com: Rebased and simplified.]
2019-10-31 13:47:54 -07:00
Anders Kaseorg
94c8fffdf3 docs: Fix invalid link.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-30 18:41:40 -07:00
David Rosa
dc5dbcbee3 docs: Merge "Backups" with export-and-import.
- Merges the "Backups" section from production/maintain-secure-upgrade.md
  with existing "Backups" section in production/export-and-import.md.
- Cleans up and makes content more clear/explicit.
- Adds short missing section on how to use wal-e configuration.
- Removes a lot of previously duplicate text explaining the difference between
  the tools.
- Various textual tweaks by tabbott.

Fixes #13184 and resolves #293.
2019-10-30 17:22:02 -07:00
Vishnu Ks
2f5f23ecc6 tests: Remove get-presence from curl test exclude_list. 2019-10-30 16:49:27 -07:00
Vishnu Ks
7aabbe2f35 tests: Remove delete-queue from curl test exclude_list. 2019-10-30 16:49:27 -07:00
Vishnu Ks
a99b96d9db tests: Remove get-events-from-queue from curl test exclude_list. 2019-10-30 16:49:27 -07:00
Vishnu Ks
4aae633d59 tests: Remove get-stream-topics from curl test exclude_list. 2019-10-30 16:49:27 -07:00
Vishnu Ks
db294072be tests: Remove update-subscription-data from curl test exclude_list. 2019-10-30 16:49:27 -07:00
Vishnu Ks
eb567abcec tests: Remove mark-as-read-bulk from curl test exclude_list. 2019-10-30 16:49:27 -07:00
Vishnu KS
39f7d250bd tests: Remove update-message-flags from curl test exclude_list. 2019-10-30 16:49:27 -07:00
Vishnu KS
31a50753f3 tests: Remove get-message-history from curl test exclude_list. 2019-10-30 16:49:27 -07:00
Vishnu KS
93c003d2aa tests: Remove update-message from curl test exclude_list. 2019-10-30 16:49:27 -07:00
Vishnu KS
8e9ccdf376 tests: Remove get-raw-message from curl test exclude_list. 2019-10-30 16:49:26 -07:00
Tlazypanda
722f3a6cfe docs: Add documentation for tab switcher.
Documentation for tab switcher added under User documentation
features as a section at the bottom of "Tips and Warnings" article.

Text substantially rewritten by tabbott.

Fixes #12505
2019-10-30 16:36:30 -07:00
Mateusz Mandera
65a709fb48 docs: Fix typo in gsoc-ideas.md.
This is a GSoC doc, so the GSoD reference seems to be a misspelling.
2019-10-30 16:20:38 -07:00
Andrew Szeto
b312001fd9 rabbitmq: Set a short TCP keepalive idle time on BlockingConnection.
The code comment explains this issue in some detail, but essentially
in Kubernetes and Docker Swarm systems, the container overlayer
network has a relatively short TCP idle lifetime (about 15 minutes),
which can lead to it killing the connection between Tornado and
RabbitMQ.

We fix this by setting a TCP keepalive on that connection shorter than
15 minutes.

Fixes #10776.
2019-10-30 16:15:44 -07:00
David Wood
7fc72dff44 left sidebar: Avoid unnecessary scrollbar.
This commit modifies the `#add-stream-link` element to be a `div`
containing the previous `a` element. The margin that was added to
`#stream-filters-container .simplebar-content` is then moved to that new
`div`.

This preserves the intended behaviour of the commit which introduced
the margin, to fix #12519 while removing an unnecessary scrollbar
which could hide the top-most stream in the stream list.

Fixes #13050

Signed-off-by: David Wood <david@davidtw.co>
2019-10-30 13:21:28 -07:00
Anders Kaseorg
c10f3f87b7 package.json: Move @types/* to devDependencies.
We only run TypeScript as a linter, so these need only be present in
development.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-30 13:13:21 -07:00
Anders Kaseorg
c31615a760 package.json: Remove @types/source-map.
`source-map` provides its own types, so with TypeScript configured
with `--moduleResolution node`, we don’t need the obsolete
`@types/source-map` package.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-30 13:13:21 -07:00
Anders Kaseorg
98676f5a1f typescript: Move js/js_typings/zulip/index.d.ts to js/global.d.ts.
The js_typings directory is not set up correctly for us to add new
type declarations for untyped external modules.  The correct
configuration would be something like

{
    "compilerOptions": {
        "baseUrl": ".",
        "paths": {
            "*": ["js_typings/*"],
        },
        "typeRoots": ["js_typings"],
    },
    "exclude": [
        "js_typings",
    ],
}

but that configuration is incompatible with using the same directory
for _internal_ modules like the ones declared here.

Also, correct some mistakes the generation of this list.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-30 13:12:54 -07:00
Anders Kaseorg
8654af367d tsconfig: Set module-related options.
Set `--esModuleInterop` and `--isolatedModules` for consistency with
Babel.  `tsc --init` adds `--esModuleInterop` by default.

Set `--moduleResolution node` so we can find type definitions in
modules that provide them.

Set `--forceConsistentCasingInFileNames`, which seems like a good
idea, and which `tsc --init` will add by default in TypeScript 3.7.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-30 13:12:54 -07:00
Anders Kaseorg
7a0a186e5f tsconfig: Remove redundant options.
`--jsx preserve` and `--removeComments false` are already the default.
`--strict` already implies `--noImplicitAny`, `--noImplicitThis`,
`--alwaysStrict`.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-30 13:12:54 -07:00
Anders Kaseorg
70f72a3ae8 security: Send SameSite=Lax cookies.
Send the `csrftoken` and `sessionid` cookies with `SameSite=Lax`.
This adds a layer of defense against CSRF attacks and matches the new
default in Django 2.1:

https://docs.djangoproject.com/en/2.1/releases/2.1/#samesite-cookies

This can be reverted when we upgrade to Django ≥ 2.1.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-30 13:12:11 -07:00
Anders Kaseorg
042c558bb3 eslint: Enable sort-imports rule.
I figure we should enable this before we have lots of imports.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-30 13:10:25 -07:00
Anders Kaseorg
0ae2c5c96e nginx: Enable TLS 1.3 if supported.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-30 13:09:57 -07:00
Anders Kaseorg
d577537304 pointer: Fix pointer update.
Commit d17b577d0c (#13321) incorrectly
transformed this line, even though I thought my script had a specific
guard against this.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-30 11:50:15 -07:00
Rafid Aslam
447f74ae63 Upgrade pika to 1.1.*.
Upgrade pika to 1.1.* and make some changes accordingly
to comply with the new version.

Fixes #12899.
2019-10-29 17:01:12 -07:00
Tim Abbott
c7c6f01236 docs: Advertise SAML authentication as an official feature.
Fixes #13275.
2019-10-29 16:55:22 -07:00
Mateusz Mandera
4561652513 ldap docs: LDAP backend now works for initial realm creation.
Fixes #9576.

Initial realm creation now works fine with the LDAP backend, so the
part of the docs about needing to create the first realm with the
email backend is unnecessary and just complicates the setup process,
so it seems best to just remove it.
2019-10-29 16:21:58 -07:00
Tim Abbott
18b4a58bc2 docs: Update GSoC/GSoD ideas pages.
The main goal is to correct sections that clearly haven't been updated
since 6+ months ago.
2019-10-29 16:07:10 -07:00
Mateusz Mandera
f229839022 docs: Document social_backends in /server_settings.
This updates the docs for the /server_settings endpoint to document the
newly added social_backends structure.
2019-10-29 15:57:29 -07:00
Hemanth V. Alluri
ac9008f564 openapi: Update the test and python code example for get-all-users.
This is following the change to the /users endpoint where we allow
an optional parameter "include_custom_profile_fields" which would
allow the client to request for users' custom profile fields along
with their other standard data.
2019-10-29 15:41:35 -07:00
Hemanth V. Alluri
c1370547d5 events: Only send bot_type for bots and thus remove the for_api param. 2019-10-29 15:41:35 -07:00
Hemanth V. Alluri
fa6bd42f4c docs: Update the example for /users for custom profile fields.
The previous example no longer gives a good enough idea of what the user
can expect when the `include_custom_profile_fields` boolean parameter is
set to true.
2019-10-29 15:41:35 -07:00
Hemanth V. Alluri
5b3e346369 users: Send custom profile fields with the /profile endpoint. 2019-10-29 15:41:35 -07:00
Anders Kaseorg
d6377b00c0 node_cache: Don’t retry copying node_modules; let yarn do its thing.
`copytree` throws an error if the target already exists, and we don’t
really want to rerun the copy anyway.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-29 12:30:28 -07:00
Anders Kaseorg
d4443bc4f8 requirements: Upgrade Python requirements.
Addresses a potential Pillow DoS vulnerability, among other things.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-28 16:42:20 -07:00
Anders Kaseorg
2bbcd6ab34 bundles: Factor out portico bundle.
This adds translations.js to the digest entrypoint.  Presumably that’s
fine.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-28 15:53:15 -07:00
Anders Kaseorg
fda70a5458 templates: Use just one webpack entry point per page.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-28 15:53:15 -07:00
Anders Kaseorg
f245fcf408 webpack: Enable code splitting and deduplication.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-28 15:53:15 -07:00
Anders Kaseorg
d1a3bf424a requirements: Use webpack4 fork of django-webpack-loader.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-28 15:53:15 -07:00
Anders Kaseorg
ee9a6071fd 5xx.html: Build with webpack.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-28 15:53:15 -07:00
Anders Kaseorg
f077508c6d test-backend, run-casper: Remove proxy vars instead of setting to "".
Setting http_proxy to the empty string caused a spurious error from
xmlsec:

>>> import os
>>> os.environ["http_proxy"] = ""
>>> import xmlsec
error : Unknown IO error

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-28 15:47:45 -07:00
Anders Kaseorg
c3bf7c6889 webpack: Consolidate production and development plugin configuration.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-28 15:39:34 -07:00
Anders Kaseorg
27fac76da8 styles: Move media queries into the files they override.
Webpack code splitting will make the inclusion order of CSS files less
obvious, and we need to guarantee that these rules follow the rules
they override.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-28 15:39:17 -07:00
Anders Kaseorg
3216dca6bb styles: Remove dead .screen-{full,medium,narrow}-show classes.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-28 15:33:02 -07:00
Anders Kaseorg
51de011c07 styles: Remove conflicting .guest-avatar rules.
These were fighting with #avatar, #user-avatar-block,
.inline_profile_picture, .popover-avatar.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-28 15:33:02 -07:00
Tim Abbott
7a66dfa133 auth: Tweak docs now that SAML supports multiple IdPs. 2019-10-28 15:22:29 -07:00
Mateusz Mandera
9d14b50186 auth: Support not using an icon when rendering social login buttons.
Since we were using a placeholder emote for SAML, we change the
defaults to no icon now that it's possible.
2019-10-28 15:14:57 -07:00
Mateusz Mandera
b870816a75 saml: Sanity-check configuration in both login and signup codepaths. 2019-10-28 15:11:19 -07:00
Mateusz Mandera
db29fcbbc4 auth: Add social_backends to /server_settings. 2019-10-28 15:11:19 -07:00
Mateusz Mandera
892d25faa1 auth: Change SAML login url scheme, enabling multiple IdP support.
The url scheme is now /accounts/login/social/saml/{idp_name} to initiate
login using the IdP configured under "idp_name" name.

display_name and display_logo (the name and icon to show on the "Log in
with" button) can be customized by adding the apprioprate settings in
the configured IdP dictionaries.
2019-10-28 15:09:42 -07:00
Mateusz Mandera
28dd1b34f2 auth: Refactor social login rendering.
login_context now gets the social_backends list through
get_social_backend_dicts and we  move display_logo customization
to backend class definition.

This prepares for easily adding multiple IdP support in SAML
authentication - there will be a social_backend dict for each configured
IdP, also allowing display_name and icon customization per IdP.
2019-10-28 15:06:26 -07:00
Mateusz Mandera
9532e99800 saml: Give SAMLAuthBackend highest sort_order. 2019-10-28 15:06:26 -07:00
David Rosa
3fb2339511 docs: Fix formatting of warnings.
Fixes warning formatting in testing.md and setup-advanced.md
with reStructured Text so that the warnings stand out.
2019-10-28 15:03:55 -07:00
Anders Kaseorg
ed607bee2c emoji_picker: Clear search_results by assigning 0 to its length.
This will allow `search_results` to be `const`, which works around a
future ESLint complaint.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-28 15:02:43 -07:00
Anders Kaseorg
02004c9b0f js: Convert self-referential vars to const.
ESLint won’t convert these automatically because it can’t rule out a
behavior difference arising from an access to a self-referential var
before it’s initialized:

> var x = (f => f())(() => x);
undefined
> let y = (f => f())(() => y);
Thrown:
ReferenceError: Cannot access 'y' before initialization
    at repl:1:26
    at repl:1:15

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-28 15:02:43 -07:00
Anders Kaseorg
7ae84d5ce1 js: Break lines that become too long after converting var to const.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-28 15:02:43 -07:00
Anders Kaseorg
4d37dfcf85 js: Convert vars declared separately and assigned once to const.
Because of the separate declarations, ESLint would convert them to
`let` and then trigger the `prefer-const` error.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-28 15:02:43 -07:00
Anders Kaseorg
c3b4c0a229 frontend_tests: Use let with explicit null in components test.
Even though this variable was only assigned once, it was accessed
before its initialization, so it couldn’t be converted directly to
`let` or `const`.  Use `let` with an explicit `null` to make it
clearer what’s going on and satisfy ESLint.  (Why not `undefined`?
There’s an ESLint rule against that too.)

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-28 15:02:43 -07:00
Anders Kaseorg
a547413347 js: Add braces to case blocks declaring variables.
This helps to prepare for the migration of `var` to `let` and `const`.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-28 15:02:43 -07:00
Jan Koscisz
12bd3c04c0 integration: Fix missing taiga test action.
Previously testing webhook from taiga site would result in error.
This adds missing 'test' action to taiga webhooks.

Fixes #13317.
2019-10-28 14:58:24 -07:00
Anders Kaseorg
d17b577d0c js: Purge useless IIFEs.
With webpack, variables declared in each file are already file-local
(Global variables need to be explicitly exported), so these IIFEs are
no longer needed.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-10-25 13:51:21 -07:00
Anders Kaseorg
5f590d3500 js: Remove /* eslint indent: "off" */ comments.
The time has come to dedent these files.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-25 13:21:43 -07:00
Mateusz Mandera
8c065d1fcd ldap: Ensure django_to_ldap_username returns username that is in ldap.
This changes the way django_to_ldap_username works to make sure the ldap
username it returns actually has a corresponding ldap entry and raise an
exception if that's not possible. It seems to be a more sound approach
than just having it return its best guess - which was the case so far.
Now there is a guarantee that what it returns is the username of an
actual ldap user.

This allows communicating to the registration flow when the email being
registered doesn't belong to ldap, which then will proceed to register
it via the normal email backend flow - finally fixing the bug where you
couldn't register a non-ldap email even with the email backend enabled.

These changes to the behavior of django_to_ldap_username require small
refactorings in a couple of other functions that call it, as well as
adapting some tests to these changes. Finally, additional tests are
added for the above-mentioned registration flow behavior and some
related corner-cases.
2019-10-25 12:14:51 -07:00
Greg Price
3a74de2ade shared: Bump version to 0.0.2.
This will let us update mobile to use this version.
2019-10-24 14:56:56 -07:00
Greg Price
71596648c2 typing_status: Switch sentinel "recipient" value to null.
This feels a bit more semantically appropriate: it more clearly says
"here's some information: there is no (relevant) recipient", rather
than "no information available".  (Both `null` and `undefined` in JS
can have either meaning, but `undefined` especially commonly means
the latter.)

Concretely, it ensures a bit more explicitness where the value
originates: a bare `return;` becomes `return null;`, reflecting the
fact that it is returning a quite informative value.

Also make the implementation more explicit about what's expected here,
replacing truthiness tests with `!== null`.  (A bit more idiomatic
would be `!= null`, which is equivalent when the value is well-typed
and a bit more robust to ill-typing bugs.  But lint complains about
that version.)
2019-10-24 14:56:56 -07:00
Greg Price
a191890213 typing_status: Fold stop into main method update.
It'd already been the case for some while that calling `stop` had the
same effect as calling `update` (previously `handle_text_input`) with
a falsy recipient.  With the API changes in the previous few commits,
this becomes quite natural to make explicit in the API.
2019-10-24 14:56:56 -07:00
Greg Price
e639b0a6f8 typing_status: Write jsdoc for main entry point, and rename.
This was named after when it gets called from the UI, rather than
after what it can be expected to do.

Naming it after what it's meant to do -- and giving a summary line to
expand on that -- provides a more helpful semantic idea for reasoning
about the function.  Doubly so for using the function in a different
client with its own UI, like the mobile app.
2019-10-24 14:56:56 -07:00
Greg Price
dcb5bb7914 typing_status: Combine two parameters into one, with a maybe-type.
The main motivation for this change is to simplify this interface
and make it easier to reason about.

The case where it affects the behavior is when
is_valid_conversation() returns false, while current_recipient
and get_recipient() agree on some truthy value.

This means the message-content textarea is empty -- in fact the
user just cleared it, because we got here from an input event on
it -- but the compose box is still open to some PM thread that we
have a typing notification still outstanding for.

The old behavior is that in this situation we would ignore the
fact that the content was empty, and go ahead and prolong the
typing notification, by updating our timer and possibly sending a
"still typing" notice.

This contrasts with the behavior (both old and new) in the case
where the content is empty and we *don't* already have an
outstanding typing notification, or we have one to some other
thread.  In that case, we cancel any existing notification and
don't start a new one, exactly as if `stop` were called
(e.g. because the user closed the compose box.)

The new behavior is that we always treat clearing the input as
"stopped typing": not only in those cases where we already did,
but also in the case where we still have the same recipients.
(Which seems like probably the common case.)

That seems like the preferable behavior; indeed it's hard to see
the point of the "compose_empty" logic if restricted to the other
cases.  It also makes the interface simpler.

Those two properties don't seem like a coincidence, either: the
complicated interface made it difficult to unpack exactly what
logic we actually had, which made it easy for surprising wrinkles
to hang out indefinitely.
2019-10-24 14:56:56 -07:00
Greg Price
dcccef9b3a typing_status: Make some test cases slightly less artificial.
All these cases are meant to simulate having a user actually typing a
message to some actual recipients, so the `conversation_is_valid`
parameter would be true.

We make this change so that in an upcoming change that eliminates this
parameter, the adjustments to the test cases can be highly regular and
we don't have to introduce a new wrinkle to correspond to these values
being false.
2019-10-24 14:56:56 -07:00
Greg Price
3bdd741852 typing status: Cut unconverted_data conditional.
Returning true from this function means we go on to send, or extend
the lifetime of, a typing notification; returning false means we don't.

It's hard to see why having a partially-entered name in the recipient
box should mean we're *more* inclined to send a typing notification to
the set of recipients that are already entered; if anything, it seems
like it should make us *less* inclined to do so.  So we're better off
without this conditional.

The conditional was introduced in commit 72295e94b, as part of a
conversion from user emails to user IDs; there, it seems to replace a
condition that went in the opposite direction, returning *false* if
there were any invalid emails in the recipient box.  So perhaps it's
just inverted.

Moreover, the (re-)inverted version would also be wrong: if the user
is typing a PM addressed to some users, and they hit send, the message
will go to those users whether or not they have any unconverted text
in the recipients box.  So the typing notifications should too.
2019-10-24 14:56:56 -07:00
Greg Price
e42c3f7418 typing status: Cut redundant is-this-PMs condition.
When this condition is true, user_ids_array will always be `undefined`
and so we won't reach this conditional anyway.
2019-10-24 14:56:56 -07:00
Greg Price
5c220ed11a typing_status: Use parameters for data rather than callbacks.
The real purpose these two callbacks serve is exactly what an ordinary
parameter is perfect for:
 * Each has just one call site, at the top of the function.
 * They're not done for side effects; the point is what they return.
 * The function doesn't pass them any arguments of its own, or
   otherwise express any internal knowledge that doesn't just as
   properly belong to its caller.

So, push the calls to these callbacks up into the function's caller,
and pass in the data they return instead.

This greatly simplifies the interface of `handle_text_input` and of
`typing_status` in general.
2019-10-24 14:56:56 -07:00
Greg Price
07322d78a0 typing_status: Pull is_valid_conversation call up to top.
This is intended as a pure refactor, making the data flow clearer in
preparation for further changes.  In particular, this makes it
manifest that the calls to `get_recipient` and `is_valid_conversation`
don't depend on anything else that has happened during the call to
`handle_text_input`.

This is indeed a pure refactor because
 * is_valid_conversation itself has no side effects, either in the
   implementation in typing.js or in any reasonable implementation,
   so calling it sooner doesn't affect anything else;
 * if we do reach it, the only potentially-side-effecting code it's
   moving before is a call to `stop_last_notification`, and that in
   turn (with the existing, or any reasonable, implementation of
   `notify_server_stop`) has no effect on the data consulted by
   the implementation of `is_valid_conversation`.
2019-10-24 14:56:56 -07:00
Anders Kaseorg
453919bbc7 version: Only let git describe match tags beginning with a digit.
This will let us use other tags for things like `@zulip/shared`
versions.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-24 14:54:45 -07:00
Anders Kaseorg
99d34e6ade hello: Fix carousel indicator buttons.
Apparently deferring our own Bootstrap (commit
f1ecd3c18b, #13164) means that this
surprise copy of Bootstrap 2.3.2 also needs to be deferred.  What is
this even doing here.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-24 13:43:16 -07:00
Tim Abbott
4be355053d search help: Fix buggy rendering of stream search example.
Due to a typo, we've had the example email address as the search
operator for some time :(.
2019-10-24 13:06:58 -07:00
Tim Abbott
f84c037225 puppet: Tune check_postgres_locks parameters.
This has been a spurious alert for a long time.

It's unclear that this check is useful at all, but if it spikes
dramatically above what's normal, there's perhaps still utility in
being alerted.
2019-10-23 15:04:38 -07:00
Hemanth V. Alluri
1946692f9a users: Refactor get_members_backend endpoint to use get_raw_user_data.
Modify the get_raw_user_data method for use by the /users API endpoint
and then modify the /users endpoint to use it.
2019-10-23 14:50:26 -07:00
Hemanth V. Alluri
dca990d60a events: Extract custom profile field logic from get_raw_user_data.
This is a simple refactor to move the code which gets custom profile
field values in the get_raw_user method to a separate function.
2019-10-23 14:36:07 -07:00
Hemanth V. Alluri
34849d7355 test_events: Fix a small typo for test_realm_bots_admin. 2019-10-23 14:35:32 -07:00
David Rosa
bd3a8f1e96 docs: Merge front-end-build-process with html-css.
This merges the "Static asset pipeline" article as a new section
at the bottom of the "HTML and CSS" article.
2019-10-23 13:08:36 -07:00
Tim Abbott
03af3d2eb6 docs: Fix old-style markdown link in authentication-methods.
This was introduced recently due to a rebase of an older branch.
2019-10-23 13:04:30 -07:00
Mateusz Mandera
869b57b7f7 ldap tests: Change TestQueryLDAP tests to use the test ldap directory.
Instead of mocking the _LDAPUser class, these tests can now take
advantage of the test directory that other ldap are using. After these
changes, test_query_email_attr also verifies that query_ldap can
successfully be used to query by user email, if email search is
configured.
2019-10-22 16:03:58 -07:00
Mateusz Mandera
1be2779515 tests: Add ldap_username() and ldap_password() method. 2019-10-22 16:03:58 -07:00
Mateusz Mandera
68f4cd1e94 ldap: Extract ldap user -> django username mapping logic to a function.
Fixes #11878

Instead of a confusing mix of django_auth_backed applying
ldap_to_django_username in its internals for one part of the
translation, and then custom logic for grabbing it from the email
attribute of the ldapuser in ZulipLDAPAuthBackend.get_or_build_user
for the second part of the translation,
we put all the logic in a single function user_email_from_ldapuser
which will be used by get_or_build of both ZulipLDAPUserPopulator and
ZulipLDAPAuthBackend.

This, building on the previous commits with the email search feature,
fixes the ldap sync bug from issue #11878.

If we can get upstream django-auth-ldap to merge
https://github.com/django-auth-ldap/django-auth-ldap/pull/154, we'll
be able to go back to using the version of ldap_to_django_username
that accepts a _LDAPUser object.
2019-10-22 16:02:23 -07:00
Mateusz Mandera
3699fe28f8 ldap: Use email search in django_to_ldap_username.
With this, django_to_ldap_username can take an email and find the ldap
username of the ldap user who has this email - if email search is
configured.

This allows successful authenticate() with ldap email and ldap password,
instead of ldap username. This is especially useful because when
a user wants to fetch their api key, the server attempts authenticate
with user_profile.email - and this used to fail if the user was an ldap
user (because the ldap username was required to authenticate
succesfully). See issue #9277.
2019-10-22 15:57:52 -07:00
Mateusz Mandera
fea4d0b2be ldap: Do a proper search for email in email_belongs_to_ldap.
This fixes a collection of bugs surrounding LDAP configurations A and
C (i.e. LDAP_APPEND_DOMAIN=None) with EmailAuthBackend also enabled.

The core problem was that our desired security model in that setting
of requiring LDAP authentication for accounts managed by LDAP was not
implementable without a way to

Now admins can configure an LDAPSearch query that will find if there
are users in LDAP that have the email address and
email_belongs_to_ldap() will take advantage of that - no longer
returning True in response to all requests and thus blocking email
backend authentication.

In the documentation, we describe this as mandatory configuration for
users (and likely will make it so soon in the code) because the
failure modes for this not being configured are confusing.

But making that change is pending work to improve the relevant error
messages.

Fixes #11715.
2019-10-22 15:53:39 -07:00
Rohitt Vashishtha
8d172d8bf6 tests/message_store: Assert both flag modifying code paths are consistent. 2019-10-21 22:25:25 -07:00
Rohitt Vashishtha
4cfb209dc5 unread: Don't count wildcard mentions in muted streams/topics.
Users generally don't expect wildcard mentions in muted streams and
topics to be treated as a mention, either for the purposes of desktop
notifications or the unread mention counts.

This fixes the unread mention counts part of the issue.

Fixes part of #13073.
2019-10-21 22:23:29 -07:00
Tim Abbott
87b43fdac0 tests: Fix whitespace around INVALID_STREAM_ID. 2019-10-21 22:14:46 -07:00
Vishnu KS
ec955f8f78 support: Show confirmation links in search.
Fixes #13060 #12784
2019-10-21 16:56:50 -07:00
Vishnu KS
e080b42fe5 tests: Move get_stream_id function to ZulipTestCase. 2019-10-21 16:56:48 -07:00
Vishnu KS
23036a9f40 confirmation: Set confirmation object realm attribute in realm reactivation.
The value of realm attribute in confirmation object used to be empty
before. We are not currently using the realm attribute of reactivation
links anywhere. The value of realm stored in content_object is currently
used.
2019-10-21 16:52:46 -07:00
Vishnu KS
139ebf387b support: Pass various realm functions as template context.
We currently have code to calculate the value of realm_icon_url,
admin_emails and default_discount in two diffrent places. With
the addition of showing confirmation links it would become three.
The easiest way to deduplicate the code and make the view cleaner
is by doing the calculations in template. Alternatively one can
write a function that takes users, realms and confirmations as
arguments and sets the value of realm_icon_url, admin_emails and
default_discount appropriately in realm object according to the
type of the confirmation. But that seems more messy than passing
the functions directly to template approach.
2019-10-21 16:52:46 -07:00
Vishnu KS
62a8e378a6 support: Refactor realm details into a seperate template. 2019-10-21 16:52:46 -07:00
Tim Abbott
b12d3d54c6 events: Fix documentation testing for /events.
Most of the failures were due to parameters that are not intended to
be used by third-party code, so the correct fix for those was the set
intentionally_undocumented=True.

Fixes #12969.
2019-10-21 16:50:10 -07:00
Tim Abbott
c35472e025 test_openapi: Fix confused error messages for missing parameters.
These conditionals were backwards.
2019-10-21 16:26:08 -07:00
Tim Abbott
c120ce6ecc events: Make it easy for test_openapi to find /events. 2019-10-21 16:26:00 -07:00
Tim Abbott
1ce5191009 docs: Remove beta tag on email address visibility.
The last major follow-up task for this feature was merged recently.
2019-10-21 16:13:04 -07:00
Rishi Gupta
0b39263ec0 billing: Rename get_seat_count to get_latest_seat_count.
This will help as our billing system becomes more async to accommodate
on-prem billing.
2019-10-21 16:06:18 -07:00
chgl
bea9e41fbd webhooks: Add Harbor webhook integration. 2019-10-21 15:51:35 -07:00
Pragati Agrawal
37f10509f8 user profile modal: Hide email under hidden email-address-visibility case.
When email address visibility is set to everyone, there is no change in
behavior, but when it is set to "admins-only", we don't show any email
in user profile modal (just like popovers) for everyone but admins.
2019-10-21 15:43:49 -07:00
Pragati Agrawal
b1318edbea popovers: Hide email under hidden email-address-visibility cases.
When email address visibility is set to everyone, there is no change in
behavior, but when it is set to "admins-only", we don't show any email
in popovers for everyone but admins.
2019-10-21 15:43:49 -07:00
Pragati Agrawal
857470c5ca events: Add delivery_email to user initial state data.
For admins, this adds `delivery_email` in addition to `email` for the
case when email address visibility is set to admins only.
2019-10-21 15:43:49 -07:00
Mateusz Mandera
8c85040a92 css: Fix azuread-wrapper name.
It should be azuread-oauth2-wrapper, as the name of the corresponding
backend is 'azuread-oauth2'. Without the correct name, the icon isn't
showing on the "Log in with AzureAD" button.
2019-10-21 15:40:27 -07:00
Vishnu Ks
37c5f9b9c5 tests: Move add-linkifiers to correct position in exclude list. 2019-10-21 15:30:57 -07:00
Vishnu KS
f2242c1487 docs: Make update-notification-settings use curl example system. 2019-10-21 17:10:35 +05:30
Mateusz Mandera
bbf2474bd0 tests: setUp overrides should call super().setUp().
MigrationsTestCase is intentionally omitted from this, since migrations
tests are different in their nature and so whatever setUp()
ZulipTestCase may do in the future, MigrationsTestCase may not
necessarily want to replicate.
2019-10-19 17:27:01 -07:00
Vishnu KS
0af7aa8db3 docs: Make update-stream use curl example system.
new_name and description params should be valid JSON
strings. The format of these params are marked as
json so that the curl example genenrator can convert
them into json strings.
2019-10-18 13:45:30 -07:00
Vishnu Ks
e96d96b6e4 docs: Add curl example to upload-file. 2019-10-18 13:45:30 -07:00
Vishnu Ks
9ac77a8734 docs: Make upload-custom-emoji use curl example system. 2019-10-18 13:45:30 -07:00
Mateusz Mandera
438c4b2935 tests: tearDown overrides should call super().tearDown().
ZulipTestCase subclasses that override tearDown() should call the parent
class tearDown() too, as it does some clean up of its own.
2019-10-18 13:36:59 -07:00
Mateusz Mandera
72dd834088 test_signup: Migrate ldap tests to the new format. 2019-10-17 17:10:39 -07:00
Mateusz Mandera
33050c733d test_email_notifications: Migrate ldap tests to the new format. 2019-10-17 16:49:53 -07:00
Mateusz Mandera
e9df17884a test_settings: Migrate ldap tests to the new format. 2019-10-17 16:49:53 -07:00
Mateusz Mandera
efba7290fd test_auth_backends: Migrate ldap tests to the new format. 2019-10-17 16:49:53 -07:00
Mateusz Mandera
8cbcf8cf45 tests: Add some logic to ZulipTestCase to prepare to migrate ldap tests. 2019-10-17 16:49:53 -07:00
Mateusz Mandera
52324bd005 requirements: Upgrade fakeldap to master.
For simple directory search support.
2019-10-17 16:49:53 -07:00
Greg Price
b70b7df22c shared: Describe interface of typing_status in Flow.
This allows the mobile app to stay well-typed while using this code.
2019-10-17 16:48:23 -07:00
Greg Price
a63786ac0d shared: Set up a way to share some frontend code with the mobile app.
This adds the general machinery required, and sets it up for the file
`typing_status.js` as a first use case.

Co-authored-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-17 16:48:23 -07:00
Anders Kaseorg
d8070376fb babelrc: Replace with babel.config.js.
This has different resolution semantics that we need to take advantage
of: .babelrc only applied to files within its own package.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-17 16:48:23 -07:00
Anders Kaseorg
a3475b422d typing_status: Convert to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-17 16:48:23 -07:00
Anders Kaseorg
173c9cee42 frontend_tests: Switch from ts-node to Babel; add rewire-ts plugin.
This will let tests rewrite TypeScript/ES6 module bindings that would
otherwise be read-only.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-17 16:48:23 -07:00
Greg Price
72366c8deb typing status: Fix names "user_ids_string" that were actually arrays.
These indeed used to be strings, but were converted to arrays in
b8250fc61, and these names didn't get updated to match.

A classic example of why type-checking is a great job to get
machines to do. :-)
2019-10-17 16:48:23 -07:00
Tim Abbott
d364891894 ldap: Fix password prompt when configured only to populate data.
Previously, the logic for determining whether to provide an LDAP
password prompt on the registration page was incorrectly including it
if any LDAP authentication was backend enabled, even if LDAP was
configured with the populate-only backend that is not responsible for
authentication (just for filling in name and custom profile fields).

We fix this by correcting the conditional, and add a test.

There's still follow-up work to do here: We may still end up
presenting a registration form in situations where it's useless
because we got all the data from SAML + LDAP.  But that's for a future
issue.

This fixes a bug reported in #13275.
2019-10-17 14:46:46 -07:00
Rohitt Vashishtha
5fd0a121ea tests: Clean up and extend topic links tests in test_messages.
This is a follow-up to b69213808a.
We now actually send messages from the notification_bot, which
is the real usecase for this code.

Also, this cleans up the code and removes needless asserts like
`assertNotEqual(zulip_realm, lear_realm)` making the test easier
to read.
2019-10-16 17:39:09 -07:00
Tim Abbott
2504d9ffc9 docs: Merge "HTML templates" and "HTML and CSS" docs. 2019-10-16 15:44:26 -07:00
Tim Abbott
766b001069 docs: Clean up some out-of-date HTML/CSS docs. 2019-10-16 15:36:15 -07:00
Vishnu Ks
ca44143014 docs: Make render-message use curl example system. 2019-10-15 15:53:03 -07:00
Vishnu Ks
8ffdbdb9bd docs: Make dev-fetch-api-key use curl example system. 2019-10-15 15:53:03 -07:00
Vishnu Ks
1a0a282242 docs: Make delete-queue use curl example system. 2019-10-15 15:53:03 -07:00
Vishnu Ks
f7add25cc2 docs: Make get-events-from-queue use curl example system. 2019-10-15 15:53:03 -07:00
Vishnu Ks
33f7ae7766 docs: Make register-queue use curl example system. 2019-10-15 15:53:03 -07:00
Vishnu Ks
9d73578930 openapi: Fix narrow param example in /register POST endpoint. 2019-10-15 15:53:03 -07:00
Vishnu Ks
28e8df15a0 openapi: Fix fetch_event_types param example in /register POST endpoint. 2019-10-15 15:53:03 -07:00
Vishnu Ks
626c536b5e openapi: Fix event_types param example in /register POST endpoint. 2019-10-15 15:53:03 -07:00
Vishnu Ks
a42ef542d2 docs: Make get-org-emoji use curl example system. 2019-10-15 15:53:03 -07:00
Vishnu Ks
0b297fc092 docs: Make remove-linkifiers use curl example system. 2019-10-15 15:53:03 -07:00
Vishnu Ks
16dfc772fb docs: Make add-linkifiers use curl example system. 2019-10-15 15:53:03 -07:00
Vishnu Ks
3cf939a8a4 docs: Make list-linkifiers use curl example system. 2019-10-15 15:53:03 -07:00
Vishnu Ks
a20b399321 docs: Add is_incompatible key to server-settings response. 2019-10-15 15:53:03 -07:00
Vishnu Ks
616502fd37 docs: Remove realm_logo and realm_night_logo from server-settings response.
They were removed in 16123c9a58
2019-10-15 15:53:03 -07:00
Vishnu Ks
573d470fd6 docs: Make server-settings use curl example system. 2019-10-15 15:53:03 -07:00
Vishnu Ks
6a5fdcabbd docs: Make delete-user-group use curl example system. 2019-10-15 15:53:03 -07:00
Vishnu Ks
d1540f7e10 docs: Make update-user-group use curl example system. 2019-10-15 15:53:03 -07:00
Vishnu Ks
c5d6be4df7 docs: Make create-user-group use curl example system. 2019-10-15 15:53:03 -07:00
Vishnu KS
70e8f5ce8a docs: Make get-user-groups use curl example system. 2019-10-15 15:53:03 -07:00
Vishnu KS
519b24061d docs: Update the response schema of get-presence.
The response no longer contains pushable and client keys.
2019-10-15 15:53:03 -07:00
Vishnu KS
503e65079a docs: Make get-presence use curl example system. 2019-10-15 15:53:03 -07:00
Vishnu Ks
6f59a17bfe docs: Make typing use curl example system. 2019-10-15 15:53:03 -07:00
Vishnu Ks
af83884f6f docs: Make create-user use curl example system. 2019-10-15 15:53:02 -07:00
Vishnu Ks
2a8065963e docs: Make get-profile use curl example system. 2019-10-15 15:40:44 -07:00
Vishnu Ks
b68b566711 docs: Make get-all-users use curl example system. 2019-10-15 15:40:44 -07:00
Vishnu Ks
ea06dc6ab3 docs: Make delete-stream use curl example system. 2019-10-15 15:40:44 -07:00
Vishnu Ks
8b29f52d09 docs: Make get-stream-id use curl example system. 2019-10-15 15:40:44 -07:00
Vishnu Ks
04cc121b77 docs: Make mute-topics.md use curl example system. 2019-10-15 15:40:44 -07:00
Vishnu Ks
13bdfc0ef8 docs: Make get-stream-topics use curl example system. 2019-10-15 15:40:44 -07:00
Vishnu KS
bd6b41cb9d tests: Remove unused variable in test_curl_examples. 2019-10-15 15:40:44 -07:00
Vishnu Ks
ad16c55c77 docs: Make remove-subscriptions use curl example system. 2019-10-15 15:40:44 -07:00
Vishnu Ks
4364e31d69 docs: Make update-subscription-properties use curl example system. 2019-10-15 15:40:44 -07:00
Vishnu Ks
89d82ab827 openapi: Improve description of subscriptions in /users/me/subscriptions. 2019-10-15 15:40:44 -07:00
Vishnu Ks
06883dc4b2 docs: Make add-subscriptions use curl example system. 2019-10-15 15:40:44 -07:00
Vishnu Ks
94d31e9d4f docs: Make get-subscribed-streams use curl example system. 2019-10-15 15:40:44 -07:00
Vishnu Ks
9442422da1 docs: Make get-all-streams use curl example system. 2019-10-15 15:40:44 -07:00
Vishnu Ks
c35ef2d390 bugdown: Add option to include only selected fields in generate_curl_example. 2019-10-15 15:40:44 -07:00
Vishnu Ks
3f9835ed07 docs: Make mark-as-read-bulk use curl example system. 2019-10-15 15:40:44 -07:00
Vishnu Ks
f0b099dbc0 docs: Make update-message-flags use curl example system. 2019-10-15 15:40:44 -07:00
Vishnu Ks
19ee518f2e docs: Make get-message-history use curl example system. 2019-10-15 15:40:44 -07:00
Vishnu Ks
ed2e89f167 docs: Make delete-message use curl example system. 2019-10-15 15:40:44 -07:00
Vishnu Ks
0dccebbe39 docs: Make update-message use curl example system. 2019-10-15 15:40:44 -07:00
Vishnu KS
9bc3594f75 docs: Make get-raw-message use curl example system. 2019-10-15 15:40:44 -07:00
Vishnu Ks
cb64fc8732 bugdown: Show example value for path params in curl example. 2019-10-15 15:40:44 -07:00
Vishnu Ks
a03765bbe2 bugdown: Extract out function for getting openapi example value. 2019-10-15 15:40:44 -07:00
Tim Abbott
fa26475fcf docs: Deal with a few broken links. 2019-10-15 14:03:53 -07:00
Tim Abbott
0ce508693f docs: Fix broken link to stable releases.
Apparently, our ReadTheDocs configuration is now requiring the
trailing / here; it should have been present before anyway.
2019-10-15 14:03:53 -07:00
Anders Kaseorg
cadfda38f3 editorconfig: Set JS max_line_length = 100, to match eslintrc.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-14 17:32:38 -07:00
Tim Abbott
bbc1484253 check-rabbitmq-queue: Adjust threshholds for paging.
Ultimately, this isn't an effective way to monitor this queue; we want
time-based monitoring, not count-based monitoring.  Doing that
properly will likely involve modifying the queue processor to write
something about its status.

But until we add the monitoring we want, it makes sense to leave this
active with low limits.
2019-10-13 22:39:52 -07:00
Rafid Aslam
718b70ec8b Rename not_subscribed key to not_removed in users/me/subscriptions.
Rename `not_subscibed_key` to `not_removed` in
`users/me/subscriptions` DELETE response.

Fixes #13277.
2019-10-13 10:30:34 +07:00
Anders Kaseorg
dfd9ace7fa requirements: Add back future.
It happens that commonmark, python-jose, and python-twitter don’t
actually use future on Python 3, and moto uses aws-xray-sdk in such a
way that it doesn’t use future, but this was a weird game to be
playing just to remove one dependency, and it caused CI failures after
new releases of future, so let’s just include it.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-11 14:04:35 -07:00
Mateusz Mandera
a94b04dede test_mattermost_importer: Fix leftover references to message.pub_date.
The field is now called date_sent.
2019-10-11 04:07:12 +02:00
Tim Abbott
d2970a56c2 lint: Remove some unused imports.
These were introduced in ae5bc92602.
2019-10-10 18:06:30 -07:00
Vishnu KS
1585ad7bf4 mattermost: Add support for exporting DMs and huddles. 2019-10-10 16:37:03 -07:00
Vishnu KS
ae5bc92602 queue: Don't create confirmation objects twice during invite.
A confirmation object is already created when
do_send_confirmation_email is called just above.

Tweaked by tabbott to remove an unnecessary somewhat hacky database
query.
2019-10-10 16:19:42 -07:00
Mateusz Mandera
4dc3ed36c3 auth: Add initial SAML authentication support.
There are a few outstanding issues that we expect to resolve beforce
including this in a release, but this is good checkpoint to merge.

This PR is a collaboration with Tim Abbott.

Fixes #716.
2019-10-10 15:44:34 -07:00
Mateusz Mandera
82f923c27a social auth: Validate email in backends without get_verified_emails.
If the social backend doesn't have get_verified_emails emails, and we
simply grab kwargs["details"].get("email") for the email, we should
still validate it is correct.
Needed for SAML. This will get covered by tests in upcoming commits that
add SAML support.
2019-10-10 14:53:29 -07:00
Mateusz Mandera
7171a0a842 social_auth: Construct fullname from first and last name if needed.
Needed for SAML. This will get covered by tests in upcoming commits that
add SAML support.
2019-10-10 14:53:29 -07:00
Tim Abbott
c0beea1b1a requirements: Update future library comments.
There's probably a better solution, but this fixes CI.
2019-10-10 14:52:58 -07:00
Tim Abbott
1767044c90 docs: Extend moderation guidelines with search advice.
The search query for all messages sent by a given user in all public
streams is pretty useful for moderation of spam purposes.
2019-10-10 14:47:53 -07:00
Tim Abbott
7d0c9eadde search: Fix conditions under which search warning appears.
The warning is irrelevant for starred messages, since the user has
UserMessage rows for any starred messages.
2019-10-10 14:42:05 -07:00
Rohitt Vashishtha
b69213808a messages: Render topic links in context of stream realm.
Priviously, we rendered the topic links using the msg.sender.realm.
This resulted in issues with Zulip's internal bots not having access
to the realm_filters of the destination stream's realm. For example,
sending a message via the email gateway or notification would not
linkify any realm filters that a user would expect them to.
2019-10-10 14:33:35 -07:00
David Rosa
ae9caed46f docs: Treat sphinx-build warnings as errors.
"This means that the build stops at the first warning
and sphinx-build exits with exit status 1."
https://www.sphinx-doc.org/en/master/man/sphinx-build.html#id6

Follow-up to issue #13263.
2019-10-10 14:22:38 -07:00
Tim Abbott
dade0ad6d5 search: Improve explanation of all public streams search. 2019-10-09 15:16:56 -07:00
Vinit Singh
01b19291e7 search: Advertise the ability to search shared history.
When a user performs a search that might contain historical public
streams messages that the user has access to (but doesn't because
we're searching the user's own personal history), we add a notice
above the first search result to let the user know that not all
messages may have been searched.

Fixes #12036.
2019-10-09 15:12:52 -07:00
Tim Abbott
d6c9de6036 filter: Extract filter.contains_only_private_messages.
This will be a useful reusable function for determining whether to
display other alerts as well.
2019-10-09 14:47:38 -07:00
Tim Abbott
f8928182cf run-dev: Set HTTP header to show we're proxing from port 9991.
Previously, while Django code that relied on EXTERNAL_HOST and other
settings would know the Zulip server is actually on port 9991, the
upcoming Django SAML code in python-social-auth would end up detecting
a port of 9992 (the one the Django server is actually listening on).
We fix this using X-Forwarded-Port.
2019-10-08 17:53:09 -07:00
Anders Kaseorg
f25968f0ff exceptions: Fix AbstractEnum typing.
This will be needed for mypy 0.730.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-08 17:49:28 -07:00
Anders Kaseorg
f1832f3e0e requirements: Pin mypy to 0.720.
We’ll need to debug some new errors from 0.730 before upgrading (#13269).

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-08 17:49:28 -07:00
Rishi Gupta
360cd7f147 remote data: Send RealmAuditLog data. 2019-10-08 17:27:29 -07:00
Rishi Gupta
b86142089b billing: Sync realm activation events for on-prem billing. 2019-10-08 17:18:30 -07:00
Rishi Gupta
01bf99ec65 billing: Keep track of role count changes in RealmAuditLog. 2019-10-08 17:18:30 -07:00
Ray Kraesig
1180299fe4 provisioning: fix up bash profile creation
The base Ubuntu image includes no `.bash_profile`. Creating one will
prevent the existing support scripts in `~/.profile` from loading.

Instead, append our setup code to [whichever script Bash will load
first][bash-startup].

[bash-startup]: https://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html#Bash-Startup-Files
2019-10-08 17:17:55 -07:00
Anders Kaseorg
13296d282d requirements: Upgrade apns2.
My PR https://github.com/Pr0Ger/PyAPNs2/pull/90 fixing Python 3.5.2
support was merged.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-08 17:15:39 -07:00
Anders Kaseorg
cc791afc54 requirements: Upgrade django-sendfile2.
django-sendfile2 now always sends a Content-Disposition header even if
it’s inline.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-08 17:15:00 -07:00
David Rosa
3d9e6f0cda docs: add docs/README.md to the exclude_patterns list
This commmit removes "WARNING: document isn't included in any toctree"
from build output.

Addresses part of #13263.
2019-10-08 13:40:25 -07:00
Tim Abbott
5ffbb33a92 left sidebar: Fix centering of streams chevrons.
These appeared to be a few pixels above center in a way that looked
slightly off.
2019-10-07 13:52:48 -07:00
Ryan Rehman
8d0800210e left sidebar: Fix gaps between hover areas.
A somewhat recent refactoring of the left sidebar had introduced a gap
between the hover areas that looked off; this fixes this with a slight
rearrangement with where the 1px of space between elements lives.

Fixes #12508.
2019-10-07 13:52:03 -07:00
Tim Abbott
746e5b4c24 docs: Merge two-factor-auth.md into auth.md.
It's brief and really doesn't deserve its own article.
2019-10-07 12:12:07 -07:00
David Rosa
bdbc384de5 docs: Reduce the number of apparently broken links on github.
- Updated 260+ links from ".html" to ".md" to reduce the number of issues
reported about hyperlinks not working when viewing docs on Github.
- Removed temporary workaround that suppressed all warnings reported
by sphinx build for every link ending in ".html".

Details:
The recent upgrade to recommonmark==0.5.0 supports auto-converting
".md" links to ".html" so that the resulting HTML output is correct.

Notice that links pointing to a heading i.e. "../filename.html#heading",
were not updated because recommonmark does not auto-convert them.
These links do not generate build warnings and do not cause any issues.
However, there are about ~100 such links that might still get misreported
as broken links.  This will be a follow-up issue.

Background:
docs: pip upgrade recommonmark and CommonMark #13013
docs: Allow .md links between doc pages #11719

Fixes #11087.
2019-10-07 12:08:27 -07:00
YashRE42
5329d24849 settings page: Align permission "Discard" option.
In 50545a3 we made an incomplete revert of some style changes from
7b8da9b, this commit reverts the "x" to "fa fa-times" and also fixes an
alignment issue for the "Discard" box in chrome.
Fixes #13233.
2019-10-07 11:58:24 -07:00
Vishnu KS
cd06e0ab79 tests: Remove /messages/{message_id} from buggy endpoints. 2019-10-07 11:45:11 -07:00
Vishnu KS
bfc9089124 tests: Remove /users/me/subscriptions/muted_topics from buggy endpoints.
Even though required attribute of stream and stream_id params is marked
false in openapi specification, the API expects atleast one of the
params to be set. There is no way to specify relationships like this
openapi and they dont seem to have any plan to implement this in future.

https://github.com/OAI/OpenAPI-Specification/issues/256
2019-10-07 11:42:52 -07:00
Vishnu KS
e7419f815a tests: Remove /settings/notifications from buggy endpoints. 2019-10-07 11:42:52 -07:00
Vishnu KS
21ab8c542a bugdown: Cast enum elements to string in APIArgumentsTablePreprocessor.
So that enums other than of type string gets rendered without any error.
2019-10-07 11:42:52 -07:00
Dinesh
ef876ff4c7 right-sidebar: Fix keyboard shortcuts icon in medium widths.
This fixes a glitch where the keyboard shortcuts icon, which is meant
to be a feature of the right sidebar, appears overlapping the "Reply"
button.

Fixes #13122.
2019-10-06 20:43:40 -07:00
overide
dd67b1b3bb topic: Change before bound limit from 2 to 7 days.
This limit was introduced in c588c79 as a part of the
feature and not due to performance crisis. So we are
increasing this limit to 7 days. Since topics tends to
naturally fizzle after day or two so 7 days limit
would be good enough.
2019-10-06 20:12:59 -07:00
Rishi Gupta
48dc1d1128 remote data: Refactor remote_server_post_analytics to be more generic.
One small change in behavior is that this creates an array with all the
row_objects at once, rather than creating them 1000 at a time.

That should be fine, given that the client batches these in units of
10000 anyway, and so we're just creating 10K rows of a relatively
small data structure in Python code here.
2019-10-06 16:55:41 -07:00
Rishi Gupta
e10361a832 models: Replace is_guest and is_realm_admin with UserProfile.role.
This new data model will be more extensible for future work on
features like a primary administrator.
2019-10-06 16:24:37 -07:00
Rishi Gupta
4256ee61cf billing: Change RealmAuditLog.event_type from str to int.
This is a more robust long-term model for storing these data.
2019-10-06 15:55:56 -07:00
Anders Kaseorg
775162d687 setup_venv: Use pip install --require-hashes for better security.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-06 15:21:18 -07:00
Anders Kaseorg
3d876aacc6 requirements: Use pip-compile --generated-hashes for better security.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-06 15:21:18 -07:00
Anders Kaseorg
9f09d4fcfd update-locked-requirements: Print some progress information.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-06 15:21:18 -07:00
Anders Kaseorg
20c7ada7c5 requirements: Use archive zip files from GitHub.
This avoids expensive `git clone` operations during provisioning and
installation, and will also allow us to use `pip-compile
--generate-hashes` for better security.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-06 15:21:18 -07:00
Anders Kaseorg
9182293d50 node_cache: Preserve symlinks when copying an old node_modules tree.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-06 15:19:53 -07:00
YashRE42
f92e9e8693 docs: Add example of auth for proxy.
With some tweaks by tabbott to make the examples more generic.
2019-10-06 11:42:22 -07:00
Shikhar Varshney
fe5d975b33 settings: Add support for overriding APNS_TOPIC and ZULIP_IOS_APP_ID.
Documentation added by tabbott.
2019-10-05 22:53:59 -07:00
Mateusz Mandera
dbe508bb91 models: Migration of Message.pub_date to date_sent, part 2.
Fixes #1727.

With the server down, apply migrations 0245 and 0246. 0246 will remove
the pub_date column, so it's essential that the previous migrations
ran correctly to copy data before running this.
2019-10-05 19:01:34 -07:00
Mateusz Mandera
f198475281 models: Migration of Message.pub_date to date_sent, part 1.
1. Apply migration 0243 to add date_sent column.
2. Apply migration 0244 to copy pub_date over to date_sent. Can be done
with the server running.
3. With the server down (for consistency between memory and
database state of Django objects), verify consistency with
Message.objects.exclude(date_sent=F("pub_date")).count() == 0
2019-10-05 19:01:34 -07:00
Anders Kaseorg
8432d97edf setup_venv: Add pkg-config to VENV_DEPENDENCIES.
This is needed on at least Debian 10, otherwise xmlsec fails to
install: `Could not find xmlsec1 config. Are libxmlsec1-dev and
pkg-config installed?`

Also remove libxmlsec1-openssl, which libxmlsec1-dev already depends.

(No changes are needed on RHEL, where libxml2-devel and xmlsec1-devel
already declare a requirement on /usr/bin/pkg-config.)

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-05 18:24:32 -07:00
Vishnu Ks
30ad650afb bugdown: Don't show path params as data in curl example.
With test added by tabbott.
2019-10-05 18:17:36 -07:00
Vishnu Ks
bfd5f4066a bugdown: Remove unecessary call to get_openapi_parameters. 2019-10-05 18:10:55 -07:00
Vishnu Ks
dff62a240b bugdown: Rename openapi_example_params to openapi_params in generate_curl_example. 2019-10-05 18:10:55 -07:00
Vishnu Ks
f4e3e6068f bugdown: Rename pocket to param in generate_curl_example. 2019-10-05 18:10:55 -07:00
Anders Kaseorg
1235dc3bec install-node: Upgrade to Node 12.11.1, Yarn 1.19.0.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-05 18:07:53 -07:00
Anders Kaseorg
caf217d434 typing: Do time math with numbers, not Date objects.
When typing_status adds 10000 to this value, it would previously
obtain wacky strings like

    "Fri Oct 04 2019 16:45:59 GMT-0700 (Pacific Daylight Time)10000"

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-05 18:07:25 -07:00
Tim Abbott
0dc079def0 i18n: Update translation data from Transifex. 2019-10-05 18:06:39 -07:00
Tim Abbott
26abc50219 docs: Replace obsolete chat meetings text with search advice. 2019-10-05 17:57:07 -07:00
Mateusz Mandera
46d3dc243b requirements: Use our fork of django-auth-ldap. 2019-10-05 17:28:59 -07:00
David Rosa
9545569dca docs: Upgrade recommonmark to 0.6.0, fixing issues.
- recommonmark: 0.5.0 -> 0.6.0
- Fixed build TypeError: sequence item 1: expected str instance, NoneType found
  caused by recommonmark/parser.py erroring on a newline character.
- Removed deprecated code in conf.py that was causing warning messages
- Updated conf.py according to instructions for Sphinx-1.4 or newer
https://github.com/readthedocs/recommonmark/blob/master/README.md#getting-started
https://www.sphinx-doc.org/en/master/usage/markdown.html

This commit is also relevant to PR #13232.
2019-10-02 12:29:24 -07:00
Mateusz Mandera
94d5ca838f social auth tests: Extract prepare_login_url_and_headers method.
It will be reused in SAML tests in upcoming commits.
2019-10-01 16:39:12 -07:00
Mateusz Mandera
0e5f964363 social auth tests: Consistently refer to hamlet's name via self.name. 2019-10-01 16:38:50 -07:00
Anders Kaseorg
0af22dad18 flush-memcached: Respect MEMCACHED_LOCATION; handle errors.
Fixes #13238.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-01 16:05:55 -07:00
Tim Abbott
23c48764b5 README: Improve links to coverage/CI to point to master.
Apparently, the CircleCI and Codecov links (and the Codecov badge)
weren't pointing specifically at master, so they'd sometimes show
state from the lastest push to a pull request, which isn't a
reasonable way to advertise whether the project's build is passing.
2019-10-01 15:31:55 -07:00
Tim Abbott
c869a3bf82 upload: Fix browser caching of uploads with local uploads backend.
Apparently, our change in b8a1050fc4 to
stop caching responses on API endpoints accidentally ended up
affecting uploaded files as well.

Fix this by explicitly setting a Cache-Control header in our Sendfile
responses, as well as changing our outer API caching code to only set
the never cache headers if the view function didn't explicitly specify
them itself.

This is not directly related to #13088, as that is a similar issue
with the S3 backend.

Thanks to Gert Burger for the report.
2019-10-01 15:15:17 -07:00
Ivan Mitev
16c9d63056 emoji: Fix sort order of emoji choices.
The previous code for ensuring the sort order of emoji choices was
correct relied on an OrderedDict structure, which isn't guaranteed to
be preserved when passed to the frontend via JSON (in fact, it isn't,
since we converted the way page_params is passed to use
sort_keys=True).  Switch it to a list of dictionaries to correct this.

Fixes #13220.
2019-10-01 13:54:55 -07:00
Mateusz Mandera
4166c901ef do_update_user_custom_profile_data: Rename to ..._if_changed.
This adds clarity to the fact that the function no longer does
anything if the field values haven't changed.
2019-10-01 13:52:43 -07:00
Mateusz Mandera
d66cbd2832 do_update_user_custom_profile_data: Don't notify if value not changed. 2019-10-01 13:50:14 -07:00
YashRE42
7d46da0fce acount_settings: Fix position of avatar source.
The avatar source was misspositioned when avatar changes were disabled.
This also repositions the "X" for when avatar changes are allowed.
Fixes #12524.
2019-09-30 11:10:56 -07:00
YashRE42
10fd5db190 account-settings: Lighten user avatar source. 2019-09-30 11:10:56 -07:00
YashRE42
248fbadfb6 account_settings: Refactor avatar settings hbs.
This refactor removes some slightly complex conditional logic for
displaying avatar controls from the handlebar template to js.
2019-09-30 11:10:56 -07:00
ab1nash
71f0fecda7 scripts: Clean up output from 'clean_unused_caches'.
The output log from running clean_unused_caches was too verbose as
part of the `upgrade-zulip` overall output.  While this output is
potentially helpful when running it directly for debugging, it's
certainly redundant for the main production use case.

So a new flag --no-print-headers is introduced.  It suppresses the
header outputs for the subtools.

Fixes #13214.
2019-09-30 10:51:00 -07:00
Mateusz Mandera
c42077c12f dependencies: Add dependencies needed for SAML. 2019-09-28 12:15:13 -07:00
Tim Abbott
2b227d6b63 models: Add comments documenting our name field decisions. 2019-09-27 18:01:56 -07:00
Tim Abbott
9326aa9f57 message_edit: Fix Ctrl+Enter with topic edit dropdown selected.
Previously, we were ignoring that dropdown when considering whether
the currently selected element was part of the message edit form.

Fixes #11834.
2019-09-27 17:41:23 -07:00
bartek
df8d3dc334 message_edit: Set focus to topic_edit when TOPIC_ONLY.
The historical behavior of having `Enter` exit was optimized for the
"View source" use case; but `Esc` now handles that reasoanbly, and we
really should make it convenient to type in the user-editable text
box here.

Fixes part 1 of #11834.
2019-09-27 16:58:36 -07:00
Tim Abbott
1d93d99b57 Update translation data from Transifex. 2019-09-27 13:13:54 -07:00
Tim Abbott
bf088519a7 api: Add avatar URL to the GET /profile endpoint.
This endpoint is legacy in a lot of ways, but it seems reasonable that
it should have these data.
2019-09-27 12:07:03 -07:00
Rohitt Vashishtha
c298163a67 typeahead: Prioritize language names subset of another for sorting.
This ensures that typing '```java' and pressing enter would result in
getting dropped into a java codeblock instead of javascript codeblock.

We implement this by pushing the exact match of a query to be pushed to
the top of the returned matches in `sort_languages`.

With some comments added by tabbott in the tests explaining the
current reasoning.

Fixes #13109.
2019-09-26 13:00:21 -07:00
Tim Abbott
2756706149 hotkey: Fix escape key when editing topic.
Apparently, the changes in fe2adeeee1 to
fix a Firefox focus bug accidentally had the side effect of removing
the topic text box from the area being considered, resulting in the
escape key no longer working to end the message edit from within that
text box.
2019-09-26 12:56:02 -07:00
Vishnu Ks
1c81538570 mattermost: Read fixures inside test cases instead of setUp. 2019-09-25 20:07:00 +05:30
Vishnu KS
a21856c569 mattermost: Rename user_id to sender_user_id in process_raw_message_batch. 2019-09-25 20:06:47 +05:30
Vishnu KS
23d70bb685 mattermost: Rename get_recipient_id to get_recipient_id_from_receiver_name. 2019-09-25 20:06:04 +05:30
Vishnu KS
a743991935 mattermost: Fix mirror dummy fixture data.
The channel where Snape sends message should be gryffindor-quidditch-team
and not slytherin-quidditch-team since he is mirror dummy in gryffindor.
2019-09-25 19:03:43 +05:30
Tim Abbott
7e0ea61b00 upload: Support S3-compatible S3 hosting providers.
Previously, we were hardcoding the domain s3.amazonaws.com.  Given
that we already have an interface for configuring the host in
/etc/zulip/boto.cfg (which in turn, automatically configures boto), we
just need to actually use the value configured in boto for what S3
hostname to use.

We don't have tests for this new use case, in part because they're
likely annoying to write with `moto` and there hasn't been a huge
amount of demand for it.  Since this doesn't regress existing S3
backend support, it seems worth merging.
2019-09-24 17:17:21 -07:00
Tim Abbott
b8b0ae362c uploads: Only initialize S3 connection once in __init__.
This should be a mild performance optimization for the S3
authentication backend, since we aren't initializing unnecessary
duplicate connections.
2019-09-24 17:15:44 -07:00
Hemanth V. Alluri
635b96dbc1 devtools: Order the fixtures dropdown menu alphabetically in the IDP.
This is a simple and small commit which will alphabetically order the
entries of the fixtures dropdown menu in the "integrations developer
panel" devtool.
2019-09-24 17:07:02 -07:00
Hemanth V. Alluri
98a33c0fda page_params: Fix list of config_options sent for incoming webhook bots.
This patches an issue in f37535044 where we mistakenly tried to send
the function as part of the page_params. Instead, we should just try
to send the list of configuration options (in their user displayable
form).
2019-09-24 16:04:51 -07:00
Laurel Michaels
a67769091d docs: Add OpenAPI data for /messages/{message_id}/reactions.
This change adds the OpenAPI data needed to document the POST and
DELETE methods associated with this endpoint.

Descriptions edited slightly by tabbott.
2019-09-24 15:57:51 -07:00
Anders Kaseorg
8d38f0593b run-dev: Disable Tornado response decompression.
Apparently Tornado decompresses gzip responses by default.  Worse, it
fails to adjust the Content-Length header when it does.

https://github.com/tornadoweb/tornado/issues/2743

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-24 15:51:06 -07:00
Tim Abbott
96726c00ce export: Fix broken URLs in UI with S3 backend.
Apparently, the Zulip notifications (and resulting emails) were
correct, but the download links inside the Zulip UI were incorrectly
not including S3 prefix on the URL, making them not work.

While we're at this, we rewrite the somewhat convoluted previous
system for formatting the data export output.
2019-09-24 13:56:49 -07:00
Tim Abbott
e8785762c6 export: Fix missing download attribute on export tarballs. 2019-09-24 13:22:02 -07:00
Tim Abbott
b11a773842 setings: Fix rendering of plain-text emoji option. 2019-09-24 13:11:01 -07:00
Tim Abbott
00fb7f37a0 i18n: Update translation data from Transifex. 2019-09-24 13:02:33 -07:00
Tim Abbott
a84bb89bdc scripts: Move mobile i18n code out scripts/.
Like other code that is only used in the development environment, this
doesn't belong in scripts/.
2019-09-24 12:57:42 -07:00
Tim Abbott
27b3c1a312 provision: Move install-shellcheck to proper directory.
Scripts in scripts/ should be exclusively code that used in
production, and this isn't.
2019-09-24 12:54:33 -07:00
Tim Abbott
4223254548 version: Update version and changelog for Zulip 2.0.6 release. 2019-09-23 16:22:41 -07:00
Anders Kaseorg
311aa21d9c styles: Add overflow: hidden on .message_content.
This has two purposes:

1. Prevent stupid stacks of diacritical marks from overflowing into
other messages.  Fixes #7843.

2. Prevent Chrome from collapsing the inside bottom margin with the
.messagebox outside (in a way that Firefox doesn’t).

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-23 16:09:58 -07:00
Anders Kaseorg
4fdc80a9c7 setup-apt-repo: Install groonga-keyring.
This allows the system to get updates to the Groonga repository
signing key, so `apt update` doesn’t start failing when the key
changes (like it recently did).

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-23 16:01:39 -07:00
Anders Kaseorg
d1e504079d setup-apt-repo: Don’t waste time installing debian-archive-keyring.
debian-archive-keyring is a dependency of the essential package apt,
so it is present in every Debian system.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-23 16:01:39 -07:00
Anders Kaseorg
2ff87bd888 setup: Update groonga APT repository signing key.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-23 16:01:39 -07:00
Joao Mauricio Carvalho
86d507db05 settings: Change username to bot email in bot settings HTML.
This is for consistency with how this value appears in other places in
the UI.

Fixes: #13162.
2019-09-23 15:55:25 -07:00
Tim Abbott
8024b1179a bots: Fix bot email addresses with EMAIL_ADDRESS_VISIBILITY_ADMINS.
When using our EMAIL_ADDRESS_VISIBILITY_ADMINS feature, we were
apparently creating bot users with different email and delivery_email
properties, due to effectively an oversight in how the code was
written (the initial migration handled bots correctly, but not bots
created after the transition).

Following the refactor in the last commit, the fix for this is just
adding the missing conditional, a test, and a database migration to
fix any incorrectly created bots leaked previously.
2019-09-23 15:53:53 -07:00
Tim Abbott
6e5c99328a models: Extract a helper function for whether emails are realm-public.
This is also a useful preparatory refactor for having a user setting
controlling whether one's own email address is publicly available
within the organization.
2019-09-23 15:53:53 -07:00
Anders Kaseorg
6bd977f9e4 requirements: Link to our GitHub issue for upgrading pika.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-23 14:30:18 -07:00
Anders Kaseorg
ba8a172897 requirements: Downgrade transifex-client so we can upgrade six, urllib3.
transifex-client 0.13.5 added overly strict version bounds on six and
urllib3.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-23 13:47:55 -07:00
Anders Kaseorg
f671ca3780 requirements: Upgrade Python requirements.
This commit was generated by deleting these lock files and rerunning
update-locked-requirements.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-23 13:23:58 -07:00
Anders Kaseorg
76492b25ae setup_venv: Install pip.txt requirements with --force-reinstall.
virtualenv on Ubuntu 16.04, when creating a new environment, downloads
the current version of setuptools, then replaces its pkg_resources
with an old copy from
/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl.
This causes problems, a simple example of which is reproducible from
the ubuntu:16.04 Docker base image as follows:

    apt-get update
    apt-get -y install python3-virtualenv
    python3 -m virtualenv -p python3 /ve
    /ve/bin/pip install sockjs-tornado
    /ve/bin/pip download sockjs-tornado

→ `AttributeError: '_NamespacePath' object has no attribute 'sort'`

More relevantly, it breaks pip-compile in the same way.  To fix this,
we need to force setuptools to be reinstalled, even if we’re asking
for the same version.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-23 13:23:58 -07:00
Anders Kaseorg
d368aaad10 requirements: Generate pip.txt from pip.in like the other *.txt files.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-23 13:23:58 -07:00
Anders Kaseorg
ec9bf6576a requirements: Remove unnecessary version bounds from *.in.
This makes no changes to the locked versions in *.txt, but it reduces
duplicate information and gives us sane workflows for

* upgrading packages: remove some or all lines from *.txt and re-run
  `update-locked-requirements`;
* marking packages as intentionally held back: add a version bound
  to *.in with an explanatory comment.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-23 13:23:58 -07:00
Anders Kaseorg
75e585b208 docs: Suggest systemctl unmask docker if Docker isn’t running.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-23 12:52:07 -07:00
Anders Kaseorg
9339402541 messages: Sort IDs in the by_streams query deterministically.
This fixes a test flake after upgrading SQLAlchemy.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-23 11:56:52 -07:00
Anders Kaseorg
cb0652071f zulip_otp_required: Avoid _user_is_authenticated compatibility shim.
This private shim is not needed with Django ≥ 1.10, and was removed
from django-otp 0.7.0.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-23 11:56:52 -07:00
Anders Kaseorg
2573ecb7d1 requirements: Bump thumbor Django to match main Django.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-23 11:56:36 -07:00
Anders Kaseorg
92b42573fb requirements: Compile thumbor requirements with pip-tools on Python 2.
The reason that `pip-tools` running on Python 3 didn’t detect the
right requirements for `thumbor` on Python 2 is simply that some of
them are conditional on the Python version.

As for the requirements that had been manually added as a workaround:
`backports-abc` and `singledispatch` are now correctly detected, while
`backports.ssl-match-hostname` was vendored into `urllib3` some time
ago and `certifi` is no longer necessary.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-23 11:56:36 -07:00
Tim Abbott
3c0f54e242 docs: Update documented string_id for zulipinternal realm.
See 9b2b24c617 for the update of the
string_id.
2019-09-23 11:51:10 -07:00
Tim Abbott
e4dee9532c nagios: Update configuration for user_activity worker change.
Since LoopQueueProcessingWorker jobs cannot be monitored by checking
for connected consumers (since they poll, rather than consuming as
events arrive), they can't be monitored with check_consumers.  It's
OK, because that monitoring was redundant with monitoring for
potential growth in their queue that we have as well.

Also clean up the block comments for the two other similar queue
procesors.
2019-09-23 11:49:46 -07:00
Rishi Gupta
3646936cfb integrations: Advertise our native Zapier integration. 2019-09-22 18:47:42 -07:00
Anders Kaseorg
8d91bebf95 restart-server: Warn if the shell’s PWD goes through an updated symlink.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-21 12:02:15 -07:00
Ray Kraesig
a4ababb9a4 vagrant docs: specify restart command
Add a specific command to restart Vagrant to adopt the new
configuration.

(When naïvely using only `vagrant halt` + `vagrant up --provision`,
external devices remained unable to connect; per `netstat -nltp`, the
host IP of forwarded ports remained `127.0.0.1`.)
2019-09-21 11:54:14 -07:00
Tim Abbott
767a1b9f0c user_activity: Skip an unnecessary database query for new entries.
While new entries are an overwhelming minority of calls to this
function, it's still worth having a clean implementation.
2019-09-21 11:49:43 -07:00
Tim Abbott
1c73ce2450 user_activity: Use LoopQueueProcessingWorker strategy.
This should dramatically improve the queue processor's performance in
cases where there's a very high volume of requests on a given endpoint
by a given user, as described in the new docstring.

Until we test this more broadly in production, we won't know if this
is a full solution to the problem, but I think it's likely.  We've
never seen the UserActivityInterval worker end up backlogged without a
total queue processor outage, and it should have a similar workload.

Fixes #13180.
2019-09-21 11:48:24 -07:00
Tim Abbott
52a2b2c6a8 tests: Move user_activity test next to slow_query test.
This will conveniently put all the LoopQueueProcessingWorkers
together.
2019-09-21 11:47:14 -07:00
Tim Abbott
f0d8951035 do_update_user_activity: Refactor to support passing a count.
We'll use this in upcoming commits.
2019-09-21 11:47:14 -07:00
Tim Abbott
5c960b3e0f user_activity: Make the queue processor a bit more efficient.
We don't actually need to go to the memcached (falling back to the
database) to fetch either user or client objects on every event.  For
user objects, we actually can just pass through the user ID
transparently; for client objects, we can use an in-process cache,
since the mapping of string to ID never changes.
2019-09-21 11:47:14 -07:00
Mateusz Mandera
3271235200 email_mirror: Ignore missed message email if the user isn't active. 2019-09-20 17:58:10 -07:00
Mateusz Mandera
21459ed193 test_email_mirror: Test missed message emails in a single ZulipTestCase.
With the way these tests are, it's unnecessary to have 3 separate
classes, and it makes it confusing to decide where to add a potential
additional mm email test.
2019-09-20 17:58:10 -07:00
Mateusz Mandera
371a7768ad backends: Extract useful is_user_active function.
This logic can be useful elsewhere, for checking whether user_profile is
active.
2019-09-20 17:58:10 -07:00
Tim Abbott
c19b7ec89d test_events: Remove unnecessary check_none validator.
This can be done cleanly using the existing equals(None).
2019-09-20 11:51:50 -07:00
Anders Kaseorg
6b09e690f1 page_params: Throw an error if params are missing.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-20 10:34:44 -07:00
Anders Kaseorg
dea6889956 templates: Make the Loading… message more robust.
Don’t hide it until both CSS and JS have loaded.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-20 10:34:44 -07:00
Anders Kaseorg
46e562f990 bootstrap: Change tooltip html default to false.
Bootstrap v2.2.0^2~40^2~6 changes this default to false, so this is a
prerequisite to upgrading Bootstrap, and it’s also safer.

This closes an HTML injection path via user full names in the emoji
reaction tooltip.  It doesn’t appear to be exploitable for cross-site
scripting because we disallow `>` in full names, and the code happens
to be written such that the next `>` is in a different parser
invocation.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-19 20:53:10 -07:00
Anders Kaseorg
cf5a00d94b bulk_get_subscriber_user_ids: Sort each user list by ID.
This simple backwards-compatible change saves approximately 12% in the
compressed size of the chat.zulip.org page_params.  We can do much,
much better by changing the format, but this seems like a good
intermediate step.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-19 20:17:43 -07:00
Anders Kaseorg
2e1494bdbd setup-apt-repo: Add ca-certificates to pre_setup_deps.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-19 20:15:43 -07:00
Rishi Gupta
74d5d3db26 integration docs: Remove angle brackets from trello bash command.
If you accidentally leave them in, you'll get a confusing error message.
2019-09-19 17:48:16 -07:00
Tim Abbott
a352f2e10d test_counts: Remove custom user creation code.
Like the last commit, this avoids us needing to update this random
test class in the analytics subsystem when we adjust the UserProfile
model.
2019-09-19 14:31:58 -07:00
Tim Abbott
aae610f65c analytics: Fix creation of shylock user.
Previously, the shylock user was created using a bad duplicate of our
standard create_user code path; we fix this by just calling into that
code path.
2019-09-19 14:16:38 -07:00
Yago González
e1fbf6dddb actions: Make do_regenerate_api_key return the new key.
This way, the new API key can be fetched without needing to read it from
the UserProfile object.
2019-09-19 13:03:56 -07:00
Anders Kaseorg
fbc2de157e templates: Move page_params to a <div> at the bottom of <body>.
In a gigantic realm where we send several MB of `page_params`, it’s
slightly better to have the rest of the `<body>` available to the
browser earlier, so it can show the “Loading…” spinner and start
fetching subresources.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-19 12:38:10 -07:00
Mateusz Mandera
935702b6ec auth: Rename any_oauth_backend_enabled to any_social_backend_enabled.
any_oauth_backend_enabled is all about whether we will have extra
buttons on the login/register pages for logging in with some non-native
backends (like Github, Google etc.). And this isn't about specifically
oauth backends, but generally "social" backends - that may not rely
specifically rely on Oauth. This will have more concrete relevance when
SAML authentication is added - which will be a "social" backend,
requiring an additional button, but not Oauth-based.
2019-09-19 12:35:27 -07:00
Mateusz Mandera
050f814e47 auth: Clean up SOCIAL_AUTH_BACKENDS / OAUTH_BACKEND_NAMES lists.
SOCIAL_AUTH_BACKEND / OAUTH_BACKEND_NAMES are currently the same
backends. All Oauth backends are social, and all social are oauth.
So we get rid of OAUTH_BACKEND_NAMES and use only SOCIAL_AUTH_BACKENDS.
2019-09-19 12:35:27 -07:00
Rohitt Vashishtha
6a08efc065 typeahead: Precompile regexes for removing diacritics.
Precompiling regexes gives a performance increase of around 10-15%
based on tests. See https://jsperf.com/typeahead-regex. This stacks
up when we have a lot of users in an organisation.
2019-09-19 12:27:01 -07:00
Anders Kaseorg
b72bb8171b nginx: Add CORS, HSTS, and X-Frame-Options headers to error responses.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-19 12:10:18 -07:00
Anders Kaseorg
990f08da90 dependencies: Upgrade nearly all JavaScript dependencies to latest.
Keep katex at 0.10.x, mini-css-extract-plugin at 0.6.x
(https://github.com/webpack-contrib/mini-css-extract-plugin/issues/417),
and typescript-eslint at 1.x for now.  Upgrade everything else.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-19 12:08:52 -07:00
Anders Kaseorg
fc0554fcb8 emoji: Finish removing leftover code from banned Emoji sets.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-19 12:08:52 -07:00
clarammdantas
cf5d3a3ef3 left sidebar: Fix bot availability status in "private messages".
This changes the availability icon for bot users to user_circle_green;
previously it was accidentally defaulting to user_circle_empty, making
it appear that bots were never available.

Fixes #13149.
2019-09-18 17:40:25 -07:00
Tim Abbott
75d579847e docs: Update changelog through current master. 2019-09-18 17:36:31 -07:00
Tim Abbott
356e68e09e test-backend: Temporarily disable coverage requirement for mattermost.
The mattermost import tool has some temporary coverage regressions.
2019-09-18 12:11:58 -07:00
Vishnu Ks
c4af0b7bc4 mattermost: Support importing messages without team name.
Mattermost doesn't place private messages within a particular team,
which is what this is needed for.
2019-09-18 11:57:37 -07:00
Vishnu Ks
bf5f531e90 import_util: Support huddles in SubscriberHandler. 2019-09-18 11:53:13 -07:00
Tim Abbott
edee1251c8 message_list: Replace buggy rerender_the_whole_thing.
As it turns out, our rerender_the_whole_thing function (used whenever
we were adding messages and discovered that the resulting message list
would be out-of-order) was just broken and scrolled the browser to a
random location.

This caused two user-facing bugs:

* On very fast networks, if two users sent messages at very close to
  the same time, we could end up with out-of-order message deliveries,
  triggering this code path, which was intended to silently correct
  the situation, but failed.

* In some narrows to streams with muted topics in the history but some
  recent traffic, the user's browser-cached history might have some
  gaps that mean the server fetch we do after narrowing discovers the
  history is out-of-order, again triggering the
  rerender_the_whole_thing code path.

The fix is to just remove that function, adding a new option to the
well-tested rerender_preserving_scrolltop (which has explicit logic to
preserve the scroll position) instead.

Fixes #12067.  Likely also fixes #12498.
2019-09-18 11:43:21 -07:00
Tim Abbott
0815a9bd53 docs: Add a link to changelog from section on deploying master. 2019-09-18 11:18:12 -07:00
Rishi Gupta
2646d70cbd emails: Add realm name to footer of missed message emails.
Missed message emails for mentions come from streams and possibly orgs you
don't normally get missed message emails for, so they can be hard to place.
2019-09-17 17:45:59 -07:00
Anders Kaseorg
fe7d814e8d team: Move contributors_list into page_params.
This sidesteps tricky escaping issues, and will make it easier to
build a strict Content-Security-Policy.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-17 16:06:33 -07:00
Anders Kaseorg
7494f1600c templates: Move page_params from an inline script to the <body> dataset.
This sidesteps tricky escaping issues, and will make it easier to
build a strict Content-Security-Policy.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-17 16:06:33 -07:00
Anders Kaseorg
f1ecd3c18b templates: Defer all script execution.
This allows parsing and resource loading to continue in parallel with
script fetching.  It also means we don’t need to concern ourselves
with explicitly waiting for the DOM to become ready.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-17 16:06:33 -07:00
Anders Kaseorg
9b38bcc2a6 templates: Abstract render_bundle behind a Jinja2 macro.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-17 16:06:33 -07:00
Rohitt Vashishtha
1df5cdc41a typeahead: Align the tip text centered vertically. 2019-09-17 13:09:03 -07:00
Rohitt Vashishtha
3e3deb2f17 typeahead: Move tip text to bottom. 2019-09-17 13:09:03 -07:00
Tim Abbott
68f6f622a7 open source: Add a more complete "why zulip" explanation.
Also contains a lot of edits from Rishi, including to the content
around Zulip's features and what to highlight there.
2019-09-17 12:40:38 -07:00
Tim Abbott
5452c0b4ac open source: Document some recent and upcoming features. 2019-09-17 12:03:20 -07:00
Rishi Gupta
2ebbd9a917 portico: Fix line-height in hero image description. 2019-09-17 12:03:20 -07:00
Alexandra Ciobica
8828ef72fe portico: Add hover styling to Atlassian migration guide on /hello.
I changed the element to be  a `p` instead of `div` because the styling
for `a`s inside paragraphs is already there and the element should
anyway be a paragraph.

Fixes part of #12853.
2019-09-17 11:59:22 -07:00
Alexandra Ciobica
5b64a27597 portico: Add hover behavior for app icons on /hello. 2019-09-17 11:55:23 -07:00
Alexandra Ciobica
b94ea6553b portico: Fix gradient on /hello. 2019-09-17 11:55:23 -07:00
Alexandra Ciobica
9bb7249c42 portico: Add hover behaviour to Take the tour button on /hello. 2019-09-17 11:55:23 -07:00
Anders Kaseorg
366dce5d52 confirm_preregistrationuser: Uninline script.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-16 17:23:20 -07:00
Anders Kaseorg
ed63042480 templates: Replace focusing scripts with autofocus attribute.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-16 17:23:20 -07:00
Tim Abbott
6f6c761d80 docs: Further expand documentation on using IDs in narrows.
These docs had a number of typos, and also didn't fully clarify how to
handle lists of integers for `pm-with`.

Also makes some tweaks to the user docs to make this clearer as well.

Fixes #13167.
2019-09-16 17:17:03 -07:00
Tim Abbott
0a426c6a44 settings: Add detailed comments explaining our postgres configuration. 2019-09-16 16:32:57 -07:00
Chris Bobbe
04e6c3bd18 docs/version-control: Set commit message line limit to 70.
https://github.com/zulip/zulip-mobile/pull/3404#issuecomment-477411875

A discussion followed at

https://chat.zulip.org/#narrow/stream/3-backend/topic/commit.20line.20length

and that was agreed on for the commit message body, but noted that a
length of 76 was acceptable for the summary because of the
single-line constraint and the fact that it ends in a period, making
it clear where it ends.
2019-09-16 15:02:02 -07:00
Wyatt Hoodes
d2c3ddc765 test_events: Use stdout_suppressed in export test. 2019-09-13 11:54:14 -07:00
Wyatt Hoodes
e37c91d195 test_realm_export: Use stdout_suppressed in tests.
From a testing perspective, calling `export_realm_wrapper`
prints unnecessary data to stdout.
2019-09-13 11:54:14 -07:00
Wyatt Hoodes
e3595e4b3f test_slack_message_conversion: Use subTest for fixtures test. 2019-09-13 11:54:14 -07:00
Wyatt Hoodes
dbaf6ac7e7 test_push_notifications: Remove fixtures print statement. 2019-09-13 11:54:14 -07:00
Wyatt Hoodes
4a64a487d3 bugdown: Remove print statement from fixtures test. 2019-09-13 11:54:14 -07:00
Wyatt Hoodes
698b0f1b91 test_management_commands: Use subTest with help tests.
We remove the print statement, and instead use
subTest to improve debuggability.
2019-09-13 11:54:14 -07:00
Anders Kaseorg
2ec946ad4d postgres-init-db: Require an Enter press in confirmation prompt.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-12 16:04:55 -07:00
Anders Kaseorg
78b018989e export: Refuse to overwrite an existing directory or tarball.
Previously, incorrectly passing an existing directory to the
`manage.py export --output` option would remove its contents without
warning.  Abort instead.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-12 16:04:55 -07:00
Tim Abbott
fcf5936341 version: Update version and changelog for Zulip 2.0.5 release. 2019-09-11 16:36:19 -07:00
Anders Kaseorg
780ecb672b CVE-2019-16216: Fix MIME type validation.
* Whitelist a small number of image/ types to be served as
  non-attachments.
* Serve the file using the type that we validated rather than relying
  on an independent guess to match.

This issue can lead to a stored XSS security vulnerability for older
browsers that don't support Content-Security-Policy.

It primarily affects servers using Zulip's local file uploads backend
for servers running Ubuntu 16.04 Xenial or newer; the legacy local
file upload backend for (now EOL) Ubuntu 14.04 Trusty was not affected
and it has limited impact for the S3 upload backend (which uses an
unprivileged S3 bucket domain to serve files).

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-11 15:46:36 -07:00
Mateusz Mandera
a1fa0b011e docs: Fix typo in production/email.md. 2019-09-10 16:10:12 -07:00
Anders Kaseorg
6bab61a0d6 styles: Remove overrides for KaTeX line-height and white-space.
Commit ba66dfe977 incorrectly inflated
the specificity level of these rules by moving them inside
.rendered_markdown “entirely for readability”.  KaTeX has its own
rules that work better, so just delete ours.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-10 16:03:20 -07:00
Thomas Ashish Cherian
ea17673885 docs: Include su in email docs restart-server command.
It's likely the user was root as this point in the instructions.
2019-09-10 16:00:34 -07:00
Anders Kaseorg
17192ed46b Revert "provision: Give concrete NFS error message on older OSX versions."
This reverts commit 073ecaac66 (#9365).

This exception handler was overly broad in catching all `OSError`s,
and it made debugging harder by hiding the actual exception.
Furthermore, we no longer use NFS (#12963), and we’re now getting
reports of Windows users running into this message.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-09 14:47:51 -07:00
Thomas Ip
574c35c0b8 markdown: Render ordered lists using <ol> markup.
This brings us in line, and also allows us to style these more like
unordered lists, which is visually more appealing.

On the backend, we now use the default list blockprocessor + sane list
extension of python-markdown to get proper list markup; on the
frontend, we mostly return to upstream's code as they have followed
CommonMark on this issue.

Using <ol> here necessarily removes the behaviour of not renumbering
on lists written like 3, 4, 7; hopefully users will be OK with the
change.

Fixes #12822.
2019-09-08 16:42:20 -07:00
Wyatt Hoodes
4a176714e1 actions: Remove leftover print statement. 2019-09-08 15:36:30 -07:00
Tim Abbott
9c21fb75cf requirements: Upgrade twisted to 19.7.0. 2019-09-08 09:42:32 -07:00
Tim Abbott
7e75f987df ldap: Fix logging of warning for deactivated users.
Also cleans up the interface between the management command and the
LDAP backends code to not guess/recompute under what circumstances
what should be logged.

Co-authored-by: mateuszmandera <mateusz.mandera@protonmail.com>
2019-09-08 09:35:23 -07:00
Tim Abbott
d1a2784d52 ldap: Fix attempting to sync data for deactivated users.
The order of operations for our LDAP synchronization code wasn't
correct: We would run the code to sync avatars (etc.) even for
deactivated users.

Thanks to niels for the report.

Co-authored-by: mateuszmandera <mateusz.mandera@protonmail.com>
2019-09-08 09:35:23 -07:00
Anders Kaseorg
7af04690b9 requirements: Use PyPI fork of line_profiler supporting Python 3.7.
Also move it to dev.in.

Other notes for posterity: this should have been installed with a
pinned commit hash, and could have been installed directly from the
upstream Git repository, even on Python 3.7, as long as Cython was
installed as well.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-08 09:34:55 -07:00
Tim Abbott
94251a9341 docs: Add a full article on modifying Zulip.
We have lots of documentation for Zulip developers; but previously
didn't have a nice top-level page for Zulip server administrators to
learn how to manage patches to Zulip.
2019-09-06 13:52:56 -07:00
Rishi Gupta
81f06ab375 readme: Remove Travis badge.
Travis hasn't been our primary CI system for a long time, and flakes,
and the badges look duplicate with the CircleCI one, so we should just
remove it.

See discussion at
https://chat.zulip.org/#narrow/stream/101-design/topic/github.20badges.
2019-09-06 13:14:14 -07:00
Rishi Gupta
34dee2d953 readme: Advertise digital ocean droplet and docker install. 2019-09-06 13:14:01 -07:00
Mateusz Mandera
2ce2024bd7 ldap: Fix unintended user deactivation in case of connection failure.
Fixes #13130.

django_auth_ldap doesn't give any other way of detecting that LDAPError
happened other than catching the signal it emits - so we have to
register a receiver. In the receiver we just raise our own Exception
which will properly propagate without being silenced by
django_auth_ldap. This will stop execution before the user gets
deactivated.
2019-09-05 11:59:20 -07:00
Tim Abbott
7ca65b2bb5 css: Remove buggy stream settings media CSS for narrow windows.
This caused weird behavior in the relevant band of window widths, and
removing it works considerably better.

There's still bad behavior in handling situations where the stream
name is too long and thus this wraps, but we should address that
as a follow-up.
2019-09-05 11:57:27 -07:00
Tim Abbott
fd5f9be14f stream settings: Use fa-circle-o for link to /help/. 2019-09-05 11:48:32 -07:00
Tim Abbott
94c51676fe stream settings: Use <label> tags for section labels.
Previously, these were configured as divs.
2019-09-05 11:48:32 -07:00
Tim Abbott
8b5df88596 css: Make label CSS usable outside settings model.
We intend to use it in the "manage streams" modal as well.
2019-09-05 11:48:32 -07:00
Mateusz Mandera
bf7f4f3f1b stream settings: Replace email address hint popup with link to docs.
Fixes #13134 as the last commit in the series for this issue.
Solves the "The (?) should just be a target=_blank link to
/help/message-a-stream-by-email." part of the issue.
As a result, a bunch code managing the email hint popup can be deleted,
together with a node test for that.
2019-09-05 11:48:32 -07:00
Mateusz Mandera
dfd6771237 stream settings: Use the .show-sender version of email address.
As requested in #13134.
2019-09-05 11:48:32 -07:00
Mateusz Mandera
307d8d8758 test_email_mirror: Better document the various address formats. 2019-09-05 11:48:32 -07:00
Vishnu KS
30440cf466 mattermost: Fix test flake in test_convert_channel_data.
So the reason 38f8cf612c seems
to be flaking is because the value of harry id switches between
1 and 2 in Xenial while in Bionic it would be fixed at 2. The
reason behind this is that Bionic ships with Python3.6 which
preserves dict insert order while Python3.5 that ships with Xenial
dont preserve the order. In initialize_stream_membership_dicts
we iterate user_data_map dict and the order in which the iteration
happens affects the ID of the users.
2019-09-05 11:20:33 -07:00
Puneeth Chaganti
df134be235 webhooks/papertrail: Requests from Papertrail are not JSON requests.
Papertrail sends requests with the content type
`application/x-www-form-urlencoded`, with the payload parameter holding the
JSON body. This commit fixes the papertrail integration to use the payload
parameter in the request's POST data instead of trying to parse the
request's entire body as JSON.

Papertrail documentation here:
https://help.papertrailapp.com/kb/how-it-works/web-hooks#encoding
2019-09-04 13:16:17 -07:00
Rohitt Vashishtha
b3df3f2e22 docs/botserver: Document running custom bot modules.
This documents the feature added in
https://github.com/zulip/python-zulip-api/pull/523.
2019-09-03 13:28:01 -07:00
Wyatt Hoodes
fc2574fdfd test_mattermost_importer: Add test coverage.
This is a rebase from a recent revert. A test
was failing non-deterministically relating to
`convert_channel_data` and use of an incorrect
`realm_id`.
2019-09-03 12:36:41 -07:00
Mateusz Mandera
a7ec1a089c errors: Fix infinite recursion during memcached outages.
We have a very useful piece of code, _RateLimitFilter, which is
designed to avoid sending us a billion error emails in the event that
a Zulip production server is down in a way that throws the same
exception a lot. The code uses memcached to ensure we send each
traceback roughly once per Zulip server per 10 minutes (or if
memcached is unavailable, at most 1/process/10 minutes, since we use
memcached to coordinate between processes)

However, if memcached is down, there is a logging.error call internal
to the Django/memcached setup that happens inside the cache.set() call,
and those aren't caught by the `except Exception` block around it.

This ends up resulting in infinite recursion, eventually leading to
Fatal Python error: Cannot recover from stack overflow., since this
handler is configured to run for logging.error in addition to
logging.exception.

We fix this using a thread-local variable to detect whether we are
being called recursively.

This change should prevent some nasty failure modes we've had in the
past where memcached being down resulted in infinite recursion
(resulting in extra resources being consumed by our error
notifications code, and most importantly, the error notifications not
being sent).

Fixes #12595.
2019-09-03 11:44:39 -07:00
Anders Kaseorg
177eb2e02e webpack: Move CSS minification to optimization stage.
Otherwise Bootstrap doesn’t get minified, and also the minification
state is incorrectly reflected in the webpack cache.

The Terser plugin is used by default; we need to include it explicitly
to avoid removing it.

Switch from cssnano to clean-css because it’s noticeably faster.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-02 21:58:13 -07:00
Anders Kaseorg
ad116cac4c postcss: Add postcss-calc plugin.
As foreshadowed by commit d0634181b5
(#13115).

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-02 21:48:05 -07:00
Anders Kaseorg
2bdb115581 styles: Remove stray semicolon from input.user_status block.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-02 21:45:43 -07:00
Anders Kaseorg
9b0401b76d package.json: Use caret ranges for more deduplication opportunities.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-02 19:30:09 -07:00
Anders Kaseorg
e57ede9421 yarn.lock: Share duplicate packages with yarn-deduplicate.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-02 19:30:09 -07:00
Anders Kaseorg
e5ab9834c5 logos: Golf harder with svgo 1.3.0.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-02 19:30:09 -07:00
Tim Abbott
70c513a640 analytics: Fix logging for errors connecting to push bouncer.
There's no reason for this to be a category of error that emails the
server administrator, since there's a good chance that fixing it will
need to be done in the Zulip codebase, not administrator action.
2019-09-02 18:47:10 -07:00
Anders Kaseorg
d0634181b5 styles: Fix left sidebar indentation for PostCSS migration.
cssnano reduces this to a constant in a production build.  (We could
add postcss-calc if we wanted this reduced in development.)

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-30 15:06:29 -07:00
Mateusz Mandera
d70e1bcdb7 settings: Add FAKE_EMAIL_DOMAIN setting.
Fixes #9401.

This adds a FAKE_EMAIL_DOMAIN setting, which should be used if
EXTERNAL_HOST is not a valid domain, and something else is needed to
form bot and dummy user emails (if email visibility is turned off).
It defaults to EXTERNAL_HOST.

get_fake_email_domain() should be used to get this value. It validates
that it's correctly set - that it can be used to form valid emails.

If it's not set correctly, an exception is raised. This is the right
approach, because it's undesirable to have the server seemingly
peacefully operating with that setting misconfigured, as that could
mask some hidden sneaky bugs due to UserProfiles with invalid emails,
which would blow up the moment some code that does validate the emails
is called.
2019-08-30 14:59:00 -07:00
Anders Kaseorg
4de3bbeafa styles: Finish removing manual antialiasing configuration.
Followup from commit ddb965110f.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-30 14:51:52 -07:00
Anders Kaseorg
abbd8a7f45 styles: Remove most vendor-prefixed CSS attributes.
Many of them are now automatically generated by autoprefixer, while
others are unnecessary based on .browserslistrc, and some were just
wrong (the linear-gradient based checkerboard pattern in lightbox has
been broken in Firefox for a while).

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-30 14:51:52 -07:00
Tim Abbott
62c9ea7cf9 linkifiers: Fix problems with capture groups called "name".
Apparently, due to poor naming of the outer capture group we use to
separate the actual match from the surrounding whitespace (etc.) we
use to determine if the syntax is a possible linkifier start/end, if
you created a linkifier using "name" as the capture group, we'd try to
compile a pattern with two capture groups called "name", which would
500, preventing anyone from accessing the organization.
2019-08-30 09:36:14 -07:00
Anders Kaseorg
096ef1445f parse_os_release: Use /etc/os-release always; remove DISTRIB_FAMILY.
To replace DISTRIB_FAMILY, there’s now an os_families function using
the standard ID and ID_LIKE information in /etc/os-release.

Fixes #13070; fixes #13071.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-29 17:30:20 -07:00
Anders Kaseorg
875002108f setup_venv: Remove CentOS workaround for fixed pycurl bug.
We are installing pycurl 7.43.0.3 which includes the fix.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-29 16:38:38 -07:00
Anders Kaseorg
d312d04510 styles: Replace Sass with PostCSS.
It’s about as fast as node-sass (faster, according to their
benchmarks) and more flexible.  Autoprefixer is neat: we can now go
delete all our -moz-, -webkit-, etc. lines and have them autogenerated
as necessary based on .browserslistrc.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-29 16:35:51 -07:00
Anders Kaseorg
e0d122217b provision: Use pre-built pgroonga on Debian 10.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-29 16:35:29 -07:00
Tim Abbott
73c9450d8a docs: Expand documentation on using IDs in narrows. 2019-08-29 16:17:09 -07:00
Tim Abbott
8ef610f8c8 provision: Remove now-duplicate extra Ubuntu section. 2019-08-29 12:53:10 -07:00
Anders Kaseorg
db44d61aab setup-apt-repo: Remove PPA and packagecloud repository.
We no longer use tsearch_extras, and the camo patch is irrelevant on
systemd systems (Xenial and newer).  So we no longer need to
provide/install a PPA at all.

Closes #13027.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-29 12:53:04 -07:00
Anders Kaseorg
6701c4463c search: Remove now unnecessary tsearch_extra dependency.
Now that we're implemented tsearch_extras in pure postgres, we no
longer need a custom extension.  This should help us considerably, as
it means we no longer need to ship custom apt packages at all.

Fixes #467.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-29 12:49:26 -07:00
Anders Kaseorg
c3e395b7d8 search: Reimplement ts_locs_array in pure PostgreSQL.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-28 17:59:12 -07:00
Anders Kaseorg
d2d4800b1c test_narrow: Compile queries with the current SQLAlchemy dialect.
We’re about to start using PostgreSQL-specific syntax that can’t be
stringified without a specified dialect.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-28 17:58:01 -07:00
rht
07808e35be parse_lsb_release: Use /etc/os-release instead of /etc/lsb-release. 2019-08-28 17:53:27 -07:00
Tim Abbott
83a012eaeb lint: Improve over-aggressive pattern botserver->Botserver pattern.
This is still not a great pattern, but this is sufficient to avoid it
firing on URLs of the form zulipbotserver.example.com.
2019-08-28 16:18:16 -07:00
Anders Kaseorg
9e481e353a .yarnrc: Set ignore-scripts true.
Follow up to #13065, to keep manual yarn invocations consistent with
our automated ones.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-28 16:15:54 -07:00
Rohitt Vashishtha
6fe99171c3 docs/botserver: Add basic troubleshooting help.
It could be a non trivial task ensuring that the Zulip server can
access the Botserver. These steps examine some of those cases.
2019-08-28 16:08:34 -07:00
Rohitt Vashishtha
7f3ee1b6b1 docs: Fix typo: Heroko -> Heroku. 2019-08-28 15:59:03 -07:00
Rohitt Vashishtha
16227ed23a docs/botserver: Explain how the botserver works.
Understanding the basic model can help people troubleshoot any
errors easily.
2019-08-28 15:59:03 -07:00
Tim Abbott
c06d8129a3 custom profile fields: Add placeholder for custom URL.
This makes the feature useable for someone who hasn't used it before.
2019-08-28 15:43:35 -07:00
Yashashvi Dave
9e343f1a68 custom fields: Update create-field UI for default external account fields. 2019-08-28 15:39:20 -07:00
Yashashvi Dave
313003900a custom fields: Move field-type inputs first in create-field form.
As other data of field, such as field name, hint etc. are
relative to field type, this commit moves the field type
input to the first order in create field form in org settings.
2019-08-28 15:39:13 -07:00
Yashashvi Dave
e05429b6a9 custom fields: Add default external account custom fields. 2019-08-28 15:35:53 -07:00
Anders Kaseorg
e8ee71e9a2 restore-backup, test_docs: Import settings from django.conf.
A settings module isn’t supposed to be imported directly.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-28 15:33:16 -07:00
David Rosa
4afdfa6055 docs: Place warning at the top of every page in /latest/production.
- Added warning block to dev docs using _templates/layout.html
- Removed copy-pasted warning from install.md and requirements.md
- Removed unreleased tag in docs/conf.py that's no longer used

Useful ref: https://www.sphinx-doc.org/en/master/templating.html

Fixes #13056.
2019-08-28 15:31:47 -07:00
Wyatt Hoodes
e64b5a2b88 data export: Fix success banner not clearing.
There was a bug where the success banner stuck
around even after the export completed.  We now
nicely fade and remove the banner upon a successful
population of the export in the table.

Fixes: #13045
2019-08-28 15:23:39 -07:00
Wyatt Hoodes
2a020fa6cc data export: Fix sort feature regression.
02cfb47 removed a couple HTML tags that were
being used to sort the table.  We fix this,
but disable filtering exports by marking the
input type as `hidden`.  We use this approach as
it seems `list_render` doesn't like an
undefined `opts.filter.element`, which is
what happens if we simply remove the `filter`
key.
2019-08-28 15:23:39 -07:00
Vinit Singh
d09a80260b lint: Replace local variables named 'msgid' with 'message_id'.
Follow up of commit 2a1305d. Replace all local variables named 'msgid'
with 'message_id' in all JS and HTML files, and adds a linter rule for
it as well.

Resolves #12952.
2019-08-28 15:19:30 -07:00
Greg Price
c6fb8c048a docs: Add troubleshooting entry for TLS <1.2 servers.
This corresponds to a user report at zulip/zulip-mobile#3596 .
2019-08-27 16:25:37 -07:00
Mateusz Mandera
6bd34afa0d models: Migration of UserMessage.id to bigint, part 2.
This requires part 1 (which can take hours to run but generally
doesn't require downtime) to be completed first.

This portion of the migration will require the server to be completely
down for a brief period; for chat.zulip.org with 250M UserMessage
rows, it took about 60s to run; that time will vary depending on
hardware details like whether the server has an SSD, but fundamentally
shouldn't be long.

Our upgrade-zulip and upgrade-zulip-from-git tools can apply this
migration correctly; nothing special needs to be done.

Fixes #13040.
2019-08-26 21:25:19 -07:00
Mateusz Mandera
b008515d63 models: Migration of UserMessage.id to bigint, part 1.
As part of adding support for more than 2B UserMessage rows in a Zulip
server, we need to change UserMessage.id (a field we don't access but
is needed by Django) from an int to a bigint.  This commit is a series
of migrations which create a `bigint_id` column and populates it correctly.

This migration will take a long time to run; on chat.zulip.org (a
server with a lot of history), it took about 4 hours to complete.

How to migrate with minimal downtime:

1. Run `upgrade-zulip-from-git` through this commit.  It will install
migration 0238 and then more or less hang while applying migration
0239.  Once migration 0238 is completed, however, your server should
be able to be started back up safely while migration 0239 is running.

2. Run `/home/zulip/deployments/next/scripts/restart-server` in a
separate terminal to get Zulip running again.

3. When the `upgrade-zulip-from-git` command finishes, it will
automatically re-restart the Zulip server, leaving you in a consistent
state and ready to do part 2 of the migration.

A useful `manage.py shell` query for checking the state after this
commit is consistent is this:

    assert UserMessage.objects.exclude(bigint_id=F("id")).count() == 0

Part of #13040.
2019-08-26 21:14:15 -07:00
Tim Abbott
89aeefed76 urls: Tighten many unintentionally broad URL patterns.
Previously, several of our URL patterns accidentally did not end with
`$`, and thus ended up controlling just the stated URL, but actually a
much broader set of URLs starting with it.

I did an audit and fixed what I believe are all instances of this URL
pattern behavior.  In the process, I fixed a few tests that were
unintentionally relying on the behavior.

Fixes #13082.
2019-08-26 20:51:49 -07:00
Tim Abbott
e0f8228d6e auth: Add a test for the legacy /accounts/login/google/ mobile flow.
This is needed to return 100% URL coverage, and should also help
ensure we don't accidentally break the fix from
a43b231f90.
2019-08-26 20:51:49 -07:00
Tim Abbott
a43b231f90 urls: Add backwards-compatibility URL for mobile Google login.
In bf14a0af4, we refactored the Google authentication system to use
the same code as GitHub auth, but neglected to provide a
backwards-compatible URL available for use by older versions of the
mobile apps.

Fixes #13081.
2019-08-26 20:14:04 -07:00
Tim Abbott
c037ba49a0 i18n: Tag push notification subtitles for translation. 2019-08-26 15:02:04 -07:00
Tim Abbott
0ed0bb6828 messages: Add email/push notifications for wildcard mentions.
Historically, Zulip's implementation of wildcard mentions never
triggered either email or push notifications, instead being limited to
desktop notifications and the "mentions" counter.

We fix this just by plumbing the "wildcard_mentioned" flag through our
system.

Implements much of
https://github.com/zulip/zulip/issues/6040#issuecomment-510157264.
We're also now ready to seriously work on #3750.
2019-08-26 14:39:53 -07:00
Anders Kaseorg
43c8c720ef node_cache: Run yarn with --ignore-scripts.
As predicted in https://www.kb.cert.org/vuls/id/319816/, a malicious
worm is beginning to spread across the npm ecosystem through package
postinstall scripts.  Only instead of direct self-replicating code,
the replication vector is the temptation to monetize postinstall
scripts by polluting the console logs with paid advertisements.  The
effect will be the same unless we all put a stop to this while we
still can.

Apply the recommended VU#319816 workaround, which is to disable
lifecycle scripts when installing npm packages.  The only fallout is:

* node-sass can’t run because it uses compiled native code; we replace
  it with Dart Sass.
* phantomjs-prebuilt doesn’t download the binary at install time; we
  tell it to download it in run-casper.
* ttf2woff2 transparently falls back from native code to an Emscripten
  build.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-26 14:36:03 -07:00
Anders Kaseorg
37ece9b8e2 webpack: Replace node-sass with Dart Sass.
It doesn't require scripts to install, allowing us to migrate yarn to
the more secure --ignore-scripts option.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-26 14:35:26 -07:00
Anders Kaseorg
29abbdaa07 requirements: Upgrade pip-tools to 4.1.0 and pip to 19.2.3.
Closes #13068.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-26 14:33:18 -07:00
Vishnu KS
d434c0ee88 slack: Remove unnecessary comments.
Remove comments that tries to explain code that is already readable.
Also remove some todo comments that has been already taken care of.
2019-08-26 14:10:19 -07:00
Vishnu KS
99d34fd11d slack: Rename default_channels to slack_default_channels. 2019-08-26 14:10:19 -07:00
Vishnu KS
b919514f7f slack: Rename customprofilefield_id to custom_profile_field_id. 2019-08-26 14:10:19 -07:00
Vishnu KS
c31355f9c1 slack: Rename custom_field_id_count to custom_profile_field_value_id_count. 2019-08-26 14:10:19 -07:00
Vishnu KS
138c659c97 slack: Rename slack_custom_field_name_to_zulip_custom_field_id.
Rename custom_field_map to
slack_custom_field_name_to_zulip_custom_field_id.
2019-08-26 14:10:19 -07:00
Vishnu KS
9560736d86 slack: Rename slack_user_id_to_custom_profile_fields.
Renames slack_user_custom_field_map to
slack_user_id_to_custom_profile_fields for readability.
2019-08-26 14:10:19 -07:00
Vishnu KS
01a51c8f4e slack: Rename added_recipient to slack_recipient_name_to_zulip_recipient_id. 2019-08-26 14:10:19 -07:00
Vishnu KS
9d51a1b527 slack: Rename added_users to slack_user_id_to_zulip_user_id. 2019-08-26 14:10:19 -07:00
Vishnu KS
3650f19692 slack: Lookup dir_name key in dict instead of in dict_keys.
No reason to do the lookup in O(n) when we can do
it in average O(1) time complexity.
2019-08-26 14:10:19 -07:00
Vishnu Ks
1e5c49ad82 slack: Support importing shared channels. 2019-08-26 14:10:19 -07:00
Vishnu Ks
e09a29f4d3 slack: Refactor get_slack_api_data to accept multiple query params. 2019-08-26 14:10:19 -07:00
Anders Kaseorg
51b2af9e5c docs: Shorten stackoverflow link.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-26 14:09:30 -07:00
Tim Abbott
73258efb16 development: Accept ToS for create user buttons.
We added default ToS for the development environment a few months
back; as a side effect, we now need to accept ToS when going through
the development environment registration flow, including for our
one-click account creation buttons.
2019-08-26 13:55:55 -07:00
Tim Abbott
b8bfdebea1 onboarding: Mark the most recent 20 messages as unread.
After a new user joins an active organization, it isn't obvious what
to do next; this change causes there to be recent unread messages in
the stream sidebar for the user to click on to get a feel for what's
happening in the organization and experiment with Zulip.

Fixes #6512.
2019-08-26 13:51:52 -07:00
Greg Price
3c07c054b6 docs: Add troubleshooting entry for TLS issue on Android 7.0.
Learned this thanks to a user report and some debugging:
  https://chat.zulip.org/#narrow/stream/48-mobile/near/782174
2019-08-26 13:03:00 -07:00
Anders Kaseorg
f1b91e577e requirements: Include packages that pip-tools considers unsafe.
It’s unclear why pip-tools considers these packages unsafe, and
excluding them from being pinned has resulted in nondeterministic
output that makes our test suite unhappy.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-25 22:32:31 -07:00
Rohitt Vashishtha
8b443a25b8 markdown: Show link href if title is empty.
Fixes #6221.
2019-08-25 21:36:42 -07:00
Rohitt Vashishtha
abe2dab88c markdown: Upgrade to use InlineProcessor for links.
This commit wraps up the major work that we held back when upgrading
py-markdown 2.6.11 to 3.0.1. Since we were making our custom changes
to the link syntax, at the time we stuck to using the old method of
parsing links. This lays the groundwork for further changes to our
link and image link handling, and brings us on par with upstream.

Also, we now better document the ways in which our link handling is
different from upstream.
2019-08-25 21:36:42 -07:00
Kanishk Kakar
e4f0d3d79b notifications: Add 'none' to unread count options. 2019-08-25 21:29:10 -07:00
Yashashvi Dave
330d065a69 zerver/tests/test_custom_profile_data: Group tests cases. 2019-08-25 20:59:13 -07:00
Yashashvi Dave
ed5cb6c28b custom profile fields: Extract field validation function. 2019-08-25 20:59:08 -07:00
Yashashvi Dave
166d4ce630 custom fields: Change field alert notifications style in user settings. 2019-08-25 20:57:27 -07:00
Tim Abbott
5e19546c14 messages: Fix unread_msgs accounting of wildcard mentions.
Previously, the unread_msgs data structure accounting (used for both
the web and mobile apps to determine the "Unread mentions" count
displayed in the UI) did not include wildcard mentions at all.

We fix this by adding the logic required to include properly that
data, with tests.  As discussed in #6040, it makes sense to include
muted streams and topics for the purpose of this calculation.

Fixes part of #6040.
2019-08-25 20:32:12 -07:00
Tim Abbott
625eb53b08 actions: Fetch presence idle data for non-basic mentions.
Apparently, get_active_presence_idle_user_ids, which is carefully
optimized to only fetch data for users who might actually need
notification processing, was only considering PMs and direct mentions,
not wildcard mentions or alert words.

This caused some pretty weird failure modes when working on adding
support for broader mention notifications, because users who had one
of these types of notifications would be treated as never
presence-idle, which was just confusing.

This is part of adding support for notifications for wildcard mentions
and alert words; it's worth merging this as an early commit because
the consequence of not doing this are very difficult to debug.
2019-08-25 19:58:33 -07:00
Tim Abbott
4e65f1dd2b test_event_queue: Clean up testing setup.
Rather than continually resetting the contents of an existing event
queue, we allocate a new one for each subtest.

We also fix a rather confusing bundle of comments.
2019-08-25 19:37:08 -07:00
Tim Abbott
63841814ce requirements: Rerun update-locked-requirements.
Apparently, pip 19.2.3 was released yesterday, resulting in
test-locked-requirements failing after we merged the latest updates to
it.
2019-08-25 16:13:04 -07:00
Vaibhav
8f13b6eed1 css: Use SCSS nesting for #stream_message_recipient_stream. 2019-08-25 15:09:31 -07:00
Vaibhav
9566f4cf6a css: Reorder so #stream_message_recipient_stream is in same place. 2019-08-25 15:09:31 -07:00
Vaibhav
edb61eb35e css: Use SCSS nesting for textarea and .compose_table .recipient_box. 2019-08-25 15:09:31 -07:00
Vaibhav
c15c2d3b97 css: Use SCSS nesting for .dropdown-menu. 2019-08-25 15:09:31 -07:00
Vaibhav
9652e8affb css: Use SCSS nesting for .message-control-button. 2019-08-25 15:09:31 -07:00
Vaibhav
71efd80dac css: Reorder compose.scss so .drafts-link is with .compose_table. 2019-08-25 15:09:31 -07:00
Vaibhav
72e13478cb css: Nest #compose-send-button:focus inside #send_controls. 2019-08-25 15:09:31 -07:00
Vaibhav
ffa6e72086 css: Use SCSS nesting for #send_controls. 2019-08-25 15:09:31 -07:00
Vaibhav
417284f38a css: Remove unnecessary table.compose_table rule.
Since `.compose_table` is a div and not a table.
2019-08-25 15:09:31 -07:00
Vaibhav
52d97e2ca7 css: Use SCSS nesting for #send_message_form. 2019-08-25 15:09:31 -07:00
Vaibhav
ca4cdb2b29 css: Remove redundant border-radius rule.
It's over-written just below.
2019-08-25 15:09:31 -07:00
Vaibhav
a19c74bd5e css: Remove redundant rules for .message_header*.
Since these rules are overwritten we can remove them. For
message_header_colorblock we can remove `!important` from
box-shadow since it was present due to the removed rules.
2019-08-25 15:09:31 -07:00
Vaibhav
1e350cbd09 css: Nest .message_header_colorblock inside .compose_table. 2019-08-25 15:09:31 -07:00
Vaibhav
d18492c1c7 css: Use SCSS nesting for .compose_table. 2019-08-25 15:09:31 -07:00
Vaibhav
9dd5641d90 css: Use SCSS nesting for #compose-buttons media queries. 2019-08-25 15:08:47 -07:00
Vaibhav
8f6ad6bd11 css: Nest .drafts-link inside .new_message_button. 2019-08-25 15:08:47 -07:00
Vaibhav
870ca49f0d css: Nest .alert-draft inside .new_message_button. 2019-08-25 15:08:47 -07:00
Vaibhav
0b4f82df79 css: Nest .button.small inside .new_message_button. 2019-08-25 15:08:47 -07:00
Vaibhav
ac94e3c7b5 css: Use SCSS nesting for #compose_buttons. 2019-08-25 15:08:47 -07:00
Vaibhav
877d198363 css: Nest new_message_button inside #compose_buttons. 2019-08-25 15:08:47 -07:00
Vaibhav
60fe12bcfe css: Reorder compose.scss so #compose-controls are in same place. 2019-08-25 15:08:47 -07:00
Anders Kaseorg
a3b0af44bc run-mypy: Remove --quick option.
mypy no longer has a `--quick` option.  Its argument parser
autocompletes `--quick` to `--quickstart-file`, leading to a confusing
error message.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-25 15:04:12 -07:00
Anders Kaseorg
99904527f5 mypy: Remove daemon mode.
mypy in daemon mode takes some 400 MiB of memory, and cannot follow
imports of type-annotated third-party packages; meanwhile, non-daemon
mode is no longer nearly as slow as it once was.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-25 15:04:12 -07:00
Anders Kaseorg
9c49049c9e update-locked-requirements: Use pip-compile --no-header.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-25 15:03:20 -07:00
Anders Kaseorg
6822634d22 requirements: Remove editable flag from *.in.
Fixes #12374.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-25 15:03:20 -07:00
Anders Kaseorg
fb9e9b76a8 requirements: When removing future requirement, leave it commented.
futures is no longer there to be removed.  Be clear about why we’re
removing future (it was never a “pip-tools bug”), and leave evidence
behind to help indicate how long that will be needed.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-25 15:03:20 -07:00
Anders Kaseorg
bd7ef1be51 test-locked-requirements: Improve logged output.
Run pip-compile with --quiet so we don’t have to redirect its stderr;
then we can see any exceptions it might throw.  Print any resulting
diff in the right order and without extra newlines separating each
line.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-25 15:03:20 -07:00
Anders Kaseorg
a053a925b3 requirements: Upgrade pip-tools to 3.8.0; downgrade pip to 19.1.1.
These are not the latest versions, but pip-tools 3.9.0 or 4.0.0 fails
to resolve dependencies from Git URLs:

pip._internal.exceptions.DistributionNotFound: No matching distribution found for zulip==0.6.1_git (from -r requirements/common.in (line 135))

while pip 19.2 breaks pip-tools 3.8.0:

TypeError: __init__() got an unexpected keyword argument 'find_links'

Fixes #10802.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-25 15:03:20 -07:00
Tim Abbott
e6340c6e54 docs: Make production unreleased documentation notices more visible.
Previously, Google might take you to /latest rather than /stable, and
you might get information about the next release, not the current one.

Fixes #13056.
2019-08-23 16:33:46 -07:00
Tim Abbott
3999a2db4d api: Document using pip3 install for zulip_bots(erver).
We dropped Python 2 support for these a while ago.
2019-08-23 15:51:06 -07:00
Mateusz Mandera
16479fa606 populate_db: Extract internal realm creation into a function. 2019-08-23 12:57:24 -07:00
Mateusz Mandera
8e1a7cfb52 python_examples: Specify which user the hard-coded user ids refer to.
We add an ensure_users function and use it in tests which have
hard-coded user ids, to make it clear to which users the ids refer to
and have it verified.
This makes it easier to see what's happening
in these tests and to keep track of any renumberings of user ids due to
changes in how we populate the database.
2019-08-23 12:57:24 -07:00
Rishi Gupta
e058558a52 emails: Send invitation reminder email two days before expiry.
Hopefully this does a better job of spurring people to action, and also
suggests a self-service fix if they don't (i.e. contacting the person that
invited them).
2019-08-23 12:53:11 -07:00
Rishi Gupta
36e0043ed7 emails: Fix typo in invitation.source.html. 2019-08-23 12:53:11 -07:00
Rishi Gupta
2d260031ed emails: Use referrer.delivery_email in invitation emails. 2019-08-23 12:53:11 -07:00
Mohit Gupta
e5482adec0 search: Add streams:public to search entire history of public streams.
Add ability to search entire message history of all public streams at
once. It includes all subscibed, non subscribed public streams messages
and even historical public stream messages sent before user had joined
an organization or stream.

Fixes #8859.
2019-08-22 13:40:49 -07:00
Rishi Gupta
e1848e83bc integrations: Update instructions for AppFollow. 2019-08-22 13:17:06 -07:00
Rishi Gupta
df44f0276b help: Update search-for-messages with note about historical messages. 2019-08-22 13:17:06 -07:00
Rishi Gupta
02cfb47315 exports: Update wording on settings page, /help and /features. 2019-08-22 13:17:03 -07:00
Thomas Ip
cbbfb19692 settings: Remove header_map and lookup section names from DOM.
Fixes #13046.
2019-08-22 13:13:24 -07:00
Thomas Ip
3d7b9a1349 list_render: Fix broken reversing operation.
This commit fixes an issue where when you click on the sort button of
a table twice, reversing stops.

The problem is we are checking the truthness of meta.sorting_function
instead of just the function argument sorting_function. This commit
extract the reverse operation out of sort() to unclutter the logic.
2019-08-22 13:13:24 -07:00
Thomas Ip
d86299309a org settings: Reduce the width occupied by the actions column in tables. 2019-08-22 13:13:24 -07:00
Thomas Ip
39aceb9d93 org settings: Make data exports table sortable. 2019-08-22 13:13:24 -07:00
Thomas Ip
769eaea617 org settings: Fix wrong call to people.my_full_name(). 2019-08-22 13:13:24 -07:00
Thomas Ip
658e30484e org settings: Make invites list sortable. 2019-08-22 13:13:24 -07:00
Thomas Ip
d41d965eed refactor: Group header and body under table for .progressive-table-wrapper. 2019-08-22 13:13:24 -07:00
Mateusz Mandera
c437fd4344 test_users: Eliminate hard-coded gravatar urls.
Instead of having a hard-coded url, it seems better to replace it with
get_gravatar_url - which returns the correct url, without breaking if
the email/id of the example user changes.
2019-08-21 21:28:09 -07:00
Mateusz Mandera
55bf13db88 test_user_groups: Eliminate hard-coded user ids. 2019-08-21 21:28:09 -07:00
Mateusz Mandera
52d4583987 test_push_notifs: Eliminate hard-coded user ids. 2019-08-21 21:28:09 -07:00
Mateusz Mandera
0edc7d74ff test_events: Eliminate hard-coded user id. 2019-08-21 21:28:09 -07:00
Mateusz Mandera
afc9650ebb test_email_change: Eliminate hard-coded user id. 2019-08-21 21:28:09 -07:00
Tim Abbott
6041c277a9 docs: Fix single-service deployment docs.
Apparently, the ordering matters.

This command now matches what we use for installing single-purpose
installations; I should have checked this directly.
2019-08-21 21:17:30 -07:00
Tim Abbott
7844f87d65 actions: Tag already has an account string for translation.
And also simplify an another validation string.

Fixed #9473.
2019-08-21 21:16:47 -07:00
Tim Abbott
bfacbfa783 settings: Fix ordering of headings on emoji settings page. 2019-08-21 17:02:17 -07:00
Thomas Ip
808641a603 css: Tweak sortable list styling to make sortable columns more obvious. 2019-08-21 16:50:22 -07:00
Thomas Ip
936366ffaa org settings: Make emoji list sortable. 2019-08-21 16:50:22 -07:00
Thomas Ip
d851e2dafc org settings: Use list_render to create emojis table. 2019-08-21 16:50:22 -07:00
Thomas Ip
e309168d11 org settings: Make linkifiers table sortable. 2019-08-21 16:50:22 -07:00
Thomas Ip
8d0bc912f1 org settings: Use list_render to create linkifiers' table.
Moved the table to below the "Add linkifier" box for consistency with
the other settings sections. Also added a search box.
2019-08-21 16:50:22 -07:00
Thomas Ip
83ea462a0a org settings: Make default streams list sortable. 2019-08-21 16:50:22 -07:00
Thomas Ip
29803db802 org settings: Make deactivated users list sortable. 2019-08-21 16:50:22 -07:00
Thomas Ip
2eba496968 org settings: Make active users list sortable. 2019-08-21 16:50:22 -07:00
Thomas Ip
444ce74a8e org settings: Make bot list sortable. 2019-08-21 16:50:22 -07:00
Tim Abbott
5c49133754 settings: Add a block comment explaining the auto-discard feature.
This should help make this code more readable (I found it hard to
understand while reviewing #13030).
2019-08-21 16:48:38 -07:00
Pragati Agrawal
ff26858e44 settings_org: Make save widgets fadeout quick if setting toggled back.
When a user toggles a setting back to its original value without
saving, we automatically hide the save/discard widget, since
effectively the user has discarded their changes.

The logic has previously incorrectly configured this as returning to
the "saved" state, not the "discarded" state, which caused an
unintentional delay before the widget disappeared (by accidentally
running code that was designed for the save -> saved transition).

While doing this I have fixed a very minor bug that we haven't sent
fadeout_delay argument as 0, but having its value as undefined still
defaults to 0 so there will no impact of this change.

Fixes: #12258.
2019-08-21 16:42:14 -07:00
Rohitt Vashishtha
400d0367dc tests: Improve logging for fixture tests in push_notifications. 2019-08-21 16:34:40 -07:00
Rohitt Vashishtha
da2b7ef137 minor: Move displaced comment. 2019-08-21 16:34:40 -07:00
Wyatt Hoodes
447f0d3f07 docs: Fix typos in git cheat sheet documentation. 2019-08-21 15:54:09 -07:00
Pragati Agrawal
5df6065bed org settings: Deduplicate the template code for logo widget. 2019-08-21 15:49:25 -07:00
Pragati Agrawal
4d0a94a3b1 org settings: Replace usage of ids with classes for delete button. 2019-08-21 15:49:25 -07:00
Pragati Agrawal
c29b197ec7 org settings: Replace usage of ids with classes for upload button. 2019-08-21 15:49:25 -07:00
Pragati Agrawal
67861529ac org settings: Replace id comparision with hasClass function.
This is in series of refactoring of code for realm logo settings.

Further, we will remove ids from the template as well and simply use
general classes (.day-settings and .night-settings) to identify to which
theme-mode particular element belongs i.e. day or night as we did in this
change.
2019-08-21 15:49:25 -07:00
Pragati Agrawal
707e012af0 realm_logo: Refactor realm_logo.rerender function to be more clean.
This creates/extract a function `change_logo_delete_button`.
2019-08-21 15:49:25 -07:00
Pragati Agrawal
34d2616158 org settings: Use .realm-logo-file-input-error to identify input errors.
This replaces `realm_logo_file_input_error` and
`realm_night_logo_file_input_error` with one class.
2019-08-21 15:49:25 -07:00
Pragati Agrawal
c214d184d0 org settings: Replace logo's file input ids with .realm-logo-file-input. 2019-08-21 15:49:25 -07:00
Pragati Agrawal
a6cd0b8788 org settings: Use realm-logo-img class as identifier of realm logo image.
This replaces previously being used ids, `realm-settings-logo` and
`realm-settings-night-logo` with a common class `realm-logo-img`.
2019-08-21 15:49:25 -07:00
Pragati Agrawal
6ab2dcf4ac settings_org: Add ids to the section of day and night logos.
- These ids will further be used to represent each section concisely and
  deduplicating code.

- Also, removed `realm-night-logo-section` class as it was redundant.
2019-08-21 15:49:25 -07:00
Alex Dehnert
ea670f3d61 docs: remove duplicate "make" in "Writing Bots". 2019-08-21 14:36:08 -07:00
Tim Abbott
d0d16ed81c Revert "test_mattermost_importer: Fix missing coverage."
This reverts commit c48e53f587.

This new test code had nondeterministic failures; reverting so we can
debug without disruption.
2019-08-21 11:20:20 -07:00
Anders Kaseorg
b2e1af90fc process_fts_updates: Reconnect on OperationalError.
This allows process_fts_updates to recover if Postgres is restarted.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-21 11:00:58 -07:00
Anders Kaseorg
fb42cd3af9 process_fts_updates: Fix log message.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-21 11:00:58 -07:00
Anders Kaseorg
473c4abca5 process_fts_updates: Use psycopg2.connect kwargs.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-21 11:00:58 -07:00
Anders Kaseorg
5aeb562700 migrations.0001_initial: Expand \n in long SQL string.
One occasionally finds that a 1580 character string of SQL queries
might not most readably be presented on a single line.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-21 11:00:38 -07:00
Anders Kaseorg
fa11b2d806 nginx: Don’t gzip files that are already compressed.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-21 10:51:37 -07:00
Anders Kaseorg
4e620ed43c nginx: Enable http2 in on-premise configuration.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-21 10:51:37 -07:00
Tim Abbott
92d8c5dec6 docs: Recommend zulip::base when deploying subsets of Zulip.
One needs to explicitly request zulip::base, it appears.  Ideally,
we'd just have every ruleset depend on zulip::base, but I seem to
recall Puppet didn't like your including the same module from multiple
places.  Worth testing as a follow-up investigation.

This was missed because we use the zulip_ops rules internally, which
include zulip::base via zulip_ops::base.
2019-08-21 10:34:34 -07:00
Hemanth V. Alluri
f375350446 page_params: Send the list of config_options for incoming webhook bots.
Send the config_options for each supported incoming webhook bot along
with the initial state (not present in apply_events since this is
mostly just static data).
2019-08-20 17:00:48 -07:00
Hemanth V. Alluri
d73a37726d bots: Allow incoming webhook bots to be configured via /bots.
Without disturbing the flow of the existing code for configuring
embedded bots too much, we now use the config_options feature to
allow incoming webhook type bot to be configured via. the "/bots"
endpoint of the API.
2019-08-20 17:00:48 -07:00
Hemanth V. Alluri
94c351ead4 bot_config: Have check_valid_bot_config also take the bot_type.
This is a prep commit to allow us to validate user provided bot
config data using the same function for incoming webhook type
bots alongside embedded bots (as opposed to creating a new
function just for incoming webhook bots).
2019-08-20 16:44:56 -07:00
Hemanth V. Alluri
f5c57361d6 bots: Specify config options for an incoming webhook integration.
In integrations.py we have a class called Integration which we then usually
subclass and then use to define the meta-data for all of our integrations.
Now, we want to allow all of our bots, specifically incoming webhook bots,
to be configured (i.e. we should let the user provide BotConfigData).

For this we create a new instance member of the Integration class called
config_options which will be a list of tuples containing the displayable
integration name, the configuration key form of the integration name and
the validator that it's value is supposed to adhere to.
2019-08-20 16:44:56 -07:00
Wyatt Hoodes
c48e53f587 test_mattermost_importer: Fix missing coverage. 2019-08-20 15:23:41 -07:00
Mateusz Mandera
26f7dd09ce display_recipient: Eliminate raw_display_recipient from message dicts.
This was used as a helper to construct the final display_recipient when
fetching messages. With the new mechanism of constructing
display_recipient by fetching appropriate users/streams from the
database and cache, this shouldn't be needed anymore.
2019-08-20 12:22:52 -07:00
Tim Abbott
b25abf3de9 display_recipient: Deduplicate list of display_recipient fields. 2019-08-20 12:22:37 -07:00
Mateusz Mandera
d200cb921d display_recipient: Only fetch the necessary fields from the database.
There is no need to fetch the entire Stream or UserProfile objects, as
only several fields are needed. We use Django's .values() method to only
get what's needed.

For UserProfiles, it means that we get from the queries are dictionaries
already in the display_recipient form (UserDisplayRecipient type) - so
we can remove the user_profile_to_display_recipient_dict function, as
there's no need for this UserProfile -> UserDisplayRecipient conversion
anymore.
2019-08-20 12:15:30 -07:00
Mateusz Mandera
87ccb4f6c7 types: Consistently use DisplayRecipientT for display_recipient objects.
Instead of having the rather unclear type Union[str,
List[UserDisplayRecipient]] where display_recipient of message dicts was
involved, we use DisplayRecipientT (renamed from DisplayRecipientCacheT
- since there wasn't much reason to have the word Cache in there), which
makes it clearer what is the actual nature of the objects and gets rid
of this pretty big type declaration.
2019-08-20 12:15:30 -07:00
Mateusz Mandera
3ba0a37a92 types: Define UserDisplayRecipient type using TypedDict.
Since the display_recipients dictionaries corresponding to users are
always dictionaries with keys email, full_name, short_name, id,
is_mirror_dummy - instead of using the overly general Dict[str, Any]
type, we can define a UserDisplayRecipient type,
using an appropriate TypedDict.

The type definitions are moved from display_recipient.py to types.py, so
that they can be imported in models.py.

Appropriate type adjustments are made in various places in the code
where we operate on display_recipients.
2019-08-20 12:15:30 -07:00
Mateusz Mandera
c779bb1959 messages: Don't use display_recipient values from cached message_dicts.
The user information in display_recipient in cached message_dicts
becomes outdated if the information is changed in any way.

In particular, since we don't have a way to find all the message
objects that might contain PMs after an organization toggles the
setting to hide user email addresses from other users, we had a
situation where client might see inaccurate cached data from before
the transition for a period of up to hours.

We address this by using our generic_bulk_cached_fetch toolchain to
ensure we always are fetching display_recipient data from the database
(and/or a special recipient_id -> display_recipient cache, which we
can flush easily).

Fixes #12818.
2019-08-20 12:15:30 -07:00
Pragati Agrawal
48efd46bc6 realm_logo: Remove redundant realm_logo_url function.
This function is nothing but a redundant layer of call to
`get_realm_logo_url`.
2019-08-20 12:07:20 -07:00
Pragati Agrawal
7326acdc2b realm_logo: Refactor get_realm_logo_url function. 2019-08-20 12:07:20 -07:00
Pragati Agrawal
1da5001875 realm_logo: Refactor/Deduplicate the code to sent the events.
This also creates a function to get source and url for logo.
2019-08-20 12:07:20 -07:00
Vaibhav
c20f1945d7 css: Nest .help-table inside .modal-body. 2019-08-20 12:00:22 -07:00
Vaibhav
a3c6bd68f0 css: Use SCSS nesting for .hotkeys_table. 2019-08-20 12:00:22 -07:00
Vaibhav
c9b8de9cc1 css: Use SCSS nesting for .informational-overlays. 2019-08-20 12:00:22 -07:00
Vaibhav
ba0f377273 css: Reorder informational_overlays.scss so similar elems in same place.
Also some whitespace changes. (No separate commit required).
2019-08-20 12:00:22 -07:00
Tim Abbott
69505c30a4 mattermost: Handle users who aren't on any team correctly.
It's not clear to me how this is intended to work in Mattermost's
system in that they don't document this behavior, but some users have
`null` as their list of teams, and presumably are not meant to be
included in any team at all.
2019-08-19 16:06:39 -07:00
Tim Abbott
e02806ccc5 request: Fix other syntax error on Xenial Python. 2019-08-19 15:58:12 -07:00
Tim Abbott
0435556fd5 request: Fix syntax error on Xenial Python. 2019-08-19 15:47:40 -07:00
Tim Abbott
3781a0dae2 urls: Reformat how we handle API-only mobile endpoints.
This restructures the API endpoints that we currently have implemented
more or less for exclusive use by the mobile and desktop apps (things
like checking what authentication methods are supported) to use a
system that can be effectively parsed by our test_openapi
documentation.

This brings us close to being able to eliminate
`buggy_documentation_endpoints` as a persistently nonempty list.
2019-08-19 15:34:40 -07:00
Tim Abbott
27bfed7896 openapi: Remove presence from untestable endpoints.
This add some regular expression manipulation hacks to make it
possible for us to validate the documentation for the presence
endpoint with a slightly more complex regular expression capture
group.
2019-08-19 15:17:28 -07:00
Tim Abbott
44db59bbe0 openapi: Fix handling of parameters passed via the URL/path.
Previously, our OpenAPI documentation validation was failing for some
endpoints because it didn't account for the `in: path` type of
parameter, resulting in a mismatch between what was declared via REQ
and what was declared in the OpenAPI docs.

We fix this by excluding the path type parameters in both places from
what's considered by documentation using the `path_only` flag.

I doubt this is the correct long-term fix; in particular, I don't
think we're actually running the validators for these path-only
parameters.  The examples that exist today are all IDs with validators
for being non-negative numbers, but longer-term I think we'll want to
do something different (possibly at the REQ layer, see the TODO).
2019-08-19 15:06:08 -07:00
Hemanth V. Alluri
2e20dcc053 webhooks/jira: Update webhook to support improved comment events.
Atlassian announced that it will no longer provide information about
comments along with their "issue" type event payloads for Jira. So
we must now update the Jira integration to appropriately respond to
"comment" type events (the reason why we didn't do this before was
that initially, the "comment" type event payloads didn't contain
sufficient information about their issues, but this payload has
since been improved).

Note: This commit does *not* remove support for the older "issue"
type event payloads where information about comments was included.
This way we can maintain compatibility with old self-hosted versions
of self hosted Jira (2016 and before).

Source:
https://developer.atlassian.com/cloud/jira/platform/change-notice-
removal-of-comments-from-issue-webhooks/

Fixes #13012
2019-08-19 14:22:42 -07:00
Tim Abbott
ee63f68140 docs: Add links from SSL docs to our desktop app SSL guide.
This should help people setting up new Zulip servers discover how to
setup SSL properly for the desktop apps.
2019-08-19 14:21:56 -07:00
Vishnu Ks
d472d30c28 requirements: Upgrade stripe pip package from 2.21.0 to 2.35.0. 2019-08-19 11:09:33 -07:00
Vishnu KS
6c8d837401 stripe: Don't check value of realm_id directly in tests.
Value of realm_id varies from one development environment
to another from time to time. So we will just check whether
realm_id is a number instead.
2019-08-19 11:09:33 -07:00
Alexandra Ciobica
96cdfd676b css: Add bottom margin to titles in the register pages. 2019-08-18 12:57:25 -07:00
Pragati Agrawal
eedcdf7f3b settings/styles: Reorder .settings-section .table-striped to same place. 2019-08-18 12:44:40 -07:00
Pragati Agrawal
78d6ecfa08 settings/styles: Use .settings-section for settings .table-striped.
We have used `.settings-section .table-striped` for other rules to refer the same elements
which are referred by `#settings_page .table-striped`.
2019-08-18 12:44:40 -07:00
Pragati Agrawal
aac9a7a4b1 settings/styles: Remove redundant rules for .table-striped thead th.
This rule is already specified at
 `.settings-section .table-striped thead th`.
2019-08-18 12:44:40 -07:00
Pragati Agrawal
a858d51a85 settings/styles: Nest all .settings-section rules. 2019-08-18 12:44:40 -07:00
Pragati Agrawal
9acd8caa59 settings/styles: Remove redundant specificity. 2019-08-18 12:44:40 -07:00
Pragati Agrawal
2c846774c0 settings/styles: Reorder styles in more sensible order.
Rather just putting rules in any order it makes more sense to have an order
of basic to more advanced/specific CSS.
2019-08-18 12:44:40 -07:00
Pragati Agrawal
94d867cd11 settings/scss: Reorder .settings-section to have them in same place. 2019-08-18 12:44:40 -07:00
Pragati Agrawal
b0b1435a18 settings/scss: Remove now redundant settings-wrapper class.
No class like this is rendered to page.
2019-08-18 12:44:40 -07:00
Pragati Agrawal
378c1a5994 settings/scss: Reorder to have .settings-section-title at same place. 2019-08-18 12:44:40 -07:00
Wyatt Hoodes
92dd5e2c4f test_queue_worker: Remove timing from test_slow_queries_worker.
Testing a specific query time was causing spurious failures
in CI.
2019-08-18 12:32:45 -07:00
Wyatt Hoodes
5ee7553214 popovers: Fix broken user popover behavior.
If we call `popovers.hide_all` with a smaller browser
window, this breaks the functionality that the
conditional is attempting to handle.  We instead use
`hide_all_except_sidebars` to prevent the user list
from being closed.

If the display setting to show the user list in the
left sidebar is enabled, the behavior is even worse.
We add a conditional to maintain the streamlist
sidebar when clicking the chevron to show and hide
the popover here as well.
2019-08-18 12:12:52 -07:00
Anders Kaseorg
349f22524e provision: Don’t rely on uid == gid assumption when invoking chown.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-17 12:59:09 -07:00
Anders Kaseorg
fa913b7f5d node_cache: Avoid shelling out for rm, ln, mkdir, cp, cd, touch.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-17 12:59:09 -07:00
Anders Kaseorg
88793e80ea provision: Skip some rm, mkdir, chown commands if possible.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-17 12:59:09 -07:00
okmanl
2a1305de9f lint: Add a rule to avoid msgid as a Python variable name.
This is for consistency with our usual patterns, see #12995.  We will
need a similar commit for JavaScript to complete #12995.
2019-08-17 12:47:13 -07:00
Wyatt Hoodes
dc191b0be4 test_queue_worker: Test actual code path for slow_queries.
Instead of just mocking some fake events, we use the code
path that generates slow query events and publishes them
to SlowQueryWorker.

This test improvement would have got a recent potential regression
caught in code review.
2019-08-17 12:38:02 -07:00
Brutus5000
a386e3aebb github webhook: For release events show actions and tag name. 2019-08-17 12:35:16 -07:00
Hemanth V. Alluri
dac068df31 production: Finish adding production support for Zulip on Debian Buster.
This commit finishes adding end-to-end support for the install script
on Debian Buster (making it production ready). Some support for this
was already added in prior commits such as
99414e2d96.

We plan to revert the postgres hunks of this once we've built
tsearch_extras for our packagecloud archive.

Fixes #9828.
2019-08-17 12:22:32 -07:00
Hemanth V. Alluri
083723b6a9 puppet: Add Zulip specific postgres configuration for 11.
Based on the work done in a03e4784c7.
2019-08-17 11:41:11 -07:00
Hemanth V. Alluri
792283c441 puppet: Commit an upstream version of postgres 11 config.
In preparation for adding production support for Debian Buster. Based
on the work done in commit 964a1ac8a7.
2019-08-17 11:41:11 -07:00
Hemanth V. Alluri
5dd45b4b2e puppet: Fix the release detection regex patterns in base.pp.
The issue here was that the '.' character was unescaped and the
regex was not anchored with a terminal '$'. This was detected by
Anders Kaseorg.

Co-authored-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-17 11:41:11 -07:00
Hemanth V. Alluri
243d8ffc51 openapi: Add a test to ensure generated curl examples work.
This new test runs each generated curl example against the Zulip API,
checking whether it returns successfully without errors.

Significantly modified by tabbott for simplicity.
2019-08-17 11:35:08 -07:00
Tim Abbott
26ac3ebd3e openapi: Suggest the -sS options to curl.
These options prevent curl from doing the downloading progress bar
(which is clutter).
2019-08-17 11:35:08 -07:00
Tim Abbott
2366490ffc openapi: Pass api_url to curl example generation.
Our new curl example generation logic was broken, in that it hardcoded
localhost:9991 (without an HTTP method or anything) as the API URL.

It requires a bit of plumbing to make this possible.
2019-08-17 11:35:08 -07:00
Tim Abbott
e8b4e80d45 test-api: Fix double use of django.setup.
django.setup is already called (with different/better environment
variables) inside test_server_running; we shouldn't be calling it just
before that to make imports work.

I discovered this because imports done at the wrong time would
potentially incorrectly have `testserver` as the EXTERNAL_HOST.
2019-08-17 11:35:08 -07:00
Vishnu KS
f32382f7b7 emails: Show preheader block only if preheader is present. 2019-08-17 11:32:28 -07:00
Vishnu KS
ff6dab6883 emails: Remove preheader block from missed message emails. 2019-08-17 11:26:34 -07:00
Priyank Patel
0e337c015a message_fetch: Use stream ID for stream operand.
Fixes part of #9474
2019-08-17 11:20:51 -07:00
Priyank Patel
3680393b47 messages: Support passing user ID for stream operator.
ok_to_include_history fuction was updated to expect stream ID.

Fixes part of #9474.
2019-08-17 11:19:12 -07:00
Priyank Patel
5eab5bbc3e streams: Refactor can_access_stream_history.
This refactor extracts the code logic of checking if user can access
stream history into it's own function: can_access_stream_history
that takes in user_profile and stream. Then we make seperate function
can_access_stream_by_name that takes in stream_name and retrives stream
and pass it to can_access_stream_history. This will make it easily to later
add a function that does the same thing with stream ID.
2019-08-17 11:10:00 -07:00
Priyank Patel
0307b6d684 refactor: Make get_stream_name_from_narrow return stream.
This function was used only once in exclude_muting_conditions where
it returned stream name so the function to fetch stream id.
Since we exepect the narrow to also include stream id we refactor it to
return a stream object and since we use get_stream_by_narrow_operand_access_unchecked
we don't need to worry about handling cases where stream id is passed since
the function handles it.
2019-08-17 11:10:00 -07:00
Priyank Patel
463ecb375f refactor: Add get_stream_by_narrow_operand_access_unchecked.
This let's us clean up the linter that excludes the use of get_stream
and by adding the access_unchecked in the name we make it clear that
it should be used with caution.

Refactoring idea by Tim Abbott.
2019-08-17 11:10:00 -07:00
Priyank Patel
1f8f8867cd message_fetch: Rename handle_user_ids_supported_operators.
This renames handle_user_ids_supported_operators to
handle_operators_supporting_id_based_api.
2019-08-17 11:10:00 -07:00
Priyank Patel
1edde4a989 Rename user_id(s)_supported_operators -> operators_supporting_id(s). 2019-08-17 11:10:00 -07:00
Priyank Patel
99450f336c messages: Extract mypy typing for narrow list to variable.
Makes it obvious and readable and as an added bonus take up less space.

Note, some types used Iterable instead of List that were change
to used List since the narrow_paramter converter return a List.
2019-08-17 11:10:00 -07:00
Gloria Elston
092662d83e api: Use new endpoint for handling reactions. 2019-08-16 14:36:15 -07:00
Anders Kaseorg
fc6a8396ed mypy: In non-daemon mode, follow package imports.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-16 14:13:40 -07:00
Anders Kaseorg
86f8bb83ab setup_venv: Don’t pip uninstall typing; it’s no longer installed.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-16 14:13:40 -07:00
Anders Kaseorg
a5596011a0 queue_processors, python_examples: Fix mypy errors.
zerver/openapi/python_examples.py:105: error: Argument 1 to "get_user_presence" of "Client" has incompatible type "str"; expected "Dict[str, Any]"
    zerver/openapi/python_examples.py:563: error: Argument 1 to "add_reaction" of "Client" has incompatible type "Dict[str, object]"; expected "Dict[str, str]"
    zerver/openapi/python_examples.py:576: error: Argument 1 to "remove_reaction" of "Client" has incompatible type "Dict[str, object]"; expected "Dict[str, str]"
    zerver/worker/queue_processors.py:587: error: Argument "client" to "extract_query_without_mention" has incompatible type "EmbeddedBotHandler"; expected "ExternalBotHandler"

These were only missed because mypy daemon mode requires us to set
`follow_imports = skip` for the `zulip` package.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-16 14:13:40 -07:00
Anders Kaseorg
bfc5617f04 requirements: Update zulint.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-16 14:13:40 -07:00
Anders Kaseorg
037b16888f docs: Suggest installing vagrant-vbguest plugin.
This plugin automatically updates the VirtualBox Guest Additions in
the guest, which makes shared folders work more reliably.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-16 13:57:07 -07:00
Hemanth V. Alluri
cfa6270080 docs: In api.md add the tools/ part before test-backend.
In this section of the docs, two tools for testing openapi
documentation are mentioned. But for the second one, we
forgot to mention that the tool also resides in the tools/
folder (like the first one which explicitly mentions it).
This commit fixes that.
2019-08-16 13:09:37 -07:00
Anders Kaseorg
6bca996e2e webpack: Chill. Out. When watching for changes.
Polling for changes every 100 milliseconds was burning enough CPU to
set mid-2015 MacBooks on fire.  Use the default inotify watching,
except on filesystems where that’s known not to work (nfs, vboxsf), in
which case polling once per second is more than enough for even the
fastest typers.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-16 11:05:21 -07:00
Pragati Agrawal
13d5a21430 settings/scss: Nest many rules inside #user-groups. 2019-08-16 10:47:33 -07:00
Pragati Agrawal
44d6123c26 settings/scss: Nest .user-group inside #user-groups. 2019-08-16 10:46:12 -07:00
Pragati Agrawal
df31238fb7 settings/scss: Make #user-groups .user-group rules at same place. 2019-08-16 10:46:12 -07:00
Anders Kaseorg
66649d84cb puppet: Reload postfix on /etc/postfix/virtual changes.
`/etc/postfix/virtual` is of `regexp:` type, not `hash:` type, so
running `postmap` on it has no effect; we need to reload Postfix when
it changes.

http://www.postfix.org/DATABASE_README.html#detect

In the interest of forcing a reload now, optimize the regexes by
eliding the unanchored `.*`s at the beginnings and ends.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-15 22:45:26 -07:00
David Rosa
0d52d24d64 docs: pip upgrade recommonmark and CommonMark
Summary:
- recommonmark: 0.4.0 -> 0.5.0
- CommonMark: 0.5.4 -> 0.9.0
- Fixed links getting their .md file extension cut off
- Supressed 262 new warnings

Details:
Appended #anchors to markdown github links as a workaround to
recommonmark 0.5.0 cutting off the ".md" part from them.
Sphinx build would fail as follows

[documentation_crawler] ERROR: Please check link:
<404 https://github.com/zulip/zulipbot/blob/master/.github/CONTRIBUTING>
<404 https://github.com/zulip/zulip/blob/master/requirements/README>
<404 https://github.com/zulip/python-zulip-api/blob/master/zulip_bots/README>

sphinx build would also log a "WARNING: None:any reference target not found"
for every link ending in .html
So a good temporary solution is to suppress all warnings with the method suggested here:
https://stackoverflow.com/questions/37359407/suppress-warnings-for-unfound-references-with-default-role-any-in-sphinx

A better solution would be to edit all links ending .html and use .md instead;
which would also solve PR #11719.

Fixes #11395.
2019-08-15 22:41:40 -07:00
Vaibhav
262e5c6400 css: Use SCSS media queries nesting in drafts.scss. 2019-08-15 22:39:39 -07:00
Vaibhav
2c4f4b0e38 css: Nest .draft-controls inside .draft-info-box. 2019-08-15 22:39:39 -07:00
Vaibhav
ab30295a39 css: Nest .draft-info-box inside .draft-row. 2019-08-15 22:39:39 -07:00
Vaibhav
f94f4ac48e css: Nest .drafts-list inside .drafts-container. 2019-08-15 22:39:39 -07:00
Vaibhav
4e7f3eba85 css: Nest .exit-sign inside .exit. 2019-08-15 22:39:39 -07:00
Vaibhav
7ed9d10016 css: Nest .exit and .exit-sign inside .drafts-header. 2019-08-15 22:39:39 -07:00
Vaibhav
d20204826d css: Nest .drafts-header inside .drafts-container. 2019-08-15 22:39:39 -07:00
Vaibhav
591ebb22bf css: Use SCSS nesting for .draft- row, info-box and controls. 2019-08-15 22:39:39 -07:00
Vaibhav
585b6680ae css: Reorder drafts.scss so .draft-row are together. 2019-08-15 22:39:39 -07:00
Vaibhav
067c9040e7 css: Use SCSS nesting for .drafts- container, header and list. 2019-08-15 22:39:39 -07:00
Vaibhav
b940406877 css: Reorder drafts.scss so .drafts-container are in same place. 2019-08-15 22:39:39 -07:00
Mateusz Mandera
c6b3d0212d models: Move some display_recipient code to display_recipient.py. 2019-08-15 17:15:32 -07:00
Mateusz Mandera
cb2c9b04b3 generic_bulk_cached_fetch: Only call query_function if necessary. 2019-08-15 17:14:02 -07:00
Mateusz Mandera
898bc52538 models: Add bulk_get_huddle_user_ids function. 2019-08-15 17:03:17 -07:00
Mateusz Mandera
f70a0bba82 display_recipient: Extract user_profile_to_display_recipient_dict function. 2019-08-15 16:59:28 -07:00
Vishnu KS
7a433f279a requirements: Upgrade Django from 1.11.22 to 1.11.23. 2019-08-15 16:56:31 -07:00
Pragati Agrawal
693df05ca7 settings_users: Refactor and extract function for last active.
This just done to improves code readability and removes some code too.
2019-08-15 16:54:28 -07:00
Pragati Agrawal
c0c11fe226 settings_users: Refactor logic for "last active" column in users table.
This uses "last_active" attribute of `user` (`item`) object and makes code
much more readable.
2019-08-15 16:54:28 -07:00
Pragati Agrawal
a3ef8856a8 settings_users: Add last_active to active_users for "users" table.
This is a preliminary step for refactoring the logic for rendering
"last_active" in the users table and later we can use this for sorting the
column.
2019-08-15 16:54:28 -07:00
Pragati Agrawal
ba5564fec7 settings_users: Remove if condition for showing current user time stamp.
It seems `presence.presence_info[item.user_id]` works fine for the current
user as well and there is no need to hardcode extra condition for the
current user.
2019-08-15 16:54:28 -07:00
Pragati Agrawal
6b5e98d554 settings_panel_menu: Fix the switching behavior for hidden section panels.
For organization settings page there are few sections' panels which are not
visible (unless you click on 'show more') but when we use up-down arrows to
navigate between sections, sections of hidden panels also get visible which
leads to confusion.

Fixes: #13008.
2019-08-15 16:51:19 -07:00
Alexandra Ciobica
f7e88fb2c1 css: Add color variables to integrations.scss. 2019-08-15 16:12:15 -07:00
Alexandra Ciobica
43d11285fa css: Add background to integrations categories. 2019-08-15 16:12:15 -07:00
Alexandra Ciobica
da9a092d39 css: Refactor integrations to use SCSS nesting.
While refactoring, I tested all the rules and removed the CSS that was
not needed or duplicated.

I removed the `$("#integration-list-link").css('display', 'block');` and
moved it to css because there is no case in which the back link is
hidden.
2019-08-15 16:12:15 -07:00
Alexandra Ciobica
84e0327d10 integrations: Fix arrangement of left sidebar back to list button.
I rearranged the elements of the left sidebar in HTML in order to appear
in the order they are displayed and removed the absolute positioning,
because it was not needed if the elements are arranged correctly. I used
`flex` display to arrange them on column.

I removed the styling that positioned the elements absolutely.

Then I tweaked the margins in order to make the elements look good.

Fixes: #12929
2019-08-15 16:12:15 -07:00
Anders Kaseorg
d761bbc2ed node_cache: Remove unused copy_modules parameter.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-14 14:39:04 -07:00
rht
61be9fb4bd puppet: Add Zulip-specific postgres configuration for 10 on Centos. 2019-08-14 14:31:16 -07:00
rht
03fb4b5f90 puppet: Commit an upstream CentOS version of postgres 10 sample config. 2019-08-14 14:31:16 -07:00
Tim Abbott
27a0e307b6 cache: Fix typing for generic_bulk_cached_fetch.
The typing for generic_bulk_cached_fetch is complicated, and was
recorded incorrectly previously for the case where a cache_transformer
function is required.  We fix this by adding the new CacheItemT, and
additionally add comments explaining what's going on with these types
for future reference.

Thanks to Mateusz Mandera for raising this issue.
2019-08-14 11:00:40 -07:00
Tim Abbott
2ada0a9bad management: Fix password reset emails being sent to deactivated users.
Apparently, the filters written for the send_password_reset_email (and
some other management commands) didn't correctly consider the case of
deactivated users.

While some commands, like syncing LDAP data (which can include whether
a user should be deactivated) want to process all users, other
commands generally only want to interact with active users.  We fix
this and add some tests.
2019-08-14 10:50:45 -07:00
Thomas Ip
cbae51db63 settings: Move API key form into its own modal.
The modal is rendered dynamically to avoid password managers
inserting passwords into the input field too aggressively.

Fixes #12523.
2019-08-14 10:50:45 -07:00
Thomas Ip
75db8fecf8 refactor: Remove redundant dataType option to channel.post(). 2019-08-14 10:50:45 -07:00
Akash Nimare
2e47e35edc desktop: Update desktop app to v4.0.0. 2019-08-13 12:36:40 -07:00
Wyatt Hoodes
001ff72861 data exports: Add upload and message limit test. 2019-08-12 19:52:46 -07:00
Wyatt Hoodes
f623540409 data export: Add UI to trigger data export.
This commit serves as the frontend piece for the "public export"
webapp feature.

Fixes: #11930
2019-08-12 18:21:38 -07:00
Tim Abbott
8ac8247dbe data export: Add limits on exporting large organizations.
It seems possible that attempting to export large organizations could
result in high resource consumption that justifies having a technician
manage the exports manually.
2019-08-12 18:21:09 -07:00
Tim Abbott
1d63f129bf data export: Add summary logging of runtime.
This should help us investigate cases where this runs a very long
time.
2019-08-12 18:21:08 -07:00
Wyatt Hoodes
896886b412 realm_export: Add endpoint for export deletion. 2019-08-12 17:51:46 -07:00
Wyatt Hoodes
777dcdd272 test_realm_export: Clean up export testing.
* Added comments.
* Refactored `export_object` to `audit_log_entry`.
* Cleaned up white space.
* Removed uses of `getattr`.
2019-08-12 17:51:46 -07:00
Wyatt Hoodes
7c118096e7 test_events: Remove print statement from self.client_post.
Leftover from prior debugging.
2019-08-12 17:51:46 -07:00
Wyatt Hoodes
7d178bbb0f queue_processors: Clean up the extra_data dict code.
We don't want to add a `deleted_timestamp` key until
the export is actually deleted.
2019-08-12 17:51:46 -07:00
Wyatt Hoodes
6f6efa516d exports: Refactor extra_data to export_data. 2019-08-12 17:51:46 -07:00
Wyatt Hoodes
7a2a1f29ad exports: Refactor event_time to export_time timestamp.
The time of the event was incorrectly being sent
as a datetime object.
2019-08-12 17:51:46 -07:00
Anders Kaseorg
e0cf3d0e76 zerver: Accept HEAD requests wherever GET requests are accepted.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-12 16:47:41 -07:00
Anders Kaseorg
ead13c11e5 run-dev: Don’t rewrite the Content-Length header.
A HEAD response has a Content-Length but no body; it’s not correct in
that case to let Tornado default Content-Length to 0.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-12 16:47:41 -07:00
Hemanth V. Alluri
d425ab5ae5 test_templates: Add a verbose error messages for rendering failures.
If a template fails to render in test_templates because of a missing
context variable, we should better explain the reason for the failure.
2019-08-12 16:24:08 -07:00
Anders Kaseorg
09e7a688b0 Revert "vagrant: Add NFS backend for file synchronization for OSX."
Reportedly the NFS synced folder type doesn’t work on macOS with the
Docker provider, while the default type does.  And it seems likely
that four years of Ubuntu updates will have resolved the guest crashes
that motivated the prior switch to NFS.

https://chat.zulip.org/#narrow/stream/21-provision-help/topic/experimental.20docker.20setup

This reverts commit 9e8ae68dfb (#7520).

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-12 16:04:00 -07:00
Anders Kaseorg
72655611ce requirements: Use maintained fork django-sendfile2 of django-sendfile
The original seems to be unmaintained
(johnsensible/django-sendfile#65).  Notably, this fixes a bug in the
filename parameter, which perviously showed the Python 3 repr of a
byte string (johnsensible/django-sendfile#49).

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-12 15:40:08 -07:00
Anders Kaseorg
263d71bf2b nginx: Add CORS headers to /user_uploads.
Fixes: #12980.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-12 15:35:35 -07:00
Anders Kaseorg
73330f3136 rest_dispatch: Remove invalid Content-Length: 0 from 204 responses.
There’s an apparent contradiction between RFC 7230 §3.3.2
Content-Length:

“A server MUST NOT send a Content-Length header field in any response
with a status code of 1xx (Informational) or 204 (No Content).”

and RFC 7231 §4.3.7 OPTIONS:

“A server MUST generate a Content-Length field with a value of "0" if
no payload body is to be sent in the response.”

The only resolution within the existing language would be to disallow
all 204 responses to OPTIONS requests.  However, I don’t think that
was the intention, so I submitted this erratum report:

https://www.rfc-editor.org/errata/eid5806

and updated the code accordingly.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-12 15:34:42 -07:00
Anders Kaseorg
2e57f3ffae puppet: “Resolve” puppet-lint warnings.
Introduced by #12966.

puppet/zulip/manifests/base.pp - WARNING: double quoted string containing no variables on line 93
puppet/zulip/manifests/base.pp - WARNING: string containing only a variable on line 93

scanf doesn’t accept a number as input, so uh, add a dummy space
character.

What.  You can’t give me a bad language and then complain when I write
bad programs in it.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-12 15:29:23 -07:00
Tim Abbott
7953e23d49 event_queue: Actually fix missing copy for edit-message events.
Apparently, our edit-message events did not guarantee that the outer
wrapper dictionary, which is intended to be unique for each client,
was unique for every client (instead only ensuring it was unique for
each user).

This led to clients unexpectedly getting last_event_id validation
errors in this code path when a user had multiple connected clients,
because the linear ordering of event IDs within a given queue was
corrupted.

In fd2a63b049, we accidentally fixed
this issue with a different set of userdata events, without fixing the
edit-message event bug.  This commit fixes the remaining issue.
2019-08-12 15:17:10 -07:00
Anders Kaseorg
58adac5663 zthumbor: Clean up type ignores.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-09 17:42:33 -07:00
Anders Kaseorg
d56a5bdd88 dev_settings: Clean up type ignores.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-09 17:42:33 -07:00
Anders Kaseorg
9650188dfe backends: Clean up type ignores.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-09 17:42:33 -07:00
Anders Kaseorg
5d063910ff zilencer: Clean up type ignores.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-09 17:42:33 -07:00
Anders Kaseorg
7bf09067d1 event_queue: Clean up type ignores.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-09 17:42:33 -07:00
Anders Kaseorg
7cd11d0559 test_users: Clean up type ignores.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-09 17:42:33 -07:00
Anders Kaseorg
75a01810e3 test_outgoing_webhook_interfaces: Clean up type ignores.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-09 17:42:33 -07:00
Anders Kaseorg
1ffbc0009d test_openapi: Clean up type ignores.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-09 17:42:33 -07:00
Anders Kaseorg
9d33200fb2 test_messages: Clean up type ignores.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-09 17:42:33 -07:00
Anders Kaseorg
4671e4ca5c test_i18n: Clean up type ignores.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-09 17:42:33 -07:00
Anders Kaseorg
c453c4b602 test_events: Clean up type ignores.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-09 17:42:33 -07:00
Anders Kaseorg
d05578817e soft_deactivate_users: Clean up type ignores.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-09 17:42:33 -07:00
Anders Kaseorg
6d875dd211 topic: Clean up type ignores.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-09 17:42:33 -07:00
Priyank Patel
72bf7e2181 test_narrow: Rename stream_id -> stream_recipient_id.
It looks like this isn't actually a stream id, doing
get_stream_by_id_in_realm(stream_id, stream_messages[0].get_realm())
throws error.
2019-08-09 17:31:53 -07:00
Anders Kaseorg
b0859f4b1e linter_lib: Fix mypy errors.
tools/linter_lib/pyflakes.py:35: error: Argument 3 to "run_pyflakes" has incompatible type "List[Tuple[bytes, bytes]]"; expected "List[Tuple[str, str]]"
    tools/linter_lib/custom_check.py:110: error: Argument "rules" to "RuleList" has incompatible type "List[Dict[str, Any]]"; expected "List[Rule]"
    tools/linter_lib/custom_check.py:214: error: Argument "rules" to "RuleList" has incompatible type "List[Dict[str, Any]]"; expected "List[Rule]"
    tools/linter_lib/custom_check.py:214: error: Argument "shebang_rules" to "RuleList" has incompatible type "List[Dict[str, Any]]"; expected "List[Rule]"
    tools/linter_lib/custom_check.py:502: error: Argument "rules" to "RuleList" has incompatible type "List[Dict[str, Any]]"; expected "List[Rule]"
    tools/linter_lib/custom_check.py:502: error: Argument "shebang_rules" to "RuleList" has incompatible type "List[Dict[str, Any]]"; expected "List[Rule]"
    tools/linter_lib/custom_check.py:519: error: Argument "rules" to "RuleList" has incompatible type "List[Dict[str, Any]]"; expected "List[Rule]"
    tools/linter_lib/custom_check.py:706: error: Argument "rules" to "RuleList" has incompatible type "List[Dict[str, Any]]"; expected "List[Rule]"
    tools/linter_lib/custom_check.py:728: error: Argument "rules" to "RuleList" has incompatible type "List[Dict[str, Any]]"; expected "List[Rule]"
    tools/linter_lib/custom_check.py:738: error: Argument "rules" to "RuleList" has incompatible type "List[Dict[str, Any]]"; expected "List[Rule]"
    tools/linter_lib/custom_check.py:779: error: Argument "rules" to "RuleList" has incompatible type "List[Dict[str, Any]]"; expected "List[Rule]"
    tools/linter_lib/custom_check.py:779: error: Argument "length_exclude" to "RuleList" has incompatible type "Set[str]"; expected "List[str]"
    tools/linter_lib/custom_check.py:803: error: Argument "length_exclude" to "RuleList" has incompatible type "Set[str]"; expected "List[str]"
    tools/linter_lib/custom_check.py:805: error: Unsupported operand types for + ("List[Rule]" and "List[Dict[str, Any]]")
    tools/linter_lib/custom_check.py:819: error: Argument "rules" to "RuleList" has incompatible type "List[Dict[str, Any]]"; expected "List[Rule]"

These were missed the `zulint` package was missing PEP 561 type
annotation markers, and if it’d had them, mypy daemon mode would’ve
required us to set `follow_imports = skip` for it.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-09 17:22:45 -07:00
Anders Kaseorg
a0f4c99dad test_runner: Clean up type ignores.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-09 16:39:16 -07:00
Anders Kaseorg
aa384c03a6 push_notifications: Clean up type ignores.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-09 16:39:16 -07:00
Anders Kaseorg
95658a2a54 logging_util: Clean up type ignores.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-09 16:39:16 -07:00
Anders Kaseorg
df1fbbfee3 emoji: Clean up type ignores.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-09 16:39:16 -07:00
Anders Kaseorg
bb5507009f camo: Clean up type ignores.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-09 16:39:16 -07:00
Anders Kaseorg
9b392917c5 addressee: Clean up type ignores.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-09 16:39:16 -07:00
Anders Kaseorg
e417d3a040 slack_message_conversion: Clean up type ignores.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-09 16:39:16 -07:00
Anders Kaseorg
17acf95437 update-authors-json: Clean up type ignores.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-09 16:39:16 -07:00
Anders Kaseorg
906af61d20 pythonrc: Clean up type ignores.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-09 16:39:16 -07:00
Anders Kaseorg
b320b8c37f email-mirror-postfix: Clean up type ignores.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-09 16:39:16 -07:00
Anders Kaseorg
490ce993f4 analytics: Clean up type ignores.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-09 16:39:16 -07:00
Anders Kaseorg
820165e4da Merge pull request #12968 from andersk/ffdhe2048
nginx: Use fixed ffdhe2048 DH parameter (RFC 7919)
2019-08-09 16:29:10 -07:00
Anders Kaseorg
4e9fb05c4f puppet: Use built-in memorysize_mb fact.
Fixes this warning:

    Warning: The string '8167976' was automatically coerced to the numerical value 8167976 (file: /root/zulip/puppet/zulip/manifests/base.pp, line: 93, column: 19)

Fixes #9682.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-09 16:28:09 -07:00
Anders Kaseorg
cd1306c8d9 test-install: Add bionic.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-09 16:27:03 -07:00
meiomorphism
1af72a2745 subscriptions: Avoid sending unneeded subscriber information.
The `users/me/subscriptions` endpoint accidentally started returning
subscriber information for each stream.  This is convenient, but
unnecessarily costly for those clients which either don't need it
(most API apps) or already acquire this information via /register
(including Zulip's apps).

This change removes that data set from the default response.  Clients
which had come to rely on it, or would like to rely on it in future,
may still access it via an additional documented API parameter.

Fixes #12917.
2019-08-09 16:03:21 -07:00
Anders Kaseorg
671844d667 provision: Add default-jre-headless for vnu-jar.
This was previously pulled in by yui-compressor.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-08 17:28:20 -07:00
Tim Abbott
fb01f2208d api: Verify that all registered OpenAPI examples are called.
This should help make this test suite robust against potential
mistakes when updating it.
2019-08-08 11:45:05 -07:00
Hemanth V. Alluri
c2f9227892 openapi/python_examples: Replace TEST_FUNCTIONS with a decorator.
Use a decorator called openapi_test_function instead of the hard-coded
TEST_FUNCTIONS list for increased readability and maintainablity (at
the cost of performance).
2019-08-08 11:45:05 -07:00
Alexandra Ciobica
4c08a840d0 accounts/go: Change class of bottom text to be consistent.
I changed the class of the two bottom texts to use the same styling as
(`/new` and `/complete/github`)
2019-08-08 11:12:51 -07:00
Alexandra Ciobica
196185db03 css: Remove unused css from register page.
After removing the `bottom-text` from `new organization`, this css from
the register page is not used anymore.
2019-08-08 11:12:51 -07:00
Alexandra Ciobica
2035850d86 create_realm: Add white box to new organization.
Added the `.white-box` in order to be consistent with (`/accounts/go/`,
`/login`). Changed the class of the text under the white box so all the
text under white box uses the same styling.
2019-08-08 11:12:51 -07:00
Alexandra Ciobica
eb6c5e1962 auth: Style the GitHub auth email selection page.
I added the `white-box` as it was in the other similar pages
(`/accounts/go`).

In order to be able to style it better, I removed the buttons and added
`div`s instead, then added click handler for submitting the form.

If the email is associated to a Zulip account, the avatar of the account
is displayed and the text `Log in`, otherwize a `+` sign is
displayed and the text `Create new account`.
2019-08-08 11:12:51 -07:00
Alexandra Ciobica
e5e45c9a25 auth: Change page title and add description for the list.
I changed the class of the title in order to use the same styling as the
 other similar pages (like `/accounts/go` or `/login`).

Changed the related test.
2019-08-08 11:12:51 -07:00
Alexandra Ciobica
f109dcce9c auth: Add logic for avatars to the GitHub auth email selection page.
For the emails that are associated to an existing account in an
organisation, the avatars will be displayed in the email selection
page.  This includes avatar data in what is passed to the page.

Added `avatar_urls` to the context in `test_templates.py`.
2019-08-08 11:12:51 -07:00
Alexandra Ciobica
d4ccd73ae3 auth: Remove @users.noreply.github.com from the email selection list.
Apparently GitHub changed the email address for these; we need to
update our code accordingly.

One cannot receive emails on the username@users.noreply.github.com, so
if someone tries creating an account with this email address, that
person would not be able to verify the account.
2019-08-08 11:12:51 -07:00
Tim Abbott
0db9afe605 api docs: Update link to a currently running requestbin site. 2019-08-08 11:04:16 -07:00
Tim Abbott
de0a41bc9c provision: Fix missing dependency on unzip.
Because this is often installed by default, we hadn't noticed that our
Slack importer doesn't run without it.

Thanks to Ray Kraesig for the report.
2019-08-08 10:49:20 -07:00
Vaibhav
aa29ef0317 css: Use SCSS nesting for 700px media queries in subscriptions.scss. 2019-08-07 17:42:10 -07:00
Vaibhav
5aa22f4acd css: Reorder so .subscriptions-container are in same place. 2019-08-07 17:42:10 -07:00
Vaibhav
7019b8a4c6 css: Use SCSS nesting in subscriptions.scss media queries. 2019-08-07 17:42:10 -07:00
Vaibhav
1b1e74bc24 css: Use SCSS nesting for ul.grey-box. 2019-08-07 17:42:10 -07:00
Anders Kaseorg
c3a83a82c5 echo: Consistently send local_id as string, convert it back to number.
Fixes: #2734.

`local_id` was being transmitted to the server as a string by the AJAX
transmission path, and as a number by by the WebSocket transmission
path.  Then, one of the two racing success callback paths would use
the original number, while the other would use the type returned by
the server.  Depending on which transmission path was used and which
callback path won the race, `reify_message_id` would sometimes be
passed a string that would fail to compare equal to the numerical
selection id.  If the locally echoed message was selected, this would
cause the selection to disappear.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-07 17:17:25 -07:00
Vaibhav
30af846095 css: Use SCSS nesting for .poll-edit-question. 2019-08-07 17:16:49 -07:00
Vaibhav
241015e3e6 css: Use SCSS nesting for .poll-question-*. 2019-08-07 17:16:49 -07:00
Vaibhav
1fb5e36e7a css: Use SCSS nesting for button.task*. 2019-08-07 17:16:49 -07:00
Vaibhav
911e438a14 css: Use SCSS nesting for add-task, poll-question and poll-option. 2019-08-07 17:16:49 -07:00
Vaibhav
6f0f4647ec css: Nest .poll-vote inside .poll-widget. 2019-08-07 17:16:49 -07:00
Vaibhav
13293c702e css: Use SCSS nesting for .poll-vote. 2019-08-07 17:16:49 -07:00
Vaibhav
7b77cc936a css: Reorder widgets.scss so .poll-vote are in same place. 2019-08-07 17:16:49 -07:00
Vaibhav
39b1665237 css: Use SCSS nesting for .poll-widget, .todo-widget. 2019-08-07 17:16:49 -07:00
Vaibhav
11b2748bce css: Nest .widget-choices-heading inside .widget-choices. 2019-08-07 17:16:49 -07:00
Vaibhav
27223b258d css: Use SCSS nesting for .widget-choices. 2019-08-07 17:16:49 -07:00
Vinit Singh
a2f9211384 message_view: Show edit history when EDITED notice is clicked.
Open the edit history of a message when a user clicks on it's
EDITED notice.
Also, added on-hover darkening for the EDITED notice.

Resolves #12615.
2019-08-07 16:59:24 -07:00
vinitS101
3d01921e1a user status: Changes to Last active field of Full User Profile.
If a user was active within the last 90 days,
show number of days (23 Days ago).
If the user was active more than 90 days ago and in the same year,
then show MMM DD (Mar 15).
In any other case show MMM DD YYYY (Nov 10 2018),
Change timerender.js test to accomodate changes.
2019-08-07 16:20:19 -07:00
vinitS101
232f588d4e user status: Change Online now to Active now in full user profile.
Change "Online now" to "Active now" in Last seen field of
full user profile.
2019-08-07 16:20:19 -07:00
vinitS101
a82ad468f9 user status: Change Last online to Last active.
Change "Last online" to "Last active" in the full user profile.
2019-08-07 16:20:19 -07:00
Anders Kaseorg
7e92ff9d0a request: Delete request.pyi and make request.py type check.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-07 15:37:21 -07:00
Anders Kaseorg
13a2ac7b8e request: Remove ExtractRecipients type safety hole on REQ.
It was allowing us to get away with wrong types on a few functions:
`check_send_typing_notification` and `send_notification_backend` can be
(and are) called with a list of `int` as `notification_to`, not just a
list of `str`.

The problem it was working around already had a better solution using
the dummy `type` argument.  Use that.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-07 15:26:59 -07:00
Tim Abbott
92e34bbb10 i18n: Update translation data from transifex. 2019-08-07 15:15:28 -07:00
Tim Abbott
4e631876f4 test_events: Fix realm export test to actually work.
The previous iteration still had the failure mode of not actually
testing anything, because it didn't trigger the data export code path
(and in fact was getting an HTTP 401 authentication denied error).
2019-08-07 14:18:27 -07:00
Wyatt Hoodes
22842dab34 events: Rename notify_export_completed.
notify_realm_export is more reasonable for the context of doing
deletion events as well.
2019-08-07 14:18:27 -07:00
Tim Abbott
d9e5becb0e tools: Fix running check-openapi locally. 2019-08-07 14:18:27 -07:00
Wyatt Hoodes
7853e9d2de test_events: Fix broken test case.
This test was broken due to using an empty `RealmAuditLog`
table.  We fix this by mocking the creation of an export,
thus creating an entry, similar to what we do in our other
tests.
2019-08-07 12:05:44 -07:00
Wyatt Hoodes
f93efcb89c test_helpers: Refactor dummy file creation for broader use. 2019-08-07 12:05:44 -07:00
Wyatt Hoodes
11db0c23fb exports: Update extra_data field to a JSON structure.
We add the `deleted_timestamp` key to the new `extra_data`
dictionary.
2019-08-07 12:04:28 -07:00
Tim Abbott
b223159264 settings: Fix avatars directory being created in populate_db.
We were incorrectly setting LOCAL_UPLOADS_DIR to the empty string in
this code path, which would result in upload files being logged to the
root directory of the repository.

Fixes #12909.
2019-08-07 12:03:59 -07:00
Anders Kaseorg
0962393933 cleanup: Delete trailing newlines.
Delete trailing newlines from all files, except
tools/ci/success-http-headers.txt and tools/setup/dev-motd, where they
are significant, and static/third, where we want to stay close to
upstream.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-06 23:29:11 -07:00
Anders Kaseorg
becef760bf cleanup: Delete leading newlines.
Previous cleanups (mostly the removals of Python __future__ imports)
were done in a way that introduced leading newlines.  Delete leading
newlines from all files, except static/assets/zulip-emoji/NOTICE,
which is a verbatim copy of the Apache 2.0 license.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-06 23:29:11 -07:00
neiljp (Neil Pilgrim)
12f3ed12c4 mypy: Refactor extract_recipients in actions.py to remove type ignore. 2019-08-06 23:24:56 -07:00
neiljp (Neil Pilgrim)
5ab64daecc mypy: Remove type ignore by defining ProfileDataElement using TypedDict. 2019-08-06 23:24:56 -07:00
neiljp (Neil Pilgrim)
accf4411f0 mypy: Remove type ignore on MissedMessageWorker.stop_timer. 2019-08-06 23:24:56 -07:00
neiljp (Neil Pilgrim)
62a1c3443d mypy: Remove type ignores for python 3 stubs now present in typeshed.
Namely:
* posix stubs
* readfp stub
2019-08-06 23:24:56 -07:00
neiljp (Neil Pilgrim)
5f673f5820 mypy: Remove type ignores after boto stub improvements. 2019-08-06 23:24:56 -07:00
neiljp (Neil Pilgrim)
ba54e20def mypy: Remove type ignore for merged typeshed PR 1762. 2019-08-06 23:24:56 -07:00
Tim Abbott
6b4300904a models: Add block comment explaining per-request cache. 2019-08-06 23:22:48 -07:00
Anders Kaseorg
7625f0ecae requirements: Use a pinned zulint commit, not master.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-06 23:05:43 -07:00
Tim Abbott
fd2a63b049 event_queue: Fix missing copy for edit-message events.
Apparently, our edit-message events did not guarantee that the outer
wrapper dictionary, which is intended to be unique for each client,
was unique for every client (instead only ensuring it was unique for
each user).

This led to clients unexpectedly getting last_event_id validation
errors in this code path when a user had multiple connected clients,
because the linear ordering of event IDs within a given queue was
corrupted.
2019-08-06 13:40:30 -07:00
Wyatt Hoodes
8c26183c65 mypy: Assign warn_unreachable in mypy.ini.
Instead of doing this rather clumsily in `run_mypy`,
we configure the option in `mypy.ini`.
2019-08-06 12:43:29 -07:00
Hemanth V. Alluri
ac69717604 openapi: Migrate /messages to use the new cURL example system.
Now that we can create cURL examples based on the OpenAPI
documentation. We can begin using simple one line tags in
the documentation instead of manually creating cURL examples.

Fixes part of #12878.
2019-08-05 21:27:24 -07:00
Hemanth V. Alluri
5af753d940 api_code_examples: Parse kwargs/mods for example code generation.
Now we can also include extra keyword arguments to specify
modifications in how the example code should be generated
in the generate_code_example template tag.

E.g. generate_code_example(curl, exclude=["param1", "param2"])
2019-08-05 21:27:23 -07:00
Hemanth V. Alluri
b20cf095e7 curl: Add code to auto generate cURL examples from OpenAPI docs.
This commit extends api_code_examples.py to support automatically
generating cURL examples from the OpenAPI documentation. This way
work won't have to be repeated and we can also drastically reduce
the chance of introducing faulty cURL examples (via. an automated
test which can now be easily created).
2019-08-05 21:13:14 -07:00
Hemanth V. Alluri
f280e9cf84 lib: Rename lib/api_test_helpers.py to openapi/python_examples.py
This will make the contained code easier to find.
2019-08-05 21:06:19 -07:00
Hemanth V. Alluri
c90056bdb2 tools: Move check-swagger to check-openapi and make it executable. 2019-08-05 21:06:19 -07:00
Hemanth V. Alluri
0682f4f12a openapi: Extend type checking to check the elements of lists.
Now that the type of the elements of each array/list are also
specified in the OpenAPI documentation, we can extend our type
checking even further.
2019-08-05 21:06:19 -07:00
Hemanth V. Alluri
748192d58c openapi: Replace add-subscriptions from TEST_FUNCTIONS.
Migrate the add-subscriptions line to the OpenAPI equivalent.
2019-08-05 21:06:19 -07:00
Hemanth V. Alluri
14c0a387cf openapi: Remove /users/me from pending endpoints.
This commit progress our efforts to reduce pending_endpoints
as well as to migrate away from templates/zerver/api/fixtures
and towards our OpenAPI documentation.

Similar to commit d62b75fc.
2019-08-05 21:06:19 -07:00
Rishi Gupta
08c2cc5883 help: Add external account to add-custom-profile-fields. 2019-08-05 20:59:47 -07:00
Rishi Gupta
2c80224e2d custom profile: Rename check_url_pattern.
validator.py has validators for the whole project, so we need a more
specific name.
2019-08-05 20:59:47 -07:00
Rishi Gupta
b37c6a8644 custom profile: Update a few error messages. 2019-08-05 20:59:47 -07:00
Rishi Gupta
a0ebd9276d portico: Fix bug with .warn on /integrations.
Was causing an extra 10px of margin-top on .warn.

In general styles applied to .tip and .keyboard-tip should also be applied
to .warn.
2019-08-05 17:33:05 -07:00
Rishi Gupta
0c94f27f13 help: Update docs for email integration.
Also fixes a CSS bug where some styling was incorrectly being applied to
.tip and .keyboard-tip but not .warn.
2019-08-05 17:33:05 -07:00
Rishi Gupta
8167b5b645 email: Remove special integration doc behavior when gateway not set.
The current code looks like it's trying to redirect /integrations/doc/email
to /integrations when EMAIL_GATEWAY_PATTERN is not set.

I think it doesn't currently do this. The test for that pathway has a bug:
self.get_doc('integrations/doc-html/email', subdomain='zulip') needs a
leading slash, and putting the slash back in results in the test failing.

This redirection is not really desired behavior -- better is to
unconditionally show that the email integration exists, and just point the
user to https://zulip.readthedocs.io/en/latest/production/email-gateway.html
(this is done in a child commit).
2019-08-05 17:33:05 -07:00
Anders Kaseorg
68dd8e4ec8 mypy: Migrate from mypy_extensions to typing_extensions.
This gives us access to typing_extensions.Deque, which was not added
to typing until 3.5.4.

(PROVISION_VERSION is not bumped because the transitive dependency set
in dev.txt hasn’t changed.)

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-05 17:24:09 -07:00
Anders Kaseorg
86a7fdddd7 events: Check last_event_id for validity, take 2.
This verifies that the client passed a last_event_id that actually
came from the queue instead of making up an ID from the future.  It
turns out one of our tests was making up such an ID, but legitimate
clients are expected not to do so.

The previous version of this commit (commit
e00d4be6d5, #12888) had to be reverted
(commit b86c5cc490) because it was
missing the `to_dict`/`from_dict` migration code.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-05 17:18:49 -07:00
Tim Abbott
441bb844d2 models: Improve comments about get_user_profile_by_*_email.
This should help avoid folks accidentally using methods they should
not.
2019-08-05 17:10:58 -07:00
Tim Abbott
ba67a9b76a message: Use RawUnreadMessageResult typing more.
This is a cleaner implementation given we have the TypedDict defined.
2019-08-02 17:34:27 -07:00
Tim Abbott
8f7a86f5ec events: Move remove_message_id_from_unread_mgs to message.py.
It belongs there, next to the related code for adding an event.
2019-08-02 17:26:13 -07:00
Tim Abbott
2c7511023d events: Simplify arguments for remove_message_id_from_unread_mgs.
This should make it reusable by the event_queue.py code path.
2019-08-02 17:26:13 -07:00
Rishi Gupta
bc220aefdf help: Document topic links. 2019-08-02 16:33:27 -07:00
Rishi Gupta
3fbd0026a4 compose: Update topic list tip_text.
It was a bit confusing to have this appear even after you typed `>`.

Also, removed the word "mention", since mention has a specific meaning in
Zulip.
2019-08-02 16:33:27 -07:00
Pragati Agrawal
5b324e50ca users: Apply email_address_visibility policy on the users list.
In the emails-hidden case, for non-admins, we should remove the email
field from "Users" list in the organization settings page.

Tweaked by tabbott to correctly handle the bots and deactivated users pages.
2019-08-02 15:28:36 -07:00
Pragati Agrawal
ac2f1cea9c settings_org: Enhance show_emails for admins only case too.
This adds on the `is_admin` clause to show_emails.
2019-08-02 15:20:55 -07:00
Rohitt Vashishtha
a7f2bedb15 markdown: Enable hashheadings syntax.
Our implementation requires at least 1 space after the
'#' not not break existing linkifiers like '#123', etc.
that generally follow the convention we show in linkifier
examples.

- [valid]  : # Hello
- [valid]  : #  Hello
- [invalid]: #Hello

For the frontend, we have taken the code from v0.7.0 of
upstream marked and made minor changes to avoid having
to refactor a significant part of our marked code.

For the backend, we merely have to change the regex to
force require spaces after #, and add hashheader to our
list of blockparsers.

Fixes #11418.
2019-08-02 15:15:34 -07:00
Mateusz Mandera
d8ee11d849 requirements: Add 'decorator' dependency.
We already had this as an indirect dependency, but now it's going to be
needed to write a decorator for rate limiting authenticate() functions,
so it should be added to common.in.
2019-08-02 15:03:00 -07:00
Tim Abbott
b86c5cc490 Revert "events: Check last_event_id for validity."
This isn't correct without a proper migration for existing queues,
which may not be implementable.

This reverts commit e00d4be6d5.
2019-08-02 14:44:35 -07:00
Tim Abbott
2738e909f8 event_queue: Expand testing of event queue save/restore.
This verifies that every valid state of our event queue system will be
properly save/restored via the from_dict methods.
2019-08-02 14:43:47 -07:00
Tim Abbott
3a6e5dad53 tests: Move EventQueueTest to test_event_queue.py.
This seems more appropriate, especially as we expand this library.
2019-08-02 14:43:12 -07:00
Tim Abbott
8be3df0e29 tornado: Fix bugs in Tornado autoreload library.
This fixes two issues:

* The syntax check logic we had for zerver.tornado.autoreload would
  end up clearing _reload_hooks if one of the files that had changed
  was zerver.tornado.autoreload itself (because we'd had re-imported
  the current module), which could be incredibly confusing when trying
  to test the autoreload logic.  It seems better to just not run the
  syntax check for syntax errors in this file.

  Similarly, because reloading event_queue.py would destroy the state
  in the queues, we avoid that as well.

* We make sure to flush stdout after running and reload hooks, to make
  sure their output reaches the user.
2019-08-02 12:47:49 -07:00
Tim Abbott
a43b2f7a43 tornado: Fix incorrect import of autoreload library.
We were apparently not running our own forked Tornado autoreload
library when adding reload hooks, which meant that our autoreload
hooks didn't run at all.

This fixes an issue that made dump_event_queues never run and thus the
local development environment difficult to use for testing event queues.
2019-08-02 12:47:49 -07:00
Vishnu KS
216403768d emails: Remove body tag from email_base_message.
Presence of body tag in missed_message results in
gmail not hiding footer in mobile app.
2019-08-02 13:54:32 +05:30
Tim Abbott
e807041bda compose_ui: Fix double escaping of compose placeholder text.
This fixes an issue where we were accidentally double-escaping the
compose placeholder text if it contained HTML entities; once in
`i18n.t` and again when inserting it into the `placeholder` DOM via
`.attr`.
2019-08-01 12:59:07 -07:00
Tim Abbott
22a85b0e1e zjsunit: Add support for using i18n without escaping.
This adds support for the `- __foo__` syntax supported by i18n.t.
2019-08-01 12:58:11 -07:00
Wyatt Hoodes
e6ae160a0c mypy: Run --warn-unreachable by default. 2019-07-31 16:18:24 -07:00
Wyatt Hoodes
f80402c64d tools: Use mypy_extensions for NoReturn.
This is the right way to access it with support for older Python
versions where it might not be in typing yet.
2019-07-31 16:18:24 -07:00
Mateusz Mandera
d3d62f99e4 tests: Adjust to new changes in populate_db. 2019-07-31 16:01:37 -07:00
Mateusz Mandera
9b2b24c617 production: Rename the 'zulip' system bot realm to 'zulipinternal'. 2019-07-31 16:01:36 -07:00
Mateusz Mandera
8e0b6fa6cf populate_db: Use separate realm for system bots, like in production.
This commit alone breaks things, needs to be merged with the follow-up
ones.

welcome-bot is removed from the explicit list, because it already is in
settings.INTERNAL_BOTS.
2019-07-31 15:58:39 -07:00
Rohitt Vashishtha
bb46bc099b typeahead: Show header text for some mentions.
Show help text when completing stream, topic, mention and silent_mention.
2019-07-31 15:36:15 -07:00
Rohitt Vashishtha
6c34d99ad0 typeahead: Add header text to show info about current completion.
We can provide a function that returns an HTML string: `this.header()` to
display a header text above the typeahead. This can be used to provide
contextual information such as hinting about the silent mentions syntax
or the topic mentions syntax.

At the end of this commit, the HTML structure is:

$container <div>
  $header <p>
    info-icon
    header-text
  $menu <ul>
    list-items
2019-07-31 15:33:27 -07:00
Rohitt Vashishtha
b071270788 typeahead: Add a container div for the typeahead list.
This change allows us to add custom changes to the HTML generated
by the typeahead without interfering with the core functions that
are provided by the library.

At the end of this commit, the HTML structure is:

$container <div>
  $menu <ul>
    list-items
2019-07-31 15:33:27 -07:00
Tim Abbott
e1d9fe84ad clubhouse: Type payload as Optional.
Apparently if you post json.dumps(None), one will end up with this
None case being possible.
2019-07-31 15:31:57 -07:00
Tim Abbott
78df15ef08 Revert "clubhouse: Remove dead code."
This reverts commit 48ea427e87.
2019-07-31 15:31:57 -07:00
Wyatt Hoodes
b005c7567a messages: Fix typing errors.
We remove a redundant term conversion test, as well as
add appropriate typing for the `anchor` variable in
`get_messages_backend`.
2019-07-31 12:42:29 -07:00
Tim Abbott
48ea427e87 clubhouse: Remove dead code. 2019-07-31 12:40:01 -07:00
Tim Abbott
9599d311a5 logging_util: Add an extra type: ignore. 2019-07-31 12:40:01 -07:00
Wyatt Hoodes
c787f0a550 webhooks/jira: Fix useless check for subject being None.
This wasn't possible since a recent rewrite of the webhook code.
2019-07-31 12:27:04 -07:00
Tim Abbott
acd52be820 pivotal: Remove useless conditionals.
It isn't actually possible for these values to be None.
2019-07-31 12:26:21 -07:00
Wyatt Hoodes
b807c4273e middleware: Fix exception typing.
Mypy seems to have trouble understanding `Exception` inheritance
here, so we create a `Union` for the only `Exception` we are
looking for.
2019-07-31 12:23:20 -07:00
Wyatt Hoodes
167d0bad61 test_runner: Unionize suite type.
Mypy cannot see the class hierarchy pertaining to django's
ParallelTestSuite. To deal with this, we simply create a
`Union` of our two types.
2019-07-31 12:20:12 -07:00
Wyatt Hoodes
4beec5c6b9 typing: Use TYPE_CHECKING when dealing with cyclic dependencies. 2019-07-31 12:19:39 -07:00
Wyatt Hoodes
97c10b35c2 analytics/views: Remove redundant check of if end is None. 2019-07-31 12:15:57 -07:00
Wyatt Hoodes
fa227d79af typing: Fix options typing in management/commands.
We simply state that certain options are `Optional`.

The following files are affected:

add_users_to_mailing_list
send_to_email_mirror
fill_memcached_caches
client_activity
2019-07-31 12:13:56 -07:00
Wyatt Hoodes
457842ccd6 add_users_to_mailing_list: Prepare for using Optional typing.
When typing `**options` as an `Optional[str]` we will see errors
in the from of `None type has no attribute 'split'`.  This change
allows mypy to effectively handle the `None` case.
2019-07-31 12:13:56 -07:00
Tim Abbott
38ffde37e5 css: Move edit history highlighting CSS into rendered_markdown. 2019-07-31 12:08:17 -07:00
Tim Abbott
28fc159d24 css: Move more embed CSS into rendered_markdown. 2019-07-31 12:08:17 -07:00
Tim Abbott
4fbc74bb0b css: Delete custom CSS for message-edit-history.
This logic effectively badly duplicated the existing rendered_markdown
CSS.
2019-07-31 12:08:17 -07:00
Tim Abbott
ba66dfe977 css: Scope KaTeX CSS inside rendered_markdown.
This is entirely for readability.
2019-07-31 12:08:17 -07:00
Tim Abbott
5b732437c1 css: Scope mentions and alert words in rendered_markdown. 2019-07-31 12:08:17 -07:00
Tim Abbott
97b256d1f0 css: Extract rendered_markdown.scss.
This moves our main CSS for rendered Zulip message content into an
external file, which may be reusable but in any case should make it
easier to find this content.
2019-07-31 12:08:17 -07:00
YashRE42
7a6f4630dc compose_box: Prepopulate stream if possible.
When users are only subbed to a single stream, this autofills the stream
field of the compose box.
Fixes #12507.
2019-07-31 10:20:24 -07:00
Tim Abbott
997fd714d1 openapi: Fix some errors caught by online editor.
This fixes several values that had invalid types recorded.
2019-07-30 16:36:50 -07:00
Tim Abbott
782cb2e13c openapi: Remove duplicate announce section. 2019-07-30 15:08:59 -07:00
Tim Abbott
9827801569 slack import: Improve readability of user recipient object allocation.
This loop management tweak makes it a bit more obvious what's
happening in this block of code.
2019-07-30 14:46:14 -07:00
Vishnu KS
ff3871fc63 slack_import: Clean up return values of channels_to_zerver_stream.
This commits reduces the number of values returned by
channel_to_zerver_stream function by setting the values
directly in realm dict and returning it instead.
2019-07-30 14:46:14 -07:00
Vishnu Ks
6110f495df slack_import: Support importing pms. 2019-07-30 14:46:14 -07:00
Tim Abbott
fac886ce05 Revert "compose: Fix cursor placement timing bug when selecting a typeahead."
This reverts commit 76e50af78e.

Empirically, this caused weird issues with the cursor jumping around,
so more investigation is required into the right way to fix it.
2019-07-29 18:05:46 -07:00
Tim Abbott
8c9dd6198f api docs: Use Help Center syntax for restricted endpoints. 2019-07-29 16:17:54 -07:00
Hemanth V. Alluri
c85640d6b1 docs: Fix cURL example in get-user-groups.md.
The issue here was that the endpoint was documented as being
contactable by bots when in reality we have a require_member_or_admin
decorator on the endpoint. So bots and guests cannot contact it.
2019-07-29 16:09:11 -07:00
Hemanth V. Alluri
b2a3d289b0 docs: Fix cURL example in get-stream-id.md by adding a missing '\'. 2019-07-29 16:07:58 -07:00
Hemanth V. Alluri
e9cc69297f docs: Fix cURL example in get-stream-id.md by using the -G argument. 2019-07-29 16:07:58 -07:00
Hemanth V. Alluri
12dce4b940 api_docs/get-messages: Fix the cURL example.
The issue with the previous example was that it sent the data as
POST variables. This corrected example appropriately encodes data
(with URL encoding) and sends it as GET variables.
2019-07-29 16:07:01 -07:00
Vinit Singh
03180752db compose: Update placeholder text depending on the narrow.
Change the `compose-textarea` placeholder text depending on the
stream/topic or PM recipients that the message will be sent to.

Resolves #12834.
2019-07-29 15:51:50 -07:00
Mateusz Mandera
8f6f78b912 requirements: Upgrade redis from 2.10.6 to 3.2.1.
Fixes #11209.

This requires changing how zadd is used in rate_limiter.py:
In redis-py >= 3.0 the pairs to ZADD need to be passed as a dictionary,
not as *args or **kwargs, as described at
https://pypi.org/project/redis/3.2.1/ in the section
"Upgrading from redis-py 2.X to 3.0".

The rate_limiter change has to be in one commit with the redis upgrade,
because the dict format is not supported before redis-py 3.0.
2019-07-29 15:34:05 -07:00
Wyatt Hoodes
ecb1b1a1e1 openapi: Fix typing for self.data. 2019-07-29 15:24:51 -07:00
Wyatt Hoodes
45e37d16c3 corporate/views: Fix typing errors. 2019-07-29 15:23:52 -07:00
Wyatt Hoodes
b01ba48369 migration_0060: Remove unreachable return statement.
This was introduced in a past refactoring.
2019-07-29 15:23:34 -07:00
Wyatt Hoodes
f22b2c7e9d archive: Fix typing for prev_sender variable.
We know that via the `AbstractMessage` class that `sender`
is of the type `UserProfile`.  We type this as `Optional`
to tell mypy that the operands to the right of the first
`or` can indeed be evaluated within the following `for` loop.
2019-07-29 15:23:10 -07:00
Wyatt Hoodes
99bd55917e zephyr: Fix typing for cred parameter. 2019-07-29 15:23:10 -07:00
Wyatt Hoodes
0834514668 auth: Fix typing for authenticate_remote_user. 2019-07-29 15:23:10 -07:00
Wyatt Hoodes
4149bac696 actions: Fix typing of query_filter. 2019-07-29 15:23:10 -07:00
Wyatt Hoodes
1706e06884 bugdown/init: Fix typing for fence variable. 2019-07-29 15:23:10 -07:00
Wyatt Hoodes
22481f63bf upload: Fix typing for key variable. 2019-07-29 15:23:10 -07:00
Wyatt Hoodes
a75abe096b migration_0064: Fix typing for file_key. 2019-07-29 15:23:10 -07:00
Wyatt Hoodes
e106f95c8b migration_0064: Remove usage of Text type. 2019-07-29 15:23:10 -07:00
Wyatt Hoodes
8107230b35 domains: Fix typing for validate_domain. 2019-07-29 15:18:24 -07:00
Wyatt Hoodes
a109508e34 typing: Remove now-unnecessary conditional import.
As a result of dropping support for trusty, we can remove our old
pattern of putting `if False` before importing the typing module,
which was essential for Python 3.4 support, but not required and maybe
harmful on newer versions.

cron_file_helper
check_rabbitmq_consumers
hash_reqs
check_zephyr_mirror
check_personal_zephyr_mirrors
check_cron_file
zulip_tools
check_postgres_replication_lag
api_test_helpers
purge-old-deployments
setup_venv
node_cache
clean_venv_cache
clean_node_cache
clean_emoji_cache
pg_backup_and_purge
restore-backup
generate_secrets
zulip-ec2-configure-interfaces
diagnose
check_user_zephyr_mirror_liveness
2019-07-29 15:18:22 -07:00
Yashashvi Dave
865a7204f9 custom fields: Set generic click handler on remove_date buttons.
This commit adds click handler on date type custom profile
fields on field initialization itself.
This commit also fixes the bug in date type fields in user
profile in org settings.
2019-07-29 15:06:35 -07:00
Yashashvi Dave
b93ca2fc50 custom fields: Hide remove_date button for none value date fields.
This commit adds a click handler on datepicker custom profile
fields, which hides the `remove_date` button if the field value
is not set.

Fixes part of #11453
2019-07-29 15:06:35 -07:00
Yashashvi Dave
2e8cf6984e user settings: Fix click handler errors on datepicker profile field.
On change value click handlers on user profile fields in user settings
were also initialized on profile fields in org settings -> users
section. In org settings -> users, we do not need on change value
click handlers.
This commit fixes above issue by setting up handlers only on
user settings page.
2019-07-29 15:06:35 -07:00
Yashashvi Dave
440975e369 org settings: Fix background color in custom user profile datepicker field.
Fixes part of #11453
2019-07-29 15:06:35 -07:00
Anders Kaseorg
b758ed5ac1 nginx: Remove invalid extra headers for OPTIONS /api/v1/events.
Since 204 responses don’t contain a payload body, Content-Type is
neither required nor encouraged (RFC 7231 §3.1.1.5), and ours was
missing a semicolon to boot; Content-Length is expressly
forbidden (RFC 7230 §3.3.2).

Furthermore, these add_header directives were silencing the CORS
headers set in api_headers, because add_header inheritance doesn’t
work the way you think it does, as was known before commit
5614d51afc.

Fixes: #12902.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-29 14:58:35 -07:00
Tim Abbott
934d7c2f0f docs: Fix development version warning.
This was sadly broken by the comment Greg added to document how it
works :(.
2019-07-26 17:29:21 -07:00
Anders Kaseorg
e00d4be6d5 events: Check last_event_id for validity.
This verifies that the client passed a last_event_id that actually
came from the queue instead of making up an ID from the future.  It
turns out one of our tests was making up such an ID, but legitimate
clients are expected not to do so.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-26 17:18:28 -07:00
Wyatt Hoodes
bbbea9ec87 events: Rewrite system for managing realm exports.
This feature is intended to cover all of our ways of exporting a
realm, not just the initial "public export" feature, so we should name
things appropriately for that goal.

Additionally, we don't want to include data exports in page_params;
the original implementation was actually buggy and would have.
2019-07-26 16:38:52 -07:00
Wyatt Hoodes
b1900c406a public_export: Add logic for deleting the export tarball.
The path to the uploaded tarball is reconstructed via the relative url and
removed with the canonical methods in `upload.py`.
2019-07-26 15:52:03 -07:00
Wyatt Hoodes
ef02de4834 public_export: Add endpoint for returning all REALM_EXPORTED objects. 2019-07-26 15:52:02 -07:00
Wyatt Hoodes
d070f27359 queue_processors: Change the extra_data field to a relative url path.
A better approach as compared to saving the full public url.
2019-07-26 15:50:02 -07:00
Wyatt Hoodes
266ed9ff75 public_export: Add acting_user to RealmAuditLog object.
An acting_user attribute is required to correctly reference who
initiated a realm_exported event.
2019-07-26 15:49:47 -07:00
Tim Abbott
1a7fd33ddb webhooks: Fix typo in a trello error message. 2019-07-26 15:12:45 -07:00
Hemanth V. Alluri
ede73ee4cd streams: New stream messages should be auto marked as read by creator.
When a person creates a new realm, they'll likely want to create a
bunch of initial streams at once. When doing so, it could be annoying
to have to mark all of the new stream notification messages as read.

Thus to make this process smoother, we should automatically mark
the messages generated by the Notification Bot in the notifications
(announcements) stream, as well as in the newly created stream itself
as read by the stream creator.

Fixes #12765.
2019-07-26 15:10:09 -07:00
Hemanth V. Alluri
3528c454c0 openapi: Update tests to ensure that request parameter types match.
This commit add an pretty elaborate extension to the existing
openapi documentation validation test: test_openapi_arguments.

This does a metacode analysis, comparing the openapi documentation
with the appropriate function's declaration, default values etc.

While it has some limitations, it is able to catch various common
classes of mistakes in the types declared for our OpenAPI
documentation.
2019-07-26 12:49:59 -07:00
Tim Abbott
866b3566d4 api: Fix OpenAPI type declarations for events_register.
A few fields that are actually arrays were incorrectly declared as
strings.
2019-07-26 12:31:53 -07:00
Aman
2183a74040 zulint: Use zulint from the extracted repository.
zulint will be added as a "third-party" dependency in zulip from now
on.  See the new project at https://github.com/zulip/zulint for more
details.
2019-07-26 11:35:43 -07:00
Vishnu Ks
618d026941 version: Bump PROVISION_VERSION for py packages upgrade. 2019-07-26 10:57:31 -07:00
Vishnu Ks
b602cbbb82 requirements: Upgrade defusedxml from 0.5.0 to 0.6.0. 2019-07-26 10:57:31 -07:00
Vishnu Ks
cb8b935ee8 requirements: Upgrade certifi from 2019.3.9 to 2019.6.16. 2019-07-26 10:57:31 -07:00
Vishnu Ks
628030b742 requirements: Upgrade wheel from 0.33.1 to 0.33.4. 2019-07-26 10:57:31 -07:00
Vishnu Ks
0b9b9e5673 requirements: Upgrade pip from 19.1 to 19.2.1. 2019-07-26 10:57:31 -07:00
Vishnu Ks
3ebffe06bf requirements: Upgrade tblib from 1.3.2 to 1.4.0. 2019-07-26 10:57:31 -07:00
Vishnu Ks
096244a783 requirements: Upgrade snakeviz from 2.0.0 to 2.0.1. 2019-07-26 10:57:31 -07:00
Vishnu Ks
5c4fcf809a requirements: Upgrade Scrapy from 1.6.0 to 1.7.2. 2019-07-26 10:57:31 -07:00
Vishnu Ks
f6791b30af requirements: Upgrade moto from 1.3.7 to 1.3.13. 2019-07-26 10:57:31 -07:00
Vishnu Ks
dccb41fa47 requirements: Upgrade isort from 4.3.17 to 4.3.21. 2019-07-26 10:57:31 -07:00
Vishnu Ks
4f6d6ff9e1 requirements: Upgrade gitlint from 0.11.0 to 0.12.0. 2019-07-26 10:57:31 -07:00
Vishnu Ks
9487539930 requirements: Upgrade twilio from 6.26.2 to 6.29.2. 2019-07-26 10:57:31 -07:00
Vishnu Ks
2ed41095d6 requirements: Upgrade SQLAlchemy from 1.3.3 to 1.3.6. 2019-07-26 10:57:31 -07:00
Vishnu Ks
65457441f3 requirements: Upgrade Pygments from 2.3.1 to 2.4.2. 2019-07-26 10:57:31 -07:00
Vishnu Ks
7531afa9a4 requirements: Upgrade psycopg2 from 2.8.2 to 2.8.3. 2019-07-26 10:57:31 -07:00
Vishnu Ks
f3eb7a8aa9 requirements: Upgrade premailer from 3.4.0 to 3.5.0. 2019-07-26 10:57:31 -07:00
Vishnu Ks
43c8d915d8 requirements: Upgrade phonenumberslite from 8.10.12 to 8.10.15. 2019-07-26 10:57:31 -07:00
Vishnu Ks
5871a81ba0 requirements: Upgrade mock from 2.0.0 to 3.0.5. 2019-07-26 10:57:31 -07:00
Vishnu Ks
b2bab27afe requirements: Upgrade lxml from 4.3.3 to 4.3.4. 2019-07-26 10:57:31 -07:00
Vishnu Ks
e9920164e4 requirements: Upgrade ijson from 2.3 to 2.4. 2019-07-26 10:57:31 -07:00
Vishnu Ks
b57d90d7f2 requirements: Upgrade httplib2 from 0.12.3 to 0.13.0. 2019-07-26 10:57:31 -07:00
Vishnu Ks
da04697167 requirements: Upgrade django-two-factor-auth from 1.8.0 to 1.9.1. 2019-07-26 10:57:31 -07:00
Vishnu Ks
501b58c6e8 requirements: Upgrade django-bitfield from 1.9.5 to 1.9.6. 2019-07-26 10:57:31 -07:00
Vishnu Ks
5d40082fe0 requirements: Upgrade django-auth-ldap from 1.7.0 to 2.0.0. 2019-07-26 10:57:31 -07:00
Vishnu Ks
aaa056b150 requirements: Upgrade disposable-email-domains from 0.0.49 to 0.0.52. 2019-07-26 10:57:31 -07:00
Vishnu Ks
20a466a73f requirements: Upgrade beautifulsoup4 from 4.7.1 to 4.8.0. 2019-07-26 10:57:31 -07:00
Vishnu Ks
fb4db2c851 requirements: Upgrade apns2 from 0.4.1 to 0.5.0. 2019-07-26 10:57:31 -07:00
Anders Kaseorg
29c5b63e64 css: Fix .message_top_line stealing mouse events from .message_edit_form.
This is a replacement for the workaround removed by commit
2273608477.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-25 17:55:34 -07:00
Wyatt Hoodes
b3323366b3 migration_0077: Migrate from Text to str.
In `force_str` we assume that python 2 strings should be
considered.  This is no longer the case, so we replace all
occurences of `Text` with `str`, and remove the unreachable
condition.

(Probably further cleanup is possible, but this code shouldn't be
modified again in any case).
2019-07-25 17:54:26 -07:00
Wyatt Hoodes
a920f0396d webpack: Comment why NoReturn can't import normally. 2019-07-25 17:48:33 -07:00
Wyatt Hoodes
927feb615e provision: Comment why NoReturn can't import normally. 2019-07-25 17:48:20 -07:00
Wyatt Hoodes
3060bb2208 requirements: Upgrade to mypy 0.720.
We also add the option of the newly added `--warn_unreachable`
flag.
2019-07-25 17:41:10 -07:00
Wyatt Hoodes
1c8106fc67 timezone: Fix return type in get_timezone.
While it's true `datetime` is implicit via `pytz`, it makes sense
that mypy should now complain about the semantics of calling our
return type `pytz.datetime.tzinfo`, when such a type doesn't
actually exist.
2019-07-25 17:41:01 -07:00
Wyatt Hoodes
55ad0d316a settings: Fix typing for LDAP_EMAIL_ATTR.
This is already defined in `prod_settings_template`.
2019-07-25 17:41:01 -07:00
Wyatt Hoodes
77068f3e1e settings: Fix typing for AUTHENTICATION_BACKENDS. 2019-07-25 17:41:01 -07:00
Tim Abbott
01bc2d9e00 docs: Update changelog since last release. 2019-07-25 17:20:57 -07:00
Anders Kaseorg
f0e0fe1c15 ui.get_scroll_element: Set up SimpleBar if it’s expected but missing.
Although SimpleBar automatically sets itself up on elements with a
`data-simplebar` attribute, sometimes we try to set event listeners
before that happens.  Create the SimpleBar early in that case.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-25 16:18:54 -07:00
Hemanth V. Alluri
48526b1fd6 webhooks: Fix small bug in the fixture_to_headers method of bitbucket3.
We should return an empty dictionary instead of None.
2019-07-25 16:14:14 -07:00
Vaibhav
2fd0753d22 reactions_button: Remove title from reaction button in controls.
Since the button already has a tooltip, we can remove the title.
2019-07-25 16:13:19 -07:00
Anders Kaseorg
a32663dc85 lint: Do not forbid ES6 const.
Our pipeline was upgraded in commit
f54a63e2f9 (#12838).

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-25 16:12:48 -07:00
Alexandra Ciobica
13bdc655c9 css: Fix ols on integrations.
Apparently, the 30px width we allocated to the bullets was
insufficient with the larger font size there.

Edit by tabbott: better to just increase it to 32px everywhere.
2019-07-25 15:08:07 -07:00
Alexandra Ciobica
8b78eca759 portico: Fix the history photo description.
The `overflow: auto;` from the `.markdown` class hides the description
of the picture. I moved the description outside the div with the
`markdown` class.
2019-07-25 15:04:09 -07:00
Alexandra Ciobica
999209020f portico: Move code-section rules to markdown.scss.
`code-section` is a feature of the markdown system, therefore the
associated CSS should be in the `markdown.scss` file. I also refactored
to use SCSS nesting.
2019-07-25 15:04:09 -07:00
Alexandra Ciobica
8fef764960 css: Make help page height selector from 500px viewport more specific. 2019-07-25 15:04:09 -07:00
Alexandra Ciobica
428a5c0d26 css: Change font-size of markdown text on why-zulip and integrations. 2019-07-25 15:04:09 -07:00
Alexandra Ciobica
4e29721385 css: Remove duplicated css rules.
These rules are no longer needed after the addition of `.markdown` class
 on the `why-zulip` pages.
2019-07-25 15:04:09 -07:00
Alexandra Ciobica
295cbc8535 css: Refactor markdown.scss to use SCSS nesting. 2019-07-25 15:04:09 -07:00
Alexandra Ciobica
7a22111601 css: Move markdown CSS into separate file. 2019-07-25 15:04:09 -07:00
Alexandra Ciobica
d2466e15cb css: Remove duplicated integrations selectors and fix styling.
I added the `@media (max-width: 500px)` because the text from the inner
content was gong outside the white background on mobile because of the
height of the `.markdown` class for this viewport.

I moved this `.integration-instructions .help-content h3 { margin: 20px
0 ; }` from the `portico.scss` because it should be in `integrations
.scss`.

I removed the `#hubot-integrations` because I didn't find that id
anywhere.

I removed `.portico-landing.integrations ol ul` because `.markdown`
takes care of that left spacing.
2019-07-25 15:04:09 -07:00
Alexandra Ciobica
85f6c7e638 portico: Add .markdown class to integrations page.
This addition was made so I can deduplicate the selectors like this one:
 `.markdown ol > li, .portico-landing.integrations ol > li `and move the
  `.markdown` CSS in another file (in a further commit).
2019-07-25 15:04:09 -07:00
Alexandra Ciobica
93c98e6d9a css: Remove duplicated selectors from why-zulip. 2019-07-25 15:04:09 -07:00
Alexandra Ciobica
62a1e988f7 portico: Add .markdown class to why-zulip pages. 2019-07-25 15:04:09 -07:00
Rohitt Vashishtha
76e50af78e compose: Fix cursor placement timing bug when selecting a typeahead.
When you press enter on a typeahead and start typing, your cursor is
placed at the end of the textbox, whereas we want it to be placed at
the end of the typeahead immediately. This causes some characters to
appear at the end of the message before you again get to typing from
where you left off.

To fix, we use the change event triggered on typeahead completion to
reposition the cursor instead of using a setTimeout().

Fixes #12621.
2019-07-25 15:01:24 -07:00
Yashashvi Dave
3f28f4a9f5 static/templates/stream_settings_checkbox: Simplify handlebar logic.
Fixes #12801
2019-07-25 14:56:12 -07:00
Yashashvi Dave
307ef2e96d static/templates/emoji_popover_emoji: Fix typo. 2019-07-25 14:56:12 -07:00
Rohitt Vashishtha
4f03d82ff0 compose: Do not trigger topic mention if already completed. 2019-07-25 14:53:43 -07:00
Vinit Singh
f25f83cc66 docs: Fix a typo in security documentation. 2019-07-25 14:53:08 -07:00
Vaibhav
6bd6b846a5 css: Reorder subscriptions.scss so .large-icon are in same place. 2019-07-25 14:44:58 -07:00
Vaibhav
36b78b034b css: Remove redundant rules from .large-icon.hash. 2019-07-25 14:44:58 -07:00
Vaibhav
350bcbea80 css: Use SCSS nesting for #subscriptions_overlay. 2019-07-25 14:44:58 -07:00
Vaibhav
86bff0c3ce css: Nest elements inside #subscription_overlay. 2019-07-25 14:44:58 -07:00
Vaibhav
37f70adeb6 css: Use SCSS nesting for .editable-section. 2019-07-25 14:44:58 -07:00
Vaibhav
4c70a23d43 css: Nest #stream_creation_form inside #stream-creation. 2019-07-25 14:44:58 -07:00
Vaibhav
4886f3b8f0 css: Use SCSS nesting for #stream_creation_form. 2019-07-25 14:44:58 -07:00
Vaibhav
dd6494343a css: Use SCSS nesting for #stream-creation. 2019-07-25 14:44:58 -07:00
Vaibhav
bd7fc23d30 css: Nest elements inside #subscription_overlay #stream_creation. 2019-07-25 14:44:58 -07:00
Vaibhav
4fc3878b00 css: Use SCSS nesting for .stream-creation-body. 2019-07-25 14:44:58 -07:00
Vaibhav
6a840e39f6 css: Nest #announce-new-stream inside .stream-creation-body. 2019-07-25 14:44:58 -07:00
Vaibhav
33bc11980d css: Use SCSS nesting for .create_stream_button. 2019-07-25 14:44:58 -07:00
Anders Kaseorg
0bcae0be55 write_log_line: Fix logging of 4xx error data.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-25 14:42:52 -07:00
Yashashvi Dave
e55afc2629 user settings: Update alert message element in change-full-name modal. 2019-07-25 13:33:44 -07:00
Yashashvi Dave
e1dacb99df user settings: Update alert message element in change-email modal. 2019-07-25 13:33:44 -07:00
Yashashvi Dave
b3b480709d user settings: Update alert-msg-elem in change password modal. 2019-07-25 13:33:44 -07:00
Yashashvi Dave
4860904284 user setting: Update user display message for setting change-email. 2019-07-25 13:33:44 -07:00
Yashashvi Dave
916a84ce20 overlays: Remove all alert notifications from in open_modal func.
We should not display any alert previous notification on
open_modal() functions.
2019-07-25 13:33:44 -07:00
Yashashvi Dave
5506b16fa8 user settings: Add separate alert-save widget for profile custom fields.
Fixes part of #12748
2019-07-25 13:33:44 -07:00
Yashashvi Dave
3c16b73fcd account settings: Simplify handlebars conditional logics.
This commit simplifies complex handlebars conditional
logic for account settings tooltips and fields.
2019-07-25 13:33:44 -07:00
Tim Abbott
b8a1050fc4 rest: Disable caching for all REST API endpoints.
Investigation into #12876, a mysterious bug where users were seeing
messages reappear as unread, determined that the root cause was
missing headers to disable client-side caching for Zulip's REST API
endpoints.

This manifested, in particular, for `GET /messages`, which is
essentially the only API GET endpoint used by the webapp at all.  When
using the `Ctrl+Shift+T` feature of browsers to restore a recently
closed tab (and potentially other code paths), the browser would
return from its disk cache a cached copy of the GET /messages results.

Because we include message flags on messages fetched from the server,
this in particular meant that those tabs would get a stale version of
the unread flag for the batches of the most recent ~1200 messages that
Zulip fetches upon opening a new browser tab.

The issue took same care to reproduce as well, in large part because
the arguments to those initial GET /messages requests will vary as one
reads messages (because the `pointer` moves forward) and then enters
the "All messages" view; the disk cache is only used for GET requests
with the exact same URL parameters.

We will probably still want to merge the events error-handling changes
we had previously proposed for this, but the conclusion of this being
a straightforward case of missing cache-control headers is much more
satisfying than the "badly behaving Chrome" theory discussed in the
issue thread.

Fixes #12876.
2019-07-25 12:42:46 -07:00
Anders Kaseorg
6d5a20ac62 requirements: Remove django-pipeline.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-24 17:40:31 -07:00
Anders Kaseorg
2b33822de9 storage: Stop using django-pipeline.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-24 17:40:31 -07:00
Anders Kaseorg
fd7803e7f4 settings: Unset STATIC_ROOT in development.
Django’s default FileSystemFinder disallows STATICFILES_DIRS from
containing STATIC_ROOT (by raising an ImproperlyConfigured exception),
because STATIC_ROOT is supposed to be the result of collecting all the
static files in the project, not one of the potentially many sources
of static files.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-24 17:40:31 -07:00
Anders Kaseorg
a97a2612bb integrations: Get logo URLs from staticfiles.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-24 17:40:31 -07:00
Anders Kaseorg
88b29c64ad docs: Correct CircleCI job name typo.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-24 17:38:17 -07:00
Mateusz Mandera
1e107ef349 test_messages: Prepare for moving system bots to zulipinternal. 2019-07-24 16:44:16 -07:00
Mateusz Mandera
8c0e5c5fde test_push_notifs: Prepare for moving system bots to zulipinternal. 2019-07-24 16:44:16 -07:00
Mateusz Mandera
2e74d7b97f test_email_notifs: Prepare for moving system bots to zulipinternal. 2019-07-24 16:44:16 -07:00
Mateusz Mandera
6b20006aea test_bugdown: Prepare for moving system bots to zulipinternal. 2019-07-24 16:44:16 -07:00
Mateusz Mandera
a953240b5e test_subs: Prepare for moving system bots to zulipinternal. 2019-07-24 16:44:15 -07:00
Mateusz Mandera
0198736e77 test_upload: Prepare for moving system bots to zulipinternal. 2019-07-24 16:26:10 -07:00
Mateusz Mandera
b321dcd50b test_views: Prepare for moving system bots to zulipinternal. 2019-07-24 16:26:10 -07:00
Tim Abbott
c2bdccbaa8 provision: Use a shorter threshold for clean-unused-caches.
We've had a few reports of folks running out of disk when we're making
rapid changes to dependencies, and this should help prevent that.
2019-07-24 13:35:00 -07:00
Tim Abbott
daca742e9f email_gateway: Use html2text directly.
In the rare case that Zulip receives an email with only an HTML
format, we originally (code dating to 2013) shelled out to
html2markdown/python-html2text in order to convert the HTML into
markdown.

We long since added html2text as a reasonably managed Python
dependency of Zulip; we should just use it here.
2019-07-24 12:42:17 -07:00
Anders Kaseorg
2ac944c31f css: Remove message_hovered class.
This appears to have been dead for years.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-23 17:54:12 -07:00
Tim Abbott
05fdbd5224 settings: Fix typing for EXTERNAL_HOST.
The previous logic has a reassignment of EXTERNAL_HOST temporarily to
Optional[str], which we don't want.
2019-07-23 17:22:14 -07:00
Tim Abbott
2273608477 css: Fix buggy pointer-events behavior in message feed.
I noticed a super weird bug where the edit pencil would disappear on
hover inside the message feed (!).  Investigation determined that what
was actually happening was that the Drafts overlay had been shown and
then hidden at a time when the mouse cursor was over the icons with
`data-toggle="tooltip"` configured, and the tooltip showing.  The
result was that this tooltip object, if you mouse over it, would cause
us to no longer be hovering over the message (because your cursor was
actually over the invisible drafts widget's leaked tooltip).

Ideally, we'd have fixed this by making the drafts modal `display:
none`, but that would interfere with the modal's closing animation,
and there's no good way to have an event trigger on a CSS animation
finishing.

There's a second bug that makes this possible, however, which is that
the drafts modal is supposed to be `pointer-events: none` while
hidden, but some rogue CSS for `message_top_line *` set
`pointer-events: auto` to override `pointer-events: none` on
`message_top_line` was accidentally applying to things inside that
line in the drafts modal, and furthermore accidentally overriding the
`none` setting for the modal as a whole.

We fix that second bug here, which resolves the overall issue.
2019-07-23 17:22:14 -07:00
Anders Kaseorg
43c9a26afb setup_venvs: Use system python3.
Otherwise python3 will be perpetually copied from virtualenv to
virtualenv and will never receive updates from the system.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-23 16:33:04 -07:00
Anders Kaseorg
82828bdba4 HTML validation: Remove invalid <button href> attribute.
For .start-button, Bootstrap carousel already supports <button
data-target> as a valid alternative to <button href>.  For
.call-to-action, the margin is decreased to exactly offset the lack of
margin collapsing with display: inline-block.  There should be no
visual change.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-23 16:16:22 -07:00
Mateusz Mandera
bf919fd354 test_management_command: Prepare for moving system bots to zulipinternal. 2019-07-23 15:37:37 -07:00
Mateusz Mandera
0e3b7aab67 test_home: Prepare for moving system bots to zulipinternal. 2019-07-23 15:30:30 -07:00
Mateusz Mandera
11862e5ce0 test_classes: Use subdomain kwarg in api_* functions instead of realm.
It's more appropriate for the kwarg to be named subdomain. We also
update the functions, so that this kwarg is used in all of them
consistently.
2019-07-23 15:05:39 -07:00
Mateusz Mandera
7f24e27610 test_classes: Rename first argument of api_* functions to "identifier".
This was the name in api_post already - we rename it in the other
functions, for consistency.
2019-07-23 15:05:39 -07:00
Alexandra Ciobica
1c7db8eb9a css: Fix why-zulip images.
The addition of `.markdown` class added border and shadow on images,
which does not look good on the landing page.
2019-07-23 15:00:54 -07:00
Tej Pochiraju
cb10a3231c docs: Discuss outgoing email senders in email.md.
Outgoing email documentation should mention that the SMTP server needs
to allow emails originating from ZULIP_ADMINISTRATOR as well as the
noreply email addresses; previously, one would typically find this out
using the test tool, which was not ideal.

Substantially tweaked by tabbott for organization and content.
2019-07-23 11:25:57 -07:00
Rishi Gupta
3ffc174dcb settings: Update description for unread count setting. 2019-07-22 20:37:19 -07:00
Eeshan Garg
1579dc2fee webhooks/github: Add support for star events. 2019-07-22 18:20:53 -07:00
Eeshan Garg
badaf28f21 webhooks/github: Ignore 'meta' events.
This event occurs when its corresponding webhook is deleted. This
isn't very useful information, so we should ignore it.
2019-07-22 18:20:53 -07:00
Eeshan Garg
8e10ab282a webhooks: Log unexpected webhook events separately.
This change serves to declutter webhook-errors.log, which is
filled with too many UnexpectedWebhookEventType exceptions.

Keeping UnexpectedWebhookEventType in zerver/lib/webhooks/common.py
led to a cyclic import when we tried to import the exception in
zerver/decorators.py, so this commit also moves this exception to
another appropriate module. Note that our webhooks still import
this exception via zerver/lib/webhooks/common.py.
2019-07-22 18:20:53 -07:00
Conner Bondurant
4d4b6b8319 email: Convert send_email to use formataddr.
Changed the requirements for UserProfile in order to allow use of
the formataddr function in send_mail.py.

Converted send_email to use formataddr in conjunction with the commit
that strengthened requirements for full_name, such that they can now be
used in the to field of emails.

Fixes #4676.
2019-07-22 18:15:58 -07:00
Conner Bondurant
c25dcf048d models: Enforce stricter requirements on the full_name field.
This changes the requirements for UserProfile to disallow some
additional characters, with the overall goal of being able to use
formataddr in send_mail.py.

We don't need to be particularly careful in the database migration,
because user full_names are not required to be unique.
2019-07-22 18:13:34 -07:00
Anders Kaseorg
f54a63e2f9 webpack: Transpile JS code with Babel.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-22 17:55:32 -07:00
Anders Kaseorg
ecfb7c6a7f lint: Add TypeScript compiler as a linter.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-22 17:55:18 -07:00
Tim Abbott
40e8fd24ff portico: Enable default ToS for development environment. 2019-07-22 17:43:43 -07:00
Tim Abbott
47d80977ac plans: Make usable in the development environment for testing. 2019-07-22 17:43:43 -07:00
Cynthia Lin
8c55e27d1e night mode: Fix loss of border color on default style buttons. 2019-07-22 17:28:38 -07:00
Cynthia Lin
e37f529e6a portico: Add and use .button class for links requiring button styling.
Buttons cannot be nested in anchor links because that is invalid HTML.
To make links look like buttons, create a .button class that inherits
styling from buttons and apply them to the necessary links.

Fixes #6126.
2019-07-22 17:28:38 -07:00
Priyank Patel
e69c2f1aa2 notifications: Send message received from desktop app notification reply.
Adds a electron_bridge event that takes in message id and reply recived from
the notification reply and sends a message. We do this in webapp so desktop
doesn't have to depend on narrow and channel modules.

We also modify zjunit to reset window.electron_bridge after every run
to avoid leaking it.
2019-07-22 17:20:44 -07:00
neiljp (Neil Pilgrim)
ba7a0934e3 requirements: Upgrade mypy to 0.711.
This comes with it a big performance improvement; mypy is now only
barely our slowest linter even if it wasn't previously running.

Fixes: #12058
2019-07-22 17:12:50 -07:00
neiljp (Neil Pilgrim)
80a4504784 mypy: Clean up typing for CustomProfileField code. 2019-07-22 17:10:50 -07:00
Wyatt Hoodes
e4133e687f test_runner: Ignore inheritance issues in TestSuite.
Again, `result` of type `TestResult` is considered by mypy to
not have these _attributes acquired through inheritance. So,
we ignore them.
2019-07-22 17:06:41 -07:00
Wyatt Hoodes
5686821150 middleware: Change write_log_line to publish as a dict.
We were seeing errors when pubishing typical events in the form of
`Dict[str, Any]` as the expected type to be a `Union`.  So we instead
change the only non-dictionary call, to pass a dict instead of `str`.
2019-07-22 17:06:41 -07:00
Wyatt Hoodes
dd19e2df1b test_runner: Ignore self.stream in TextTestResult class.
Per the import line:

`from unittest import loader, runner  # type: ignore  # Mypy cannot pick
these up.`

Because `TextTestResult` inherits from `runner.TextTestResult`, mypy
doesn't see `self` as having an attribute `stream`, so we ignore these
instead of cluttering with `casts` or `isinstances`.
2019-07-22 16:45:21 -07:00
Tim Abbott
d3f59db8ce test_runner: Cleanup typing for TestResult objects.
There's two possible types here.
2019-07-22 16:45:21 -07:00
Wyatt Hoodes
76e8dc1657 test_runner: Change type to unittest.TestSuite.
In `deserialize_suite`, it passes a test as being of the
super type, where just having TestSuite assumes the type of
`zerver.Runner.TestSuite`.
2019-07-22 16:27:39 -07:00
Wyatt Hoodes
3509fe07b5 test_runner: Fix incorrect type for enforce_timely_test_completion.
Our TestResult objects are always actually TextTestResults.
2019-07-22 16:27:39 -07:00
Wyatt Hoodes
a2fa1a6f25 handlers: Remove duplicate type annotation.
`self._request_middleware` is already typed in the `__init__` method.
2019-07-22 16:27:39 -07:00
Wyatt Hoodes
97fbcf020f test_tornado: Remove duplicate type annotation.
`self.session_cookie` is already typed in the `setUp` method.
2019-07-22 16:27:39 -07:00
Tim Abbott
1b9a0367f2 settings: Fix indication for whether push notifications are enabled.
This was apparently broken in
981433d13c, which used an apparently
invalid partial syntax for doing lookups.
2019-07-22 16:14:13 -07:00
Mateusz Mandera
34b9a7bcad populate_db: Refactor and rename send_messages().
We rename the send_messages function to generate_and_messages, and
factor out the actual sending part of it into a separate function, which
now gets the name send_messages().
2019-07-22 15:56:17 -07:00
Mateusz Mandera
e5138c38b2 populate_db: Add a batching option. 2019-07-22 15:55:28 -07:00
Mateusz Mandera
d1bab42da6 populate_db: Send generated messages in one do_send_messages call.
Sending messages one-by-one is significantly slower compared to taking
advantage of the batch-handling code in do_send_messages, so we pass all
the messages to the function in one go. This is memory-hungry if there's
a lot of messages, so we will allow splitting into smaller batches in
the next commit.
2019-07-22 15:55:28 -07:00
Mateusz Mandera
a50524762c populate_db: Refactor message.pub_date generating code.
The code generating pub_dates for messages would fail to distribute them
across days if tot_messages was too large.
We refactor this code as a separate function (for clarity and to unit
test for the bug we're fixing), and change the structure and naming to a
form that more clearly describes what's happening. We also shift away
from the approach of all the float-to-int conversions as this is in
general tricky and bug prone - django's timedelta() handles floats as
arguments, so we take advantage of that.
2019-07-22 15:55:28 -07:00
Mateusz Mandera
be0a024355 integration docs: Document new email integration behaviors.
Tweaked by tabbott for cleaner, more precise English.
2019-07-22 15:52:08 -07:00
Hemanth V. Alluri
fecf6a529e webhooks: Migrate gitlab tests to the headers fixtures system.
We use the same approach as was used for the GitHub integration.
2019-07-22 12:12:50 -07:00
David Rosa
871fd57f5e docs: Fix minor issues in api.md.
With some tweaks for greater clarity by tabbott.
2019-07-22 12:07:50 -07:00
Tim Abbott
2eb855b302 puppet: Include . separator in email mirror rules.
This is required for the postfix-localmail integration to use the new
`.` format email addresses.
2019-07-22 11:13:36 -07:00
Anders Kaseorg
0310c3def4 css: Fix weird checkbox scrolling bug in Chrome.
This fixes a problem in Chrome where checking our styled checkboxes in
the stream creation form sometimes caused parts of the page to scroll
in weird ways or disappear.

The issue was that the hidden `position: absolute` checkboxes weren’t
scrolling with the `#stream-creation` scrollbar, which is `overflow:
auto`, not SimpleBar.  When you focused them, Chrome tried to scroll
them into view by whatever means necessary.  In this case, the
necessary means were to scroll the `.subscriptions-container`, which
is `overflow: hidden`.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-22 10:56:19 -07:00
Tim Abbott
02d55928ea import: Fix importing slack avatars into S3_UPLOAD_BACKEND.
Apparently, a subtle mismatch between the filename/URL formats for our
upload codebases meant that importing Slack avatars into systems using
S3_UPLOAD_BACKEND would end up with the avatars having the wrong URLs.
2019-07-21 21:25:31 -07:00
Harshit Bansal
bf14a0af4d auth: Migrate google auth to python-social-auth.
This replaces the two custom Google authentication backends originally
written in 2012 with using the shared python-social-auth codebase that
we already use for the GitHub authentication backend.  These are:

* GoogleMobileOauth2Backend, the ancient code path for mobile
  authentication last used by the EOL original Zulip Android app.

* The `finish_google_oauth2` code path in zerver/views/auth.py, which
  was the webapp (and modern mobile app) Google authentication code
  path.

This change doesn't fix any known bugs; its main benefit is that we
get to remove hundreds of lines of security-sensitive semi-duplicated
code, replacing it with a widely trusted, high quality third-party
library.
2019-07-21 20:51:34 -07:00
Rohitt Vashishtha
5fc37c5f9b compose: Add compose typeahead for stream+topic mentions.
We implement 3 changes:

1. Partial Stream Typeahead

   In addition to regular stream completion, we do partial completion
   of stream typeahead on pressing '>'. We use our custom addition to
   typeahead.js: this.trigger_selection to start topic_list typeahead.

   Implements: `#stream na|` (press >) => `#**stream name>|`.

2. Topic Jump Typeahead

   'topic_jump' typeahead moves the cursor from just ahead of a
   completed stream-mention to just after the end of the mention
   text and is triggered by typing '>' after the stream mention.
   This typeahead merely uses the regex matching and event hooks of
   the typeahead library instead of displaying any text completions.

   Implements: `#**stream name** >|` => `#**stream name>|`.

3. Topic List Typeahead

   'topic_list' typeahead shows the list of recent topics of a stream
   and if your current text doesn't match one of them, also shows you
   the current query text, allowing you to create mentions for topics
   that do not exist yet.

   Implements: `#**stream name>someth|` => `#**stream name>something** |`.

At the end of this commit, we support the following mechanisms to
complete the stream-topic mention:

1. Type "#denmar|".
2. Press Enter to get "#**Denmark** |".
3. Press > to get "#**Denmark>|".
4. Type topic name and press enter.

OR

1. Type "#denmar|".
2. Type > to get "#**Denmark>|".
3. Type topic name and press enter.

Both result in the final inserted syntax: "#**Denmark>topic name**".

Documentation is still pending.

Fixes #4836.
2019-07-21 20:38:17 -07:00
Rohitt Vashishtha
83cbd62ba1 typeahead: Support custom selection triggers in bootstrap typeahead.
We add support for triggering typeahead_completion on custom keyup events
in addition to Tab and Enter. The function `this.trigger_selection` takes
the keyup event as its argument and has the same `this` context as the other
typeahead functions.

This is being added to support partial completion of stream typeahead to
directly start the topic_list typeahead.
2019-07-21 20:18:48 -07:00
Rohitt Vashishtha
63e200997d typeahead: Support automatic selection in bootstrap typeahead.
We add support for automatically selecting the currently highlighted
option in a typeahead without rendering the typeahead or the user
pressing 'enter'. The function `this.automated` can use available
data such as this.completing and this.token to determine if we should
automate selection or not.

This is being added to support the topic_jump mechanism.
2019-07-21 20:18:48 -07:00
Rohitt Vashishtha
5e6493d36e compose_state: Maybe update stream name on stream name change.
If we rename a stream that we are composing to, we now change the
stream name in the compose target as well.
2019-07-21 20:18:29 -07:00
Rohitt Vashishtha
3f03ae66f0 compose: Ensure valid destination stream in typeahead completion.
If we complete a typeahead with an invalid stream name in composebox,
we would get 'compose_stream is undefined' error while running the
checks to prevent accidentally mentioning private streams.

We can safely early-return from this function and let the 'send'
event handler show the error to the user.
2019-07-21 20:18:29 -07:00
Rohitt Vashishtha
5d20c4b8fb typeahead: Clear rendered stream html on stream rename.
Previously, after a stream name, you could search for it using its
new name but the typeahead would still display the old name.
2019-07-21 20:18:29 -07:00
Anders Kaseorg
31bd3d617d version: Document when a dependency upgrade requires a major bump.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-21 20:13:52 -07:00
Tim Abbott
15da425c54 auth: Fix camel case name for register_extra_endpoints. 2019-07-21 19:31:13 -07:00
Tim Abbott
95a1827db0 auth: Move GitHub auth tests out of SocialAuthBase.
During the time between when we refactored the GitHub authentication
backend to use SocialAuthBase and now (when we're about to migrate
GoogleAuthBackend to use that code path as well), we accidentally
added some GitHub-specific authentication backend tests to the common
test class.

Fix this by moving them to the GitHub-specific subclass.
2019-07-21 19:26:47 -07:00
Hemanth V. Alluri
1b8009837b openapi: Rename variable function to function_name in validation test.
This is a prep commit for adding validation of the request variable
types since then we would need to actually analyze the code of the
actual function itself and we would need a variable storing the
function itself.
2019-07-21 18:46:48 -07:00
Anders Kaseorg
41209dd32e build-release-tarball: Run with zulip-py-venv symlink present.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-21 18:43:52 -07:00
Tim Abbott
202e2cabc3 api: Fix typo in URL for remove-subscriptions. 2019-07-21 18:41:29 -07:00
Hemanth V. Alluri
d62b75fc4c openapi: Remove /users/me/subscriptions from pending_endpoints.
In commit 7c71e98, we added a special exception for the
/users/me/subscriptions endpoint in the automatic validation test.
By adding some extra documentation, we now remove this extra code,
as well as the endpoint from the list of pending endpoints.
2019-07-21 18:39:53 -07:00
Hemanth V. Alluri
ff73c45fa3 openapi: Improve exception message for pending_endpoint with docs.
In the validation test, we now use a different message for when there
is an endpoint in pending_endpoints with some documentation already.
This change is a bit hackish, but it's okay since we'll be removing it
once we've resolved all pending endpoints (which is bound to happen).
2019-07-21 18:39:53 -07:00
Rishi Gupta
1a6f8cdf17 emails: Remove unsubscribe link from missed message emails.
This allows the footer to be two lines long instead of three.
2019-07-21 15:10:48 -07:00
YashRE42
0fa90162f9 buddy_list: Do not fade current user in PMs.
Fixes a bug where we would fade out our own name because it wasn't in
selected as a recipient in the compose box, when making a PM.
2019-07-21 15:06:10 -07:00
YashRE42
9f5fca5579 notifications: Refactor and test notifiable unreads logic.
In this refactor, we extract two functions in unread.js.  Which one to
use depends on whether res has already been fetched or not.

This also adds node tests to maintain coverage of unread.js.

Tweaked by tabbott for cleaner variable names and tests.
2019-07-21 14:56:42 -07:00
YashRE42
8cf15fe01d node_tests: Mark unread PM as read after testing.
This fixes a spot in unread.js where we weren't marking our unread PM as
read at the end of the test.
2019-07-21 14:50:00 -07:00
Rishi Gupta
9fc791926b support: Use delivery_email instead of email.
Structurally, these pages want email addresses one can actually send
emails to.
2019-07-21 14:47:15 -07:00
Tim Abbott
21c8a7ec36 i18n: Fix strings in send_pm_if_empty_stream.
The previous iteration did not properly handle languages with a
different word order than English.

Discovered via warning output in `manage.py makemessages`.
2019-07-21 14:43:50 -07:00
Rishi Gupta
7d8d0b2284 settings: Update upgrade text and styling.
When we add Plus, the first sentence should change to "Available on Zulip
Standard and Plus".

I copied the styling of .tip out of expediency, but it's also possible that
long term we'll want only 1 tip-like box styling.

The hover styling is a bit random, but I tried to copy other hover styles I
found in settings.scss.

Note that this renames .upgrade_realm_plan_type_suggestion to .upgrade-tip.
2019-07-21 14:32:36 -07:00
Anders Kaseorg
06aa87296c dependencies: Upgrade eslint to 6.0.1.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-20 16:12:51 -07:00
Mateusz Mandera
f1b135bd16 email_mirror: Rename include-quotations to include-quotes. 2019-07-20 15:53:43 -07:00
Mateusz Mandera
519ed41803 email_mirror: Display stream email address with . as the separator. 2019-07-20 15:53:43 -07:00
Mateusz Mandera
8bbd1d005d email_mirror: Support both + and . as separators in the address. 2019-07-20 15:53:42 -07:00
Wyatt Hoodes
e331a758c3 python: Migrate open statements to use with.
This is low priority, but it's nice to be consistently using the best
practice pattern.

Fixes: #12419.
2019-07-20 15:48:52 -07:00
Tim Abbott
e97179fc87 test_docs: Improve error handling for API doc tests. 2019-07-20 15:15:10 -07:00
Mateusz Mandera
4646c7550c test_retention: Prepare for moving system bots to zulipinternal. 2019-07-20 15:08:08 -07:00
Mateusz Mandera
76883d5da9 test_audit_log: Prepare for moving system bots to zulipinternal. 2019-07-20 15:08:06 -07:00
Mateusz Mandera
0299d6f5ef test_new_users: Prepare for moving system bots to zulipinternal. 2019-07-20 14:55:22 -07:00
Mateusz Mandera
d6f9ea94fc test_presence: Prepare for moving system bots to zulipinternal.
These tests want a "local realm" bot rather than
a cross-realm bot (welcome-bot).
2019-07-20 14:55:21 -07:00
Mateusz Mandera
1702ff3a0b test_typing: Prepare for moving system bots to zulipinternal. 2019-07-20 14:55:21 -07:00
Mateusz Mandera
d26e0b3f07 test_users: Prepare for moving system bots to zulipinternal. 2019-07-20 14:55:21 -07:00
Mateusz Mandera
842d9e944a test_classes: Prepare for moving system bots to zulipinternal. 2019-07-20 14:55:21 -07:00
Rishi Gupta
6b350f092d docs: Make the intro to Production Installation less scary. 2019-07-20 14:39:15 -07:00
Rishi Gupta
a93045c12d message view: Add keyboard shortcut to title for [More...]. 2019-07-20 14:39:15 -07:00
Rishi Gupta
7afb44987e docs: Update tips for writing user documentation. 2019-07-20 14:39:15 -07:00
Rishi Gupta
38eeb3e183 notification bot: Add constant for STREAM_EVENTS_NOTIFICATION_TOPIC. 2019-07-20 14:39:15 -07:00
Rishi Gupta
c9f194be99 notification bot: Update message for stream name changes.
Also properly internationalizes string formatting arguments for the stream
created message.
2019-07-20 14:39:15 -07:00
Rohitt Vashishtha
9d6727d18c echo: Update topic_links when we get messages back from server. (#12832) 2019-07-20 14:38:52 -07:00
Wyatt Hoodes
9b69c1f7fe Merge pull request #12833 from whoodes/clean-up-new-user-bot
bots: Replace remnants of new-user-bot with default-bot@zulip.com.
2019-07-20 14:38:05 -07:00
Wyatt Hoodes
f96f7580ca codecov: Change threshold to use percentage syntax.
We update the syntax to avoid ambiguity, also commenting
on why the threshold is set as it is.
2019-07-20 14:37:04 -07:00
Tim Abbott
c931e76cf2 docs: Rewrite docs on writing API documentation.
This had gotten badly out of date, since it wasn't updated when we did
the big migration to the OpenAPI documentation system.

Fixes part of #12571.
2019-07-19 18:00:01 -07:00
Anders Kaseorg
e80b57a18a provision_inner: Remove unused lsb_release run.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-19 16:36:11 -07:00
Cynthia Lin
bbdf00e6e5 night mode: Improve coloring of .new-style buttons.
Border and text color applied by specific classes such as sea-green
were nullified by the previous selector; this commit restores the coloring
for these buttons.
2019-07-19 13:27:37 -07:00
Cynthia Lin
fd7cf53190 templates: Eliminate anchor links with nested buttons.
Given that all links are now modals triggered by JS, the anchor links are
just invalid HTML that have no purpose. This commit refactors the HTML to
eliminate them by adding the Bootstrap-native btn-link class to maintain
styling. Fixes part of #6126.
2019-07-19 13:27:37 -07:00
vinitS101
fe2ec995b6 message_view: Add js tooltip hovers for emoji reactions.
This removes HTML title hovers for emoji reaction buttons below messages
and replaces them with js tooltips.

Fixes #8679.
2019-07-19 12:45:44 -07:00
vinitS101
278ccc559b message_view: Add a js tooltip hover for reaction button.
This change removes the html title for the reaction button
and replaces it with a JS Tooltip with the same title text.
2019-07-19 12:45:44 -07:00
Anders Kaseorg
c5a4b0501b provision: Start a new Python process after activating the virtualenv.
Mismatching imports from outside and inside the virtualenv in the same
process was causing segfaults after apparently benign changes to the
script!

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-19 12:16:55 -07:00
Rohitt Vashishtha
726d5003e1 bugdown: Force absolute urls in topic links.
If a url doesn't have a scheme, browsers would treat it as a relative
url and open something like: https://chat.zulip.org/google.com instead.

This PR fixes the issue on the backend; the frontend implementation
remains out of sync and the user sending the message wouldn't see
any linkification for urls without a scheme.

Fixes #12791.
2019-07-19 12:02:52 -07:00
Anders Kaseorg
afa251de5d dev_urls: Serve static files with staticfiles_urlpatterns.
The test_docs change is because Django runs test cases with DEBUG =
False, which ordinarily means it doesn’t serve /static during tests.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-19 11:47:51 -07:00
Anders Kaseorg
239aefca74 settings: Use production webpack assets when PIPELINE_ENABLED in development.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-19 11:47:51 -07:00
Anders Kaseorg
1bb6634be1 settings: Fix storage settings for (DEBUG and PIPELINE_ENABLED) case.
The documentation suggests that you can get the dev server to use
production assets by setting PIPELINE_ENABLED = True, but that
resulted in Django being unable to find any static files because
FileSystemFinder was missing from STATICFILES_FINDERS.  Using the
production storage configuration in this case reduces the number of
possible configurations and seems to result in things being less
broken.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-19 11:47:51 -07:00
Anders Kaseorg
a7eb3faf96 storage: Move the staticfiles.json hack to ZulipStorage.
There’s no reason to monkey-patch something that we were already
subclassing.

Removing the PRODUCTION conditional causes us to generate
staticfiles.json in the right place to begin with so we don’t need to
move it later.  It also allows Django to find staticfiles.json if
running the dev server with PIPELINE_ENABLED.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-19 11:47:51 -07:00
Anders Kaseorg
695b79c5d8 generate_zulip_bots_static_files: Write to static, not STATIC_ROOT.
Otherwise the files aren’t processed by collectstatic and don’t end up
in the staticfiles.json manifest.

Signed-off-by: Anders Kaseorg <andersk@zulipchat.com>
2019-07-19 11:33:08 -07:00
Anders Kaseorg
5f712b960f update-authors-json: Write to static, not STATIC_ROOT.
Otherwise the file isn’t processed by collectstatic and doesn’t end up
in the staticfiles.json manifest.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-19 11:33:08 -07:00
Anders Kaseorg
1d05a71b5d install, provision: Treat all nonzero exit codes as failure, not just 1.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-19 11:22:11 -07:00
Wyatt Hoodes
89df6e9425 check-templates: Add fix option to tools/check_templates.
`valid_indent_html` allows for replacing the incorrectly
indented file with the correct pretty-printed version
if `--fix` is passed to `tools/lint`.

Fixes #12641.
2019-07-19 11:12:11 -07:00
Vinit Singh
86073588be dependencies: Upgrade jquery-autosize 1.17.7 to autosize 4.0.2.
The API for the autosize library changed upstream, so several changes
had to be made to relevant js files for a successful upgrade.

Resolves #12695.
2019-07-18 14:33:16 -07:00
Anders Kaseorg
9233b3bc75 setup_path_on_import: Always make sure zulip-py3-venv is activated.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-07-18 14:21:04 -07:00
Anders Kaseorg
a45be467ad get_deploy_root: Avoid useless extra realpath call.
The comment that tabbott edited into my commit while wimpifying this
function is wrong on multiple levels.

Firstly, the way in which users might be “running our scripts” was
never relevant.  `__file__` is not the script that the user ran, it’s
zulip_tools.py itself.  What matters is not how the user ran the
script, but rather how zulip_tools was imported.  If zulip_tools was
imported as scripts.lib.zulip_tools, then `__file__` must end with
`scripts/lib/zulip_tools.py`, so running dirname three times on it is
fine.  In fact, in Python ≥ 3.4 (we don’t support anything older),
`__file__` in an imported module is always an absolute path, so it
must end with `scripts/lib/zulip_tools.py` in any case.

(At present, there’s one script that imports lib.zulip_tools, and the
installer runs scripts/lib/zulip_tools.py as a script, but those uses
don’t hit this function.)

Secondly, even if we do care about `__file__` being a funny relative
path, there’s still no reason to have two calls to `realpath`.
`realpath(dirname(dirname(dirname(realpath(…)))))` is equivalent to
`dirname(dirname(dirname(realpath(…)))), as the inner `realpath` has
already canonicalized symlinks at every level.

This version also deals with `__file__` being a funny relative
path (assuming none of scripts, lib, and zulip_tools.py are themselves
symlinks), while making fewer `lstat` calls than either of the above
constructions.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-07-18 14:20:53 -07:00
Tim Abbott
500b161aab unread: Enable the load_server_counts setting for everyone.
This change is long overdue.  After implementing this much more robust
system and deploying it on chat.zulip.org, we hesitated to make
load_server_counts the default behavior in master, because of data
anomalies present for many existing users (basically messages far back
in their history that they had never read, on streams they believed
themselves caught up on), which would have been confusing for many
users.

However, because the mobile apps have been using this data set for a
long time, we've likely cleared out the anomalies from active users'
data set.  And for older users, they're going to come back to
approximately infinite unread messages anyway, so the data anomalies
are unlikely to be important.

Fixes #7096.
2019-07-18 13:34:55 -07:00
Tim Abbott
bb746ab93b docs: Discourage direct mobile push notifications more strongly.
We had an organization with engineers for whom English was not their
native language think they needed to go through this laborious
process, which was definitely counterproductive for them.
2019-07-18 13:11:21 -07:00
Anders Kaseorg
953b69e5ea dependencies: Upgrade simplebar to 4.1.0.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-18 12:19:55 -07:00
Anders Kaseorg
c4fee086a6 css: Restore keyboard accessibility to styled checkboxes. 2019-07-18 12:19:48 -07:00
Anders Kaseorg
ab89f40a66 generate-custom-icon-webfont: Replace with webpack webfonts-loader.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-18 12:00:00 -07:00
Anders Kaseorg
586aaddcc0 documentation_crawler: Stop treating all portico URLs as external.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-18 11:56:15 -07:00
Anders Kaseorg
51edc4bf4c portico: Fix link to localhost:9991.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-18 11:56:15 -07:00
Anders Kaseorg
71b20aa7e2 HTML validation: Fix login page HTML errors.
"http://localhost:9981/accounts/find/":121.29-121.53: error: The value of the “for” attribute of the “label” element must be the ID of a non-hidden form control.
"http://localhost:9981/login/":168.41-168.94: error: An “img” element must have an “alt” attribute, except under certain conditions. For details, consult guidance on providing text alternatives for images.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-18 11:56:15 -07:00
Cynthia Lin
7bb5162fc7 portico: Refactor button selectors to use SCSS nesting. 2019-07-18 11:54:30 -07:00
Cynthia Lin
0f44608974 portico: Reorder button selectors in preparation for SCSS nesting. 2019-07-18 11:54:30 -07:00
Cynthia Lin
7c1b6aa5a8 portico: Remove style selector for superflous button.grey-transparent.
There is no element with the .grey-transparent class in the current
codebase, so it is likely legacy and thus unnecessary.
2019-07-18 11:54:30 -07:00
Vaibhav
ba2d609e6a css: Nest .subscriptions-header inside .subscriptions-container. 2019-07-18 11:41:18 -07:00
Vaibhav
d104935d69 css: Nest .display-type inside .subscriptions-container .right. 2019-07-18 11:41:18 -07:00
Vaibhav
bafcad8ef3 css: Use SCSS nesting for .subscriptions-container. 2019-07-18 11:41:18 -07:00
Vaibhav
ef64f33808 css: Reorder subscriptions.scss so .subscriptons-container is in same place. 2019-07-18 11:41:18 -07:00
Vaibhav
3c0f447f1a css: Use SCSS nesting for .subscriptions-header. 2019-07-18 11:41:18 -07:00
Vaibhav
279b52ac82 css: Reorder subscriptions.scss so .subscriptions-header is in same place. 2019-07-18 11:41:18 -07:00
Mohit Gupta
648a60baf6 narrow: Add condition whether to show unread message first in narrow.
All narrows that have is: query or can mark unread message as read
will show unread message first.
2019-07-17 17:58:20 -07:00
Mohit Gupta
6ec40cf9a0 search: Don't mark messages as read in search narrow.
Don't mark unread messages as read while searching.
This behavior will be extended to other narrows later.

Fixes: #12556.
2019-07-17 17:58:20 -07:00
Rishi Gupta
bd52ec9f95 notification bot: Remove checks for whether bot exists. 2019-07-17 17:54:16 -07:00
Rishi Gupta
f4397166c4 notify_new_user: Remove call to statsd.gauge.
This has been deprecated by our analytics system.
2019-07-17 17:54:16 -07:00
Rishi Gupta
b520df18ee notify_new_user: Move clear_scheduled_invitation_emails out of function.
notify_new_user is confusingly named, but it should be read as "notify
others that a new user was created", not "notify the new user".
2019-07-17 17:54:16 -07:00
Rishi Gupta
c030411fec email visibility: Use delivery_email to clear scheduled invitation emails.
This fixes a user-visible bug, where users signing up for realms with
restricted email visibility get reminder emails 1 week later, whether or not
they created an account.
2019-07-17 17:54:16 -07:00
Vishnu Ks
e32ee53fa3 emails: Improve wording of why you are getting this email.
Also remove <br> tag from missed_message text message.
2019-07-17 17:50:18 -07:00
Vishnu Ks
3a6fc09a4d emails: Make sender name go in-line with message body.
Making sender name go in-line with message body only if
the html starts with <p> tag since it won't look good
if the message starts with a code snippet, ul, etc.
If message starts with p tag we can safely assume that
it can go in-line with sender name.
2019-07-17 17:50:04 -07:00
YashRE42
7867830e14 settings: Adjust styling of ? icons. 2019-07-17 17:47:08 -07:00
Hemanth V. Alluri
cb21207a4b docs: Add a section about enabling docker before doing vagrant up.
Many Linux distros like Debian Buster, Fedora 29, etc. have a policy
where any services installed are disabled by default. So we should let
the developer know that they should explicitly enable and start the
Docker daemon.

Also, we should be verbose on how to do vagrant up using Docker as a
provider specifically (and similar for Virtualbox).
2019-07-17 16:29:25 -07:00
Anders Kaseorg
f97bb6b65c postgres-create-db: Split into non-pgroonga and pgroonga scripts.
Fixes #12655.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-17 16:18:22 -07:00
Wyatt Hoodes
1418b8b05f test_server: Set LOCAL_UPLOADS_DIR in set_up_django.
For the Casper and API tests, we need to allow setting
LOCAL_UPLOADS_DIR, which is normally managed within test_runner.py.
2019-07-17 16:14:20 -07:00
Priyank Patel
ea2e7ccf27 message_fetch: Use user ID for sender and group-pm-with operator. 2019-07-17 16:09:12 -07:00
Priyank Patel
b338fd130e messages: Support passing user IDs for group-pm-with operator. 2019-07-17 16:09:12 -07:00
Priyank Patel
c067c155aa messages: Support passing user ID to sender operator. 2019-07-17 16:09:12 -07:00
Anders Kaseorg
54304b4008 webpack: Remove partial from handlebars-loader knownHelpers.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-17 16:07:17 -07:00
Anders Kaseorg
b1aa304c4a templates: Suppress Handlebars automatic partial indentation.
Fixes #12795.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-17 16:07:17 -07:00
Anders Kaseorg
07f93d58a3 views: Remove unused APIView class.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-17 16:03:35 -07:00
Anders Kaseorg
6e6a3947dc test_templates: Remove nonexistent templates from skip list.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-17 16:03:35 -07:00
Anders Kaseorg
5ec2e4add4 home: Remove handler for old compile-handlebars-templates error file.
As of commit 8c199fd44c (#12667) this
file is no longer generated.  Handlebars compile errors are raised as
webpack errors.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-17 16:03:35 -07:00
Sumanth V Rao
2c9f5e3980 tools: Add tool to update API field of local zuliprc file.
This tool can be used to update the API field of local
zuliprc files for dummy users of development server
(iago, prospero, etc) with the correct API key from database.

This tool can be run after provisioning (or similar tools) which change
the API keys in the database.
2019-07-17 16:00:21 -07:00
Alexandra Ciobica
28ebe3e6ba css: Refactor topic edit buttons to use scss nesting. 2019-07-17 22:30:39 +03:00
Alexandra Ciobica
117e1e05ea css: Clean up styling of topic edit buttons.
Related to: #11233.
2019-07-17 22:20:52 +03:00
Archit Kaushik
e8eaa19ae4 topic edit: Improve styling of topic edit icons (save and cancel).
The earlier styles were inconsistent with the rest of UI.
The new styles follow the colour scheme.

Fixes #10983
2019-07-17 22:20:52 +03:00
Tim Abbott
d2f1c84001 settings: Rewrite logic for whether users can change name.
This moves this somewhat complicated, duplicated logic into a single
JavaScript function.
2019-07-16 11:43:57 -07:00
Cynthia Lin
8b538d8b8d user settings: Prevent linkifying trailing whitespace in change name button.
When user name changes are disabled and the disabled name change info icon
shows, trailing whitespace gets linkified because of the link's
inline-block property. Use Handlebars whitespace omission syntax to
eliminate this behavior.
2019-07-16 11:43:57 -07:00
Cynthia Lin
50cab76c59 user settings: Hide disabled name change info icon for admins.
This icon should only show when the user is not an admin and either the
realm or server settings have disabled name changes. Previously the icon
always showed for admin users.
2019-07-16 11:43:57 -07:00
Cynthia Lin
a73155c78f node tests: Fix checking for invalid :checked property in templates. 2019-07-16 11:43:57 -07:00
Cynthia Lin
63c85da4db right sidebar: Use flexbox positioning for elements in USERS header.
Eliminate fixed positioning for better alignment.
2019-07-16 11:33:02 -07:00
Cynthia Lin
a65007dde4 right sidebar: Ensure .user-with-count gets added to correct li element.
The count_span element is parented by a .selectable_sidebar_block element
which is parented by the li element that the class is supposed to be added
to. Thus, use the parents() jQuery method for locating the li parent so
that the class gets added to the correct element.
2019-07-16 11:33:02 -07:00
Wyatt Hoodes
5ca2e43e44 test_bots: Remove override_settings decorator from test case.
The decorator running at import time was causing directory
creation in the project's root.

One could imagine linting for this, but it seems unlikely that similar
code will be added in the future; the problem one would be trying to
solved is already addressed by default in the framework now.
2019-07-15 14:16:56 -07:00
Wyatt Hoodes
c218735b2c test_runner: Add error handling for test directory clean up.
It was discovered that errors such as:
    `OSError: [Errno 16] Device or resource busy`
potentially arise when running in serial mode, or with
explicit test cases passed to `test-backend`.
2019-07-15 14:15:19 -07:00
Cynthia Lin
94bbc32a92 user settings: Improve visibility of delete profile picture icon in light mode. 2019-07-15 13:49:00 -07:00
Cynthia Lin
ec4c996361 user settings: Darken area outside of non-square profile avatars on hover. 2019-07-15 13:49:00 -07:00
Tim Abbott
c91f659a1d openapi: Fix test output for undocumented parameters.
The output had the error messages swapped.
2019-07-15 13:39:30 -07:00
Tim Abbott
7c71e987ac openapi: Fix endpoints incorrectly tagged as documentation_pending. 2019-07-15 13:39:29 -07:00
Mateusz Mandera
c1a8ba2974 populate_db: Use do_change_is_admin for setting api_super_user. 2019-07-15 12:32:29 -07:00
Mateusz Mandera
0e708d1f6c models: Add note that api_super_user allows sending to private streams. 2019-07-15 12:32:29 -07:00
Tim Abbott
588a24b661 cache: Fix caching of system bots.
In the unlikely event that someone edited the properties of a system
bot and then saved the result, we were still caching the old version
indefinitely in the get_system_bot cache.

This led to a confusing case where a newly installed Zulip server
didn't have is_api_super_user properly set on its EMAIL_GATEWAY_BOT in
memcached.

Co-authored-by: Mateusz Mandera <mateusz.mandera@protonmail.com>
2019-07-15 12:32:29 -07:00
Tim Abbott
111139b44e initialize_voyager_db: Use do_change_is_admin.
This is a code cleanup; in general, we avoid making direct updates to
model objects and then saving with a bare `.save()` across the
codebase.
2019-07-15 12:32:29 -07:00
Eeshan Garg
8dfc9d8bca pypi: Upgrade to release 0.6.1. 2019-07-15 12:28:16 -07:00
Amal Rajan
09049f1678 provision: Add provision support for Ubuntu 19.04
This commit adds support for Ubuntu 19.04 in the development
environment.
2019-07-13 16:44:09 -07:00
Hemanth V. Alluri
24d66477ca webhooks: Migrate gogs tests to the headers fixtures system. 2019-07-13 16:02:27 -07:00
Rishi Gupta
5cf304f8f9 notification bot: Tighten message for being added to streams. 2019-07-13 15:53:36 -07:00
Rishi Gupta
15cd2903dd notification bot: Refactor arguments to send_pm_if_empty_stream.
Previously we sent "" for stream_name where we should have sent None, which
made this function harder to understand. The "" value was never used.

This also reorders the arguments to be match the order of the arguments in
the two callers.
2019-07-13 15:53:36 -07:00
Rishi Gupta
628d9ad67d notification bot: Update error messages in send_pm_if_empty_stream. 2019-07-13 15:53:36 -07:00
Rishi Gupta
b92f936dad notification bot: Refactor send_pm_if_empty_stream to simplify logic. 2019-07-13 15:53:36 -07:00
David Wood
9bace3f2cd notifications: Allow only notifiable in unread count.
This commit adds a new setting to the user's notification settings that
will change the behaviour of the unread count in the title bar and
desktop application.

When enabled, the title bar will show the count of unread private messages
and mentions. When disabled, the title bar will act as before, showing
the total number of unread messages.

Fixes #1736.
2019-07-13 15:49:04 -07:00
Tim Abbott
ca23740478 condense: Rewrite condense.toggle_collapse to be readable and correct.
The proposed fix in #11662 was effectively a workaround for some
already bad logic.  What we actually want to do is described in the
updated function comment (from the spec in #5914), and requires an
additionl case that was not present in the original implementation
(which effectively assumed a collapsed message was condensible).

Also add some documentation.

Fixes #11662.
2019-07-13 15:45:00 -07:00
Priyank Patel
73b19672c3 message_fetch: Use user IDs for supported operators.
The approach taken here is basically use user IDs in operator that
support it when sending the request for fetching the messages
(see comments in code for more details).
2019-07-13 11:35:37 -07:00
Mateusz Mandera
7f556d1678 docs: Fix typo in production/email-gateway.md. 2019-07-13 11:31:01 -07:00
vsvipul
e830853aee desktop-presence: Use system presence data from electron-bridge.
Combined with work in the desktop app, this makes it possible for the
desktop app to clearly indicate to other users whether the current
user is active on the system and thus would see a desktop
notification, not just whether they are active in the current Zulip
window.

Essentially rewritten by tabbott to add unit tests and consider the
desktop app data authoritative.
2019-07-13 11:21:22 -07:00
Anders Kaseorg
aa36e2f5e1 check-templates: Exclude static/icons/fonts/template.hbs.
This file was unchecked until the .handlebars ↦ .hbs rename, so this
is the easiest way to get tests passing again.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-12 22:52:41 -07:00
Anders Kaseorg
adcfa68da8 templates: Remove partial helper.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-12 21:11:14 -07:00
Anders Kaseorg
0c565f50be templates: Use upstream Handlebars partials syntax.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-12 21:11:14 -07:00
Anders Kaseorg
0bd5c46e40 zjsunit/handlebars: Support auto-registering partials.
webpack with handlebars-loader already does this, so we only need to
fix up the tests.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-12 21:11:14 -07:00
Anders Kaseorg
db0b33842c templates: Replace templates.render with require calls.
This removes an unnecessary layer of indirection and allows webpack to
catch filename mistakes.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-12 21:11:14 -07:00
Anders Kaseorg
706f13b671 zjsunit: Wrap Handlebars with mocking support.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-12 21:11:14 -07:00
Anders Kaseorg
fb3fac1d96 zjsunit: Add make_handlebars abstraction.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-12 21:11:14 -07:00
Anders Kaseorg
a0122abf9a zjsunit: Add stub_templates abstraction.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-12 21:11:14 -07:00
Anders Kaseorg
8761e09eed zjsunit: Remove render.js.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-12 21:11:14 -07:00
Anders Kaseorg
3c3471b720 templates: Rename *.handlebars ↦ *.hbs and - ↦ _.
Tweaked by tabbott to avoid accidentally disabling the linter for
handlebars templates.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-12 21:11:03 -07:00
Hariom Verma
107da5402c url preview: Replace YouTube URLs with their titles.
Modified by punchagan to:
* Replace URLs with titles only if the inline url embed previews are turned on
* Add a test for youtube titles replacing URLs

The titles for the videos are fetched asynchronously after the message has been
sent via the code that fetches metadata for open graph previews. So, the URLs
are replaced with titles only if the inline embed url previews feature is
enabled.

Ideally, YouTube previews should be shown only if inline url previews are
enabled, but this feature is in beta, while YouTube previews are pretty stable.
Once this feature is out of beta, YouTube previews should be shown only if the
url previews feature is turned on.

YouTube preview image is calculated as soon as the message is sent, while the
title needs to be fetched using a network request. This means that the URL is
replaced only after the data has been fetched from the request, and happens a
couple of seconds after the message has been rendered.

Closes #7549
2019-07-12 19:14:19 -07:00
Puneeth Chaganti
865bc24f67 url preview: Avoid showing previews for URLs in blockquotes.
Messages with links embedded in blockquotes turn out to be replies to
messages with links, more often than not. Showing previews for links in
replies seems like clutter, and it seems reasonable to turn off previews for
such links.
2019-07-12 19:14:00 -07:00
Puneeth Chaganti
ad98f536bf bugdown: Fix incorrect type annotation for ElementPair. 2019-07-12 19:14:00 -07:00
Tim Abbott
86f762bc75 docs: Document TEST_WORKER_DIR. 2019-07-12 17:52:08 -07:00
Wyatt Hoodes
0e3fddbc6e test_fixtures: Add logic for removing stale test directories.
Similarly to how stale database removal is handled, we add a check for
stale test run directories at the end of the `test-backend` script.
2019-07-12 17:42:18 -07:00
Wyatt Hoodes
f7f32df3ef docs: Update directory structure. 2019-07-12 17:42:18 -07:00
Wyatt Hoodes
16abd3d1e7 test-backend: Remove long-term clean up code.
With the refactored file structure approach, the clean up block at the
end of `test-backend` is no longer necessary.
2019-07-12 17:42:18 -07:00
Wyatt Hoodes
62566f02d7 tests: Use TEST_WORKER_DIR for file access. 2019-07-12 17:42:18 -07:00
Wyatt Hoodes
5f20caa6e0 test_upload: Refactor test_upload output to new filepath.
We write a function to set the `LOCAL_UPLOADS_DIR` path depending
on whether tests are being run in parallel or serial mode.
2019-07-12 17:35:44 -07:00
Wyatt Hoodes
ff156c1f8a test_runner: Create file structure for test-backend filepath rework.
We create a path structure in the from:
 `/var/<uuid>/test-backend/run_1234567/worker_N/`

A settings attribute, `TEST_WORKER_DIR`, was created as a worker's
directory for a given `test-backend` run's file storage.  The
appropirate path is created in `setup_test_environment`, while each
workers subdirectory is created within `init_worker`.

This allows a test class to write to `settings.TEST_WORKER_DIR`,
populating the appropirate directory of a given worker.  Also
providing the long-term approach to clean up filesystem access
in the backend unit tests.
2019-07-12 17:27:18 -07:00
Cynthia Lin
e5d0448505 user settings: Improve accessibility for new delete profile picture button. 2019-07-12 16:53:25 -07:00
Cynthia Lin
ffaa0ee120 styles: Refactor #user-settings-avatar elements to use SCSS nesting feature. 2019-07-12 16:53:25 -07:00
Cynthia Lin
886deaf48d styles: Remove superflous .white-color class.
Class was only used in one location, rendering it unnecessary.
2019-07-12 16:53:25 -07:00
Cynthia Lin
faa556ab5e user settings: Change delete profile picture button into a x icon.
Fixes part of #10255.
2019-07-12 16:53:25 -07:00
Cynthia Lin
c4f510b724 styles: Refactor #user_presences li selectors to use SCSS nesting. 2019-07-12 16:34:06 -07:00
Cynthia Lin
2694dd7e24 styles: Reorder #user_presences li selectors for SCSS nesting. 2019-07-12 16:25:40 -07:00
Cynthia Lin
ff2db8cf93 styles: Eliminiate duplicate selector for user/group PM circles. 2019-07-12 16:25:40 -07:00
Tim Abbott
06d3194ff6 dependencies: Use the django-bitfield 1.9.5 release.
The release contains all the fixes from our fork.
2019-07-12 16:25:40 -07:00
Rishi Gupta
0f3c2748dd notification bot: Update stream announcement message. 2019-07-11 15:22:36 -07:00
Tim Abbott
e8e420bbd9 markdown: Fix marked generation of unnecessarily absolute URLs.
The new versions should exactly match the HTML we generate in the
backend unit test suite.
2019-07-11 15:09:38 -07:00
Rohitt Vashishtha
e68f90db9c topic-mention: Support updating old renders on stream rename. 2019-07-11 14:53:10 -07:00
Rohitt Vashishtha
3698cdcc58 topic-mention: Add Marked implementation as HandleStreamTopic. 2019-07-11 14:53:10 -07:00
Rohitt Vashishtha
0ba332bcc0 topic-mention: Add Bugdown implementation as StreamTopicPattern. 2019-07-11 14:53:10 -07:00
Puneeth Chaganti
a138d8e95c templates: Update open graph metadata for some portico pages.
Closes #12580
2019-07-11 14:23:25 -07:00
Puneeth Chaganti
6fdd8fb4a1 documentation: Change open graph metadata for /integrations. 2019-07-11 14:23:25 -07:00
Rishi Gupta
c3adafbee9 notification bot: Remove check for existence in add_subscriptions_backend.
We implicitly assume settings.NOTIFICATION_BOT is not None just a few lines
above, in
sender = get_system_bot(settings.NOTIFICATION_BOT)
notifications.append(
    internal_prep_private_message(
        realm=user_profile.realm,
        sender=sender,
        ...
2019-07-11 14:18:21 -07:00
Rishi Gupta
6c8569d99f notification bot: Add stream creator to initial stream message.
Also removes the "Welcome", since it's cleaner to have this be strictly a
notification.
2019-07-11 14:16:56 -07:00
Rishi Gupta
5400eb62be notification bot: Inline prep_stream_welcome_message.
This will make it easier to have access to the stream creator.

The indirection also isn't really adding anything, especially given that the
announce message is inlined just above.
2019-07-11 14:16:56 -07:00
Rishi Gupta
7de7b6872b notification bot: Modify initial stream creation message.
Discussion at
https://chat.zulip.org/#narrow/stream/137-feedback/topic/hello.20topic

The "by @**X**" part in the message content is in a later commit.
2019-07-11 14:16:56 -07:00
Tim Abbott
1d3312eede docs: Improve email gateway documentation based on feedback. 2019-07-11 14:01:29 -07:00
Aayush Agrawal
54584f6c16 url preview: Create a single preview for each URL in a message.
Modified by punchagan to:
* Add a separate markdown test for de-duplicating inline previews
* Check for number of unique URLs to see if per limit message is crossed
* Use a set for processed URLs instead of a list

Fixes #8379.
2019-07-11 13:37:15 -07:00
Yashashvi Dave
ff75c77f7a account settings: Replace logic with existing functions.
Replace settings api calls with existing function
`settings_ui.do_settings_change()`. This commit also
adds a ui element for save alert notificaiton.
2019-07-11 13:29:08 -07:00
Yashashvi Dave
e2e7d288a5 user settings: Fix garbage full name in change-full-name modal.
We should set full name evertime we open the modal. Otherwise
it will show garbage value which user has entered before but
did not save.
2019-07-11 13:17:59 -07:00
Yashashvi Dave
ecddc10272 user setting: Fix error message style in change user info modals.
This commit fixes style of error message in update-user-info
modals. Commit adds error message element in modal body and
fixes margin.
2019-07-11 13:17:42 -07:00
Yashashvi Dave
da2b80c173 custom field: Make external-custom-field URL input wider. 2019-07-11 12:52:21 -07:00
Yashashvi Dave
27ead227c0 custom fields: Add separate alert-save widget for create field.
Add separate alert-notification widget for create-custom-field
in admin view.

Fixes part of #12748
2019-07-11 12:52:21 -07:00
Vaibhav
81a7467441 css: Nest .subscriber-list inside .subscriber_list_container. 2019-07-11 12:23:42 -07:00
Vaibhav
52027af52a css: Nest .subscriber_list_container inside .subscriber-list-box. 2019-07-11 12:23:42 -07:00
Vaibhav
57aedf0a46 css: Use SCSS nesting for .subscriber_list_container. 2019-07-11 12:23:42 -07:00
Vaibhav
f27031925a css: Use SCSS nesting for .subscriber-list. 2019-07-11 12:23:42 -07:00
Vaibhav
39f6d0a71b css: Reorder subscriptions.scss so .subscriber-list are in same place. 2019-07-11 12:23:42 -07:00
Tim Abbott
4aeb399315 apps: Fix buggy toggling with version_info.show_instructions.
We were doing the seemingly innocent
.toggle(version_info.show_instructions) to show the instructions if
and only if show_instructions was true.  However, our data structures
that should have been false didn't set a value, and `.toggle` with no
arguments just flips the state, rather than unconditionally hiding.
2019-07-11 11:48:24 -07:00
Vishnu Ks
db6439ca57 emails: Remove cheers section from missed_message email. 2019-07-11 11:33:31 -07:00
Hemanth V. Alluri
041fe396f6 openapi: Extract logical segments in the validation test.
Extract some logical segments of test_openapi_arguments into
individual (helper) functions. E.g. extraction of the regex
to OpenAPI URL format conversion and testing.
2019-07-11 11:01:46 -07:00
Hemanth V. Alluri
644fba495b openapi: Use standardized URL format in validator test.
Now that the URL format has been standardized as {var_name},
we can finally clean up the validator test.
2019-07-11 11:01:46 -07:00
Hemanth V. Alluri
ffd2bccd4e openapi: Standardize URL format to use {var_name} syntax.
The previous code for the validator test was fairly messy due to
checking for both formats of the openapi url, one with
<variable_name> and the other with {variable_name}. To eliminate
this, we have standardized the format and restricted it to
{variable_name} as per the official format at:
https://swagger.io/docs/specification/describing-parameters.
2019-07-11 11:01:40 -07:00
Rishi Gupta
fe59c31e85 portico: Add link for accessibility on /features. 2019-07-10 22:59:14 -07:00
Mateusz Mandera
6f778ffe53 docs: Fix typos in email-gateway.md. 2019-07-10 17:58:38 -07:00
Wyatt Hoodes
69bd7c6dd3 test_realm_export: Add coverage for tarball upload and retrieval.
These updates are added as a direct result of the new strategy related
to the the following refactorings:

* Having `do_export_realm` return the value of the tarball path.
See 6e187e974a4e6282d3616312bdfa19d0d2a949d1.

* Moving the upload logic for s3 and local tarball storage out of
`export_realm_wrapper` and into `upload.py`.
See f1041e1fb6cb60f2c53b294695245e4c86a4d40b.
2019-07-10 17:48:54 -07:00
Wyatt Hoodes
0f31053b0c export.py: Call upload_backend only when we know which backend to use.
Importing at the top of the file causes conflictions on the
backend when deciding whether to go down the S3 path, or the
`LOCAL_UPLOADS_DIR` path.
2019-07-10 17:48:54 -07:00
Rishi Gupta
8b729cc5fb portico: Add links from /features to /help.
I left out the top section ("Beautiful messaging") because the styling would
have to be different.
2019-07-10 17:39:27 -07:00
Anders Kaseorg
0555007bd0 requirements: Remove unused dependencies.
* backports-abc: For old Python versions.
* backports.ssl-match-hostname: For old Python versions.
* docopt: Has never been used directly.
* gitdb: Has never been used directly.
* ndg-httpsclient: No longer used by requests ≥ 2.12.1.
* pycrypto: Has never been used directly.
* smmap: Has never been used directly.
* typing: For old Python versions.
* typing_extensions: For old Python versions.

PROVISION_VERSION is not bumped because these were already unused
since at least the last major bump.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-10 15:44:50 -07:00
Anders Kaseorg
51b5188299 requirements: Delist recursive dependencies from *.in not used directly.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-10 15:44:50 -07:00
Yashashvi Dave
a8bdbcab04 settings: Fix bug setting-save-alert-notification don't fade out.
Fix but by fixing parameters passed to function.
2019-07-10 14:41:26 -07:00
Mateusz Mandera
addcf78af5 emails: Update link to email mirror docs in missed_message emails. 2019-07-10 13:33:25 -07:00
Mateusz Mandera
3a4f8ed737 docs: Move prose email mirror instructions out of settings template.
This should make it easier to understand the documentation.
2019-07-10 13:33:25 -07:00
Rohitt Vashishtha
f507a1a1d9 portico: Remove scroll-to attribute support.
This feature was added in 3b55519b11
without any uses of it in the markup, and we do not appear to use
scroll-to anywhere in our portico pages.
2019-07-10 13:12:07 -07:00
Rohitt Vashishtha
d649dce468 portico: Remove event handler on anchor tags.
We added custom event handlers on anchor tags to show transitions
when switching between pages, a behaviour we have since removes in
commit a0dacea811.

Our approach didn't respect the target attribute for links and other
defaults that browsers offer with links.

We can now safely remove the event handler and restore the default
behavior of anchor tags.
2019-07-10 13:12:00 -07:00
Tyler B. Thrailkill
52a8de0898 docs: Add webstorm debugging docs/tutorial for node.
This was rewritten by tabbott to use markdown steps, avoid
distractions about things you don't need to change, and remove the
screenshots, which I felt were more clutter than value.
2019-07-10 12:53:21 -07:00
Rishi Gupta
90ff757f78 settings: Add some clarification around user groups. 2019-07-10 12:26:38 -07:00
Rishi Gupta
5ecfcb0651 settings: Add a few (?) links to /help articles. 2019-07-10 12:26:38 -07:00
Rishi Gupta
c8d6cfa9b0 settings: Note that alert words are not case sensitive.
Hopefully people translating to languages that don't have case will know to
ignore this second sentence.
2019-07-10 12:26:38 -07:00
Vaibhav
239278ed90 css: Use SCSS nesting for .stream-row. 2019-07-10 11:30:56 -07:00
Vaibhav
95dbe28aeb css: Use SCSS nesting for .stream-row .sub-info-box. 2019-07-10 11:30:42 -07:00
Vaibhav
b5bd0fd4f4 css: Reorder subscriptions.scss to group sub-info-box *. 2019-07-10 11:30:36 -07:00
Anders Kaseorg
218c60ae86 third: Upgrade spectrum-colorpicker to 1.8.0 from NPM.
We had several patches to spectrum, but the only essential one 
(0ea770fc18) had already been fixed upstream,
and another was just handling jQuery deprecation warnings for not yet removed features.

See #12749 for details.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-10 10:07:34 -07:00
Tim Abbott
5c32e2ff49 popovers: Fix migration to popovers.hide_all_except_sidebars().
I'm not really sure how I missed this in the original commit.
2019-07-09 23:03:41 -07:00
Tim Abbott
78bb3f7ea1 tests: Fix mock for hide_streamlist_popover.
Apparently, I did my grep wrong to check for references in
f5b1081c93.
2019-07-09 17:54:55 -07:00
Yashashvi Dave
9c35b864fd input pills: Update style for non editable pills.
For non editable input pills, add background color
to be transparent and padding to 0px.
2019-07-09 17:21:54 -07:00
Yashashvi Dave
5be2207bf8 user settings: Fix custom URL field style in profile form.
Type of input element in profile form was not defined for
URL type custom fields. Because type was not passed to
template.
2019-07-09 17:21:54 -07:00
Yashashvi Dave
d7ee2aced1 models: Add external_account in custom profile field types.
Add new custom profile field type, External account.
External account field links user's social media
profile with account. e.g. GitHub, Twitter, etc.

Fixes part of #12302
2019-07-09 17:21:54 -07:00
Yashashvi Dave
3368589df2 settings_profile_fields: Refactor function read_field_data_from_form. 2019-07-09 17:21:54 -07:00
Yashashvi Dave
f813fdcd5e populate_db: Rename URL type custom profile field.
Rename URL type custom profile field in populate db to avoid confusion
with the "GitHub profile" custom external account profile field we'll
be adding shortly.
2019-07-09 17:21:39 -07:00
Rishi Gupta
a3fca01922 activity: Add links to /stats and /activity in /activity/support. 2019-07-09 17:20:17 -07:00
Anders Kaseorg
bbf45593cb blueslip: Ignore error events with null error.
Chrome generates these to report things like “ResizeObserver loop
limit exceeded” (which is harmless).

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-09 17:18:32 -07:00
Hemanth V. Alluri
9e6ab7f190 webhooks: Migrate reviewboard tests to the headers fixtures system. 2019-07-09 17:13:02 -07:00
Hemanth V. Alluri
b609d25cda webhooks: Migrate netlify tests to the headers fixtures system. 2019-07-09 17:13:02 -07:00
Hemanth V. Alluri
e42baff9e9 webhooks: Migrate groove tests to the headers fixtures system. 2019-07-09 17:13:02 -07:00
Hemanth V. Alluri
62bcbb433d webhooks: Migrate bitbucket3 tests to the headers fixtures system. 2019-07-09 17:10:28 -07:00
Tim Abbott
f5b1081c93 popovers: Fix name for stream_popover.hide_streamlist_sidebar().
The previous name was super confusing; this function is analogous to
hide_userlist_sidebar() and should be named appropriately for that role.
2019-07-09 16:57:10 -07:00
Tim Abbott
01bc4674e3 popovers: Fix closing of the left sidebar with "more topics".
This was another case of incorrect logic due to treating the sidebars
as popovers for the purposes of .hide_all().

Fixes #12274.
2019-07-09 16:54:39 -07:00
Vishnu Ks
5e6d86c8c4 slack_import: Support importing multiparty IMs. 2019-07-09 15:03:28 -07:00
Vishnu Ks
01d8371a2b slack_import: Move channels test data to fixture file. 2019-07-09 15:03:28 -07:00
Tim Abbott
6758b016ac auth: Fix social auth URL pattern for AzureAD.
Apparently, only the login URL was correctly updated to allow dashes
in the name of the social backend.
2019-07-09 14:18:21 -07:00
vinitS101
f86a41da4b left_sidebar: Fix click target of links in the top left sidebar.
Fixes the click targets for the four links in the top left side bar
(All messages, Private messages, Mentions and Starred messages).
The click target now cover the whole row for these links.

Fixes #12449
2019-07-09 13:12:10 -07:00
Yashashvi Dave
ecad54e9f1 org settings: Add wrapped-table class in deactivated user table.
Fix style of deactivated user table list in org setting,
by adding `wrapped-table` class style to table.
2019-07-09 13:07:35 -07:00
Yashashvi Dave
fa5d6bb2d6 org settings: Display deactivated-user section to all.
Fixes #12290
2019-07-09 13:07:35 -07:00
Yashashvi Dave
6fddc86cf2 org settings: Remove strikethrough from deactivated-user setting.
Remove strickethrough and append text to user role.
2019-07-09 13:07:35 -07:00
Yashashvi Dave
1880075f81 static/js/settings_users: Remove unnecessary function from page load. 2019-07-09 13:07:35 -07:00
Yashashvi Dave
5a3f1e20ec static/js/settings_users: Replace logic with existing function. 2019-07-09 13:07:35 -07:00
sameerchoubey
205657b3cf api: Remove spammy json_success content for edit_user_group.
These values were unnecessary translated strings not displayed
anywhere, and were not consistent with Zulip's API standards.
2019-07-09 13:04:47 -07:00
Vishnu Ks
3c464d9d63 emails: Show realm_str inside bracket in subject. 2019-07-09 11:59:39 -07:00
Vishnu Ks
d23bcfa948 emails: Mention why user is getting stream message notification. 2019-07-09 11:59:38 -07:00
Vishnu Ks
c4d28777ec emails: Include stream topic details in missed message subject. 2019-07-09 11:51:20 -07:00
Vaibhav
f9d9eca295 css: Nest .colorpicker-container inside .streams_popover. 2019-07-09 11:43:04 -07:00
Vaibhav
d68fcfdb88 css: Nest sp-container in .colorpicker-container for .streams_popover. 2019-07-09 11:43:04 -07:00
Vaibhav
84489a8d80 css: Nest .sp-palette-container in .sp-container for .streams_popover. 2019-07-09 11:43:04 -07:00
Vaibhav
a7b143bda7 css: Use SCSS nesting in popovers.scss for .group-info. 2019-07-09 11:43:04 -07:00
Vaibhav
d371d7438e css: Separate .group-info rule from .message-group a. 2019-07-09 11:43:04 -07:00
Vaibhav
1bf2b23d36 css: Use SCSS nesting in popovers.scss for .group-info-popover. 2019-07-09 11:43:04 -07:00
Vaibhav
d9142dd03c css: Move .popover_user_presence rules inside one block. 2019-07-09 11:43:04 -07:00
Vaibhav
a1951c087a css: Cleanup margin using only one rule instead of 4 different margins. 2019-07-09 11:43:04 -07:00
Vaibhav
596420d80b css: Remove redundant .group-info-popover .member-list .user_circle rule.
User circle inside `.group-info-popover` already has the class-name
`.popover_user_presence` which has the same properties.
2019-07-09 11:43:04 -07:00
Anders Kaseorg
e0a18d3394 blueslip: Replace jQuery wrappers with error event listener.
Not all our errors actually happen in the contexts we were
wrapping (e.g. `setTimeout` and `_.throttle`).  Also this fixes the
neat Firefox inspector feature that shows you where your event
handlers for a given DOM element actually live.

Using this "semi-modern" browser event means that Safari 9 and older
and IE10 and older may not have our browser error reporting active;
that seems fine giving the vanishing market share of those browsers.

https://blog.sentry.io/2016/01/04/client-javascript-reporting-window-onerror

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-09 11:38:20 -07:00
Anders Kaseorg
0c80fc6aba hashchange: Use hashchange event listener.
The comment that jQuery “doesn’t have” this was nonsense: jQuery
supports every event the browser does.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-09 11:31:35 -07:00
Tim Abbott
6a50460749 templates: Fix path to settings/dev_env_email_access.
This was broken in our migration to a nicer path system for our
handlebars templates.
2019-07-09 11:31:18 -07:00
Anders Kaseorg
ebb9a9ea9e templates: Fix wrong path to edit-outgoing-webhook-service template.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-09 11:31:16 -07:00
Anders Kaseorg
723504f3b6 blueslip: Remove console polyfill.
This appears to have been a workaround for an old version of IE on an
unusual platform.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-08 21:47:04 -07:00
Anders Kaseorg
363956428a lightbox.js: Remove computed access of exports.
This wouldn’t work after migration to an ES6 module.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-07-08 21:22:54 -07:00
Anders Kaseorg
9368c33098 unread.js: Add setter for suppress_unread_counts.
After migration to an ES6 module, `suppress_unread_counts` would no
longer be mutable from outside the module.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-07-08 21:22:54 -07:00
Anders Kaseorg
e24ec31823 unread.js: Add setter for messages_read_in_narrow.
After migration to an ES6 module, `messages_read_in_narrow` would no
longer be mutable from outside the module.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-07-08 21:22:54 -07:00
Anders Kaseorg
8472292906 pointer.js: Add setter for suppress_scroll_pointer_update.
After migration to an ES6 module, `suppress_scroll_pointer_update`
would no longer be mutable from outside the module.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-07-08 21:22:54 -07:00
Anders Kaseorg
f9bf414b58 pointer.js: Add setter for server_furthest_read.
After migration to an ES6 module, `server_furthest_read` would no
longer be mutable from outside the module.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-07-08 21:22:54 -07:00
Anders Kaseorg
e559662c8c pointer.js: Add setter for recenter_pointer_on_display.
After migration to an ES6 module, `recenter_pointer_on_display` would
no longer be mutable from outside the module.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-07-08 21:22:54 -07:00
Anders Kaseorg
055ebe76aa pointer.js: Add setter for furthest_read.
After migration to an ES6 module, `furthest_read` would no longer be
mutable from outside the module.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-07-08 21:22:54 -07:00
Anders Kaseorg
6e4ae95994 message_viewport.js: Add setter for last_movement_direction.
After migration to an ES6 module, `last_movement_direction` would no
longer be mutable from outside the module.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-07-08 21:22:54 -07:00
Anders Kaseorg
15192d4417 message_list.js: Add setter for narrowed.
After migration to an ES6 module, `narrowed` would no longer be
mutable from outside the module.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-07-08 21:22:54 -07:00
Anders Kaseorg
190524b6a0 alert_words.js: Add setter for words.
After migration to an ES6 module, `words` would no longer be mutable
from outside the module.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-07-08 21:22:54 -07:00
Vaibhav
dfdbc378b0 css: Move .user_popover .popover-title rules inside one block. 2019-07-08 20:13:08 -07:00
Vaibhav
b205410e27 css: Use SCSS nesting in popovers.scss for .user_popover. 2019-07-08 20:13:08 -07:00
Vaibhav
58c0434474 css: Use SCSS nesting in popovers.scss for .popover-avatar. 2019-07-08 20:13:08 -07:00
Vaibhav
6ed3792d21 css: Reorder popovers.scss so .popover-avatar are in same place. 2019-07-08 20:13:08 -07:00
Vaibhav
abadc1fd98 css: Move .message-info-popover .popover-title rules inside one block. 2019-07-08 20:13:08 -07:00
Vaibhav
6cedd4ccf5 css: Use SCSS nesting in popovers.scss for .message-info-popovers. 2019-07-08 20:13:08 -07:00
Vaibhav
e25371310d css: Reorder popovers.scss so .message-info-popover are in same place. 2019-07-08 20:13:08 -07:00
Vaibhav
eab0c70d1d css: Use SCSS nesting in popovers.scss for styles in media queries. 2019-07-08 20:13:08 -07:00
Vaibhav
ac2074afa0 css: Use SCSS nesting in popovers.scss for ul. 2019-07-08 20:13:08 -07:00
Vaibhav
9ad6874b93 css: Use SCSS nesting in popovers.scss for .streams_popover. 2019-07-08 20:13:08 -07:00
Vaibhav
6e4ea91461 css: Reorder popovers.scss so .streams_popovers are in same place. 2019-07-08 20:13:08 -07:00
Vaibhav
845b85847b css: Use SCSS nesting in popovers.scss for .popover and title. 2019-07-08 20:13:08 -07:00
Vaibhav
b764bd786f css: Reorder popovers.scss so .popover are in same place. 2019-07-08 20:13:08 -07:00
Mateusz Mandera
58754830fd email_mirror: Rename "include-footers" option to "include-footer". 2019-07-08 20:10:21 -07:00
Yashashvi Dave
d3e83483c8 static/js/common: Add Ctrl key mapping to Cmd for MacOS. 2019-07-08 20:07:49 -07:00
Mateusz Mandera
d1c2185c81 retention: Archive cross-realm personal messages.
We can simply archive cross-realm personal messages according to the
retention policy of the recipient's realm. It requires adding another
message-archiving query for this case however.

What remains is to figure out how to treat cross-realm huddle messages.
2019-07-08 20:03:20 -07:00
Tim Abbott
361618f525 docs: Clarify documentation on Amazon RDS.
It's not actually a reasonable experience to use Zulip without working
full-text search, so we should more strongly direct folks to not do
it.

Fixes #12724.
2019-07-08 20:03:20 -07:00
Anders Kaseorg
167f30aa57 css: Make paragraph-to-list spacing consistent with normal line spacing.
The -2px list margin was almost but not exactly cancelling the 3px
paragraph margin, resulting in a line spacing exactly 1px taller than
the normal line spacing.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-08 19:58:21 -07:00
Anders Kaseorg
b7e3f710b6 css: Specify message_content line-height in relative units.
This fixes (or at least reduces) a problem with inline `code blocks`
causing extra uneven vertical space below their line.  The absolute
line-height was being measured relative to the lower midline of the
smaller font-size in the code blocks.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-08 19:58:21 -07:00
Mateusz Mandera
dae142a6a3 models: Remove redundant active=True filtering in get_huddle_user_ids. 2019-07-08 16:36:02 -07:00
Mateusz Mandera
8c987900ca retention: Move archive vacuuming days setting to DEFAULT_SETTINGS.
This was incorrectly placed in "Email settings", and accidentally not
overridable.
2019-07-08 16:35:53 -07:00
Mateusz Mandera
24ec1c7aa1 Revert "retention: Delete objects tied to a Message in one query with archiving."
This reverts commit 8f15884c7d. Using the
WITH ( ) ... DELETE method leads to a small performance drop, while
probably not offering many positives, so it seems appropriate to go to
the simpler case of just letting things get cleaned up by CASCADE.
2019-07-08 16:35:53 -07:00
Mateusz Mandera
b55f24e07c retention: Avoid "SELECT realm" being run by Django ORM for each stream.
The  way the code changed in this commit was written caused Django to
fetch stream.realm from the database for every stream, leading to
redundant, identical queries. Each stream's realm is already known, so
we use that information.
2019-07-08 16:32:38 -07:00
Vaibhav
8af03b92a0 css: Use SCSS nesting in subscriptions.scss for .stream-row .icon. 2019-07-08 16:23:17 -07:00
Vaibhav
d8efa258e5 css: Use SCSS nesting in subscriptions.scss for .stream-row .check. 2019-07-08 16:23:17 -07:00
Vaibhav
25cb9ff240 css: Reorder subscriptions.scss so .stream-row .check are in same place. 2019-07-08 16:23:17 -07:00
Anders Kaseorg
c97ca677c9 nginx: Update TLS settings based on Mozilla recommendations 5.0.
Disable TLS 1.0 and TLS 1.1.  (We no longer need to support IE8 on
Windows XP.)

Prefer client-selected cipher order.  (Now that all enabled ciphers
provide good security, this allows mobile clients lacking AES hardware
acceleration to pick ChaCha20 for better performance.)

Disable session tickets.  (Mozilla discourages them based on
https://www.imperialviolet.org/2013/06/27/botchingpfs.html.)

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-08 15:51:02 -07:00
Tim Abbott
e87fcd0789 management: Fix obsolete check for double-adding a permission.
The .has_perm logic in this management command dates from use of
django-guardian that ended years ago.
2019-07-08 13:44:40 -07:00
Tim Abbott
9e9ddf464e management: Clean up a variable name in knight. 2019-07-08 13:42:05 -07:00
Vinit Singh
3cc790420a docs: Update docs to reflect the use of Ubuntu bionic in development. 2019-07-08 13:25:54 -07:00
Hemanth V. Alluri
cecdec3097 openapi: Add test to see if code exists for documented endpoints.
In addition to the test which checks to to see if each endpoint in
code (urls.py) is documented in the openapi documentation (and with
the right arugments). We now also have a test to see if every
endpoint in the openapi documentation is a legitimate endpoint
also existing in code.

We do this by piggy-backing on the work done be the former test and
using set operations. This method avoid the need for an extra loop
and it uses set operations for additional speed and ease of reading.
2019-07-08 12:58:21 -07:00
Hemanth V. Alluri
718744c22d openapi: Refactor OpenAPIArgumentsTest.
The main things targeted by the refactor are the usage of comments and
moving the top-level variables to the scope of the class.

The movement of variables was to facilitate allowing us to perform
a reverse mapping test from OpenAPI URLs -> Code defined URLs.
2019-07-08 12:58:02 -07:00
Hemanth V. Alluri
74a72fc422 openapi: Add regex-to-openapi url pattern matching in the test.
With this, the automated validation test will now be able to
work with URL patterns containing regular expressions.
2019-07-08 12:34:31 -07:00
Hemanth V. Alluri
2738b09044 openapi: Remove a few "buggy" endpoints in the validation test.
By importing a few view modules in the validation test itself we
can remove a few endpoints which were marked as buggy. What was
happening was that the view functions weren't imported and hence
the arguments map was not filled. Thus the test complained that
there was documentation for request parameters that seemed to be
missing in the code. Also, for the events register endpoint, we
have renamed one of the documented request parameters from
"stream" to "topic" (the API itself was not modified though).

We add a new "documentation_pending" attribute to req variables
so that any arguments not currently documented but should be
documented can be properly accounted for.
2019-07-08 12:34:31 -07:00
YashRE42
c8b6afdca8 docs: Add warning about incorrect proxy settings for Vagrant setup.
Tweaked by tabbott for further clarity.
2019-07-08 12:30:31 -07:00
Wyatt Hoodes
886932fd23 provision: Update error output on failed yarn install reattempt. 2019-07-08 12:13:34 -07:00
Vishnu Ks
d01ca8a390 circleci: Store XUnit test results.
Fixes part of #8593.
2019-07-07 22:31:11 -07:00
Vishnu Ks
1f250a3fd2 casper: Add support for exporting results as XUnit XML file. 2019-07-07 22:30:01 -07:00
Vishnu Ks
0b35bb96f0 requirements: Upgrade pillow from 5.4.1 to 6.1.0.
Fixes #12193
2019-07-07 22:28:54 -07:00
Vishnu Ks
4f65b50c44 requirements: Upgrade django-otp from 0.5.2 to 0.6.0.
This indirect dependency was upgraded separately since
it contained a migration with autogenerated name.
2019-07-07 22:28:54 -07:00
Vishnu Ks
41f6de1e92 requirements: Upgrade django from 1.11.20 to 1.11.22. 2019-07-07 22:28:54 -07:00
Vishnu Ks
ccf6710cd6 requirements: Upgrade Twisted from 19.2.0 to 19.2.1. 2019-07-07 22:28:54 -07:00
Vishnu Ks
8143b4e47f requirements: Upgrade indirect python dependencies. 2019-07-07 22:28:54 -07:00
Vishnu Ks
b75eb25708 docs: Include DO one click app in release checklist. 2019-07-07 21:49:31 -07:00
Tim Abbott
ffeda5b015 i18n: Update translation data from transifex.
This has the side effect of triggering a `manage.py compilemessages`
for all users of the development environment, fixing a weird state
folks can get into after our recent migration of static/locale to
locale.
2019-07-04 17:08:34 -07:00
Anders Kaseorg
f9dd7a8b4e typing_status.js: Remove var state.
It would conflict with `exports.state` after migration to an ES6
module.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-07-04 16:50:23 -07:00
Anders Kaseorg
84bc2186eb settings_org.js: Remove var parse_time_limit.
It would conflict with `exports.parse_time_limit` after migration to
an ES6 module.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-07-04 16:50:23 -07:00
Anders Kaseorg
653907e26a presence.js: Remove var presence_info.
It would conflict with `exports.presence_info` after migration to an
ES6 module.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-07-04 16:50:23 -07:00
Anders Kaseorg
ba90834a7a info_overlay.js: Remove var toggler.
It would conflict with `exports.toggler` after migration to an ES6
module.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-07-04 16:48:33 -07:00
Anders Kaseorg
24831e5e85 buddy_list.js: Rename var height_to_fill to height.
It would conflict with `exports.height_to_fill` after migration to an
ES6 module.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-07-04 16:48:33 -07:00
Anders Kaseorg
bde31a54c7 bot_data: Rename delete to del.
`delete` is a reserved keyword that would interfere with the migration
to an ES6 module.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-07-04 16:48:33 -07:00
Mateusz Mandera
b8839302c0 retention: Fix migration making archive_transaction field not null.
DELETing from archive tables and ALTERing ArchivedMessage needs to be
split into separate transactions.

zerver_archivedattachment_messages needs to be cleared out before
zerver_archivedattachment.
2019-07-04 16:42:42 -07:00
Tim Abbott
e14a40675b docs: Document changing EXTERNAL_HOST after backup restoration.
Fixes #12704.
2019-07-03 21:08:58 -07:00
YashRE42
dd1a6a97bd group-pms: Update list when new group pm is made.
The function activity.process_loaded_messages(messages) would be called
from message_events.js, this would call people.huddle_string with the
same message object, it was expected that this would return a list of
ids but the message.display_recipient attribute which was being sent
here used a "user_id" field instead of an "id" field.

Fixes: #12503.
2019-07-03 16:39:41 -07:00
Wyatt Hoodes
af4eb8c0d5 export/upload: Refactor tarball upload logic to upload_backend.
The conditional block containing the tarball upload logic for both S3
and local uploads was deconstructed and moved to the more appropriate
location within `zerver/lib/upload.py`.
2019-07-03 15:40:35 -07:00
Wyatt Hoodes
8efb7b903b export.py: Have do_export_realm handle the export tarball.
This change is preliminary refactoring in order to improve the test
mocking strategy related to `test_realm_export.py`.

What this allows is the ability to simply mock a return value from
`do_export_realm`.  We can then use that value as a dummy url to
ensure a file has been served and can be retrieved.
2019-07-03 15:40:35 -07:00
Mohit Gupta
45f87ff44b search: Fix to allow access to group PM containing deactivated users.
Fixes: #12593.
2019-07-03 15:30:19 -07:00
Mohit Gupta
00cdba2090 actions: Add allow_deactivated option when fetching recipients.
Preparatory commit to allow viewing group PM with deactivated
users.
2019-07-03 15:30:15 -07:00
Mohit Gupta
c971576b00 search: Refactor by_pm_with to use user profiles as common path.
Use UserProfiles instead of emails to fetch recipient objects for
narrowing; this is cleaner as it avoids unnecessary parsing and
unparsing.  We just map ids/emails operand to user profiles and then
use common code from there.

Fixes #12601.
2019-07-03 15:29:08 -07:00
Vaibhav
db9e25db0d css: Nest .pill-image inside .pill in input_pill.scss. 2019-07-03 15:06:31 -07:00
Vaibhav
88835b9367 css: Use SCSS nesting in input_pill.scss. 2019-07-03 15:06:31 -07:00
Vaibhav
1c59a4a53c css: Reorder input_pill.scss so .pill-container .pill are in same place. 2019-07-03 15:06:31 -07:00
Rohitt Vashishtha
d6e8bd6515 dependencies: Upgrade markdown from 3.0.1 -> 3.1.1.
Fixes #12192.
2019-07-03 15:06:19 -07:00
Anders Kaseorg
5e97e58df3 webhooks/freshdesk/doc.md: Remove unescape_rendered_html kludge.
This reverts commit f476ec7fac (#10312)
and replaces it with a proper fix using Jinja2 raw blocks.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-03 15:05:45 -07:00
Anders Kaseorg
9f08513acb bundles: Rename commons.js to common.js.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-03 15:03:22 -07:00
Wyatt Hoodes
a238795823 run_casper: Add error output regarding Casper artifacts in CircleCI. 2019-07-03 14:58:48 -07:00
Aman Agrawal
05aa3bcbc1 lint: Make --fix a default arg for zulint.
Since the check for `--fix` is in `zulint/command.py`,
we should keep it as an arg for zulint.
2019-07-03 14:57:31 -07:00
Aman Agrawal
aa5a1cb509 lint: Make zulint independent of extra lint options in ./tools/lint.
Check `options.full` in `pyflakes.py` instead of `linters.py` to
make zulint independent of `./tools/lint`.
2019-07-03 14:57:31 -07:00
Anders Kaseorg
1868e96850 tools/webpack: Don’t import Django.
It added about 150ms to the startup time of running webpack, for no
benefit.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-03 14:52:11 -07:00
Anders Kaseorg
0a08fdd072 .editorconfig: Fix invalid brace patterns.
editorconfig does not support brace patterns with only one
alternative.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-03 14:40:56 -07:00
Puneeth Chaganti
d92af69a03 url preview: Fix CSS to make url preview titles clickable.
06f3cb2b78 added some styling to make the
embed previews prettier, and in particular added a bottom fading gradient to
make the embed description text fade out slowly, when it is out of bounds.
The fading used an ::after pseudo-element which had 100% height of the
`.data-container` which contained the title and the description of the
preview. This pseudo-element got overlaid on the title and made it
un-clickable.

This commit retains the visual appearance of the fade, while reducing the
height of the ::after pseudo element, so that it never gets overlaid on the
title, keeping it clickable always.
2019-07-03 14:38:19 -07:00
Puneeth Chaganti
b10fc1d896 url preview: Don't show a message embed if there's no image. 2019-07-03 14:38:19 -07:00
Wyatt Hoodes
40227171e6 provision: Improve error messaging when attempting to use Ubuntu Trusty.
As part of dropping support, we add appropriate error messaging when a
user attempts to provision while using trusty.  If the user is running
in Vagrant we append information on how to proceed.
2019-07-03 14:32:25 -07:00
Anders Kaseorg
3ded6f53c3 storage: Transfer responsibility for hash-naming webpack files to webpack.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-03 14:16:17 -07:00
Anders Kaseorg
b0a30aa01a storage: Remove RemoveUnminifiedFilesMixin.
This can be done much more easily with the right options to
collectstatic.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-03 14:16:07 -07:00
Anders Kaseorg
f47f98e2f1 storage: Remove AddHeaderMixin.
We should be doing this inside webpack, which would be a lot less
hacky.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-03 14:15:46 -07:00
Anders Kaseorg
0cd6c75ab1 update-prod-static: Remove unused pre-webpack files.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-03 13:58:21 -07:00
Anders Kaseorg
079ddae4c8 minify-js: Remove; everything has been migrated to Webpack.
min/sockjs-0.3.4.min.js is not used.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-03 13:58:21 -07:00
Thomas Ip
3ffe78e483 templates: Fix wrong path to edit-embedded-bot-service template.
This bug is introduced in #12667.
2019-07-03 13:40:01 -07:00
vinitS101
04f3fce761 ldap: Fix LDAP avatar synchronization to check if avatar has changed.
When "manage.py sync_ldap_user_data" is run, user avatars are now only
updated if they have changed in LDAP.

Fixes #12381.
2019-07-02 17:52:48 -07:00
Mateusz Mandera
89ba6d7941 retention: Improve the placement of logging in run_archiving_in_chunks. 2019-07-02 17:33:53 -07:00
Mateusz Mandera
17c5398703 retention: Filter also by transaction type when restoring by realm. 2019-07-02 17:31:07 -07:00
Mateusz Mandera
627238ebe1 retention: Replace all LEFT JOIN IS NULL with ON CONFLICT handling.
Duplicate handling when INSERTing is switched from "LEFT JOIN ... id IS
NULL" approach to "ON CONFLICT (id) DO NOTHING", since we now have
postgresql 9.5. The ON CONFLICT approach is more natural as well as also
potentially being faster,
2019-07-02 17:25:31 -07:00
Mateusz Mandera
df9f86aa5b retention: Do archive cleaning in archive_messages command. 2019-07-02 17:25:31 -07:00
Mateusz Mandera
9f452a6e9a retention: Add logging to the restoring and archive cleaning functions. 2019-07-02 17:25:31 -07:00
Mateusz Mandera
74ba0a7082 retention: Make archive_timestamp field not nullable. 2019-07-02 17:25:31 -07:00
Anders Kaseorg
5f3d36ae87 tex: Bundle KaTeX CLI using Webpack.
We don’t need a hacked copy anymore.  We run the installed version out
of node_modules in development, and a Webpack-bundled version of that
in production.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-02 16:50:03 -07:00
Anders Kaseorg
b0be0d5285 settings_account: Use webpack asynchronous require to load zxcvbn.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-02 16:50:03 -07:00
Anders Kaseorg
f346d0e511 dependencies: Use core-js for String.prototype polyfills.
It seems like the de facto standard ES polyfill library these days,
and we already depend on it through simplebar.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-02 16:50:03 -07:00
Anders Kaseorg
9f074fc071 webpack: Fix production setting of publicPath.
This is needed by webpack asynchronous require.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-02 16:49:38 -07:00
Anders Kaseorg
05663aa3fa webpack: Rectify "common" bundle with bundles/commons.js.
Moving bootstrap-typeahead from bundles/commons.js to bundles/app.js
and csrf.js from bundles/app.js to bundles/commons.js makes
bundles/commons.js equivalent to the "common" bundle, so we can
replace the latter with the former.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-02 16:38:26 -07:00
Anders Kaseorg
1b94733953 webpack: Remove resolve.modules override.
The minimal syntactic sugar it might provide isn’t worth the
unexpected side effects (including side effects on third party
modules).

For now, we allow zrequire to emulate the previous syntax in the Node
test suite, even though stealing part of the NPM namespace is
confusing.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-02 16:38:26 -07:00
Hemanth V. Alluri
7e6bcbeac0 openapi: Allow us to specify an endpoint as being undocumented in urls.
In each url of urls.py, if we want to mark an endpoint as being
intentionally undocumented, then in the kwargs instead of directly
mapping like 'METHOD': 'zerver.views.package.foo', we can provide
a tag called 'intentionally_undocumented' and map like:
'METHOD': ('zerver.views.package.foo', {'intentionally_undocumented'}).

If an endpoint is marked as intentionally undocumented, but we find
some OpenAPI documentation for it then we'll throw an error, in which
case either the 'intentionally_undocumented' tag should be removed or
the faulty documentation should be removed.
2019-07-02 16:34:16 -07:00
Hemanth V. Alluri
e5cb3cabef openapi: Add intentionally_undocumentated parameter to REQ.
This will allow us to mark a REQ variable as intentionally
undocumented. With this, we can remove some of the endpoints marked
as "buggy" even though they're not actually buggy, we just needed to
specify certain parameters as intentionally undocumented (e.g. the
stream_id for the /users/me/subscriptions/muted_topics endpoint.)

Any REQ variable with intentionally_undocumentated set to True
will not be added to the arguments_map data structure.

For some of the other "buggy" endpoints, we would want to mark the
entire endpoint as being undocumented intentionally via. the urls.py
file.
2019-07-02 16:30:33 -07:00
Thomas Ip
f6aaf43029 refactor: Use explicit path when referencing handlebars templates. 2019-07-02 16:23:30 -07:00
Thomas Ip
8c199fd44c webpack: Use handlebars-loader to handle frontend templates.
And remove the compile-handlebars-templates system.
2019-07-02 16:23:29 -07:00
Anders Kaseorg
0334be7053 zproject: Remove unused template tags minified_js, static.
`minified_js` was obsoleted by the Webpack migration and `static` has
never been used.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-02 16:18:23 -07:00
Anders Kaseorg
fc3305b623 webpack: Trim resolve.extensions.
We don’t have any .tsx files, and nobody expects to be able to omit
the extension when importing .json, .scss, or .css files.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-02 16:09:29 -07:00
Anders Kaseorg
11a305e320 zjsunit: Simplify typeRoots path (it’s relative to tsconfig.json).
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-02 16:09:29 -07:00
Tyler B. Thrailkill
85c7eba3f9 css: Call set_layout_width even if the sbwidth is 0.
Historically, the logic that was extracted into set_layout_width only
did something on non-macOS platforms, where sbwidth != 0
(i.e. scrollbars have nonzero width).

However, with the addition of the fluid layout width option, that
function does something if either sbwidth != 0 OR fluid_layout_width
is enabled.  At that point, we should just call that function
unconditionally.
2019-07-02 15:47:03 -07:00
Wyatt Hoodes
2f8e1c0393 circleci: Store var/casper/ and zulip-test-event-log as artifacts. 2019-07-02 15:19:30 -07:00
Anders Kaseorg
b709eeb4d1 third: Remove zocial.
It’s unused since commit 7afbc9ddd6
(#4531).

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-02 15:04:58 -07:00
Anders Kaseorg
d8ed1d4553 third: Remove FormData polyfill.
It has no effect in our supported browsers including IE11.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-02 15:04:58 -07:00
Anders Kaseorg
438c7c46ed third: Get jquery-caret-plugin from NPM.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-02 15:04:58 -07:00
Anders Kaseorg
1647582acf third: Get jquery-autosize from NPM.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-02 15:04:58 -07:00
Anders Kaseorg
b255b90188 package.json: Realphabetize dependencies.
`yarn add` does this for you…

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-02 15:04:58 -07:00
Anders Kaseorg
7b2a605978 provision: Sort system dependencies deterministically.
set iteration order is randomized in Python ≥ 3.3.  That might or
might not have had the potential for causing rare probabilistic bugs,
but if nothing else, it made build logs harder to compare.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-02 15:04:44 -07:00
Anders Kaseorg
bbb56df6b0 i18n: Move static/locale back to locale.
As of commit cff40c557b (#9300), these
files are no longer served directly to the browser.  Disentangle them
from the static asset pipeline so we can refactor it without worrying
about them.

This has the side effect of eliminating the accidental duplication of
translation data via hash-naming in our release tarballs.

This reverts commit b546391f0b (#1148).

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-02 14:57:55 -07:00
Rohitt Vashishtha
d6f5655d0d narrow: Fix incorrect method of querying for operands.
Commit 02413f9a1b introduced a bug
where any code reaching `if(operators('search')` would be executed,
which caused inputs where we didn't have the search operator to
throw an error when we do not find a search operan later.

At least one affected cases was narrowing to an empty topic.
2019-06-30 23:00:23 -07:00
Anders Kaseorg
a1cf77ca54 test-help-documentation: Bind vnu.jar to 127.0.0.1.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-06-28 18:18:29 -07:00
Tim Abbott
e0522b6395 api: Fix broken API documentation tests.
We had gotten to the right documented content, but the previous
chaining of object creation/deletion wasn't quite right.

Fix this in a way that reduces the amount by which tests are dependent
on what other tests are doing.
2019-06-28 18:16:34 -07:00
Tim Abbott
e59a49ade5 activity: Refactor logic for sending active status.
This is a preparatory refactor for extending this logic to interact
with the desktop app as well.
2019-06-28 18:06:31 -07:00
Tim Abbott
793524618b activity: Rename confusing focus_ping function.
This function sends presence to the server and gets the server's
presence data back; it has nothing to do with browser focus.
2019-06-28 18:06:31 -07:00
Tim Abbott
746206f071 activity: Rename has_focus to client_is_active.
This makes it a lot more clear what it actually means, which is not
directly related to whether the browser window is focused.
2019-06-28 18:06:30 -07:00
Tim Abbott
42d29d58a1 activity: Rename focus_lost/focus_gained functions.
These names were incorrect, as they made it sound like this feature
was about the browser window being focused, whereas they are in fact
about whether the user has accessed the browser window.
2019-06-28 17:50:32 -07:00
Puneeth Chaganti
7da6d5a168 narrow: Fix broken narrows for invalid email IDs.
When pm-with or group-pm-with searches had invalid email IDs, the code
to set the narrow title would break. This commit handles that
correctly.
2019-06-28 17:06:20 -07:00
Puneeth Chaganti
91b2ac27ae narrow: Extract test for non existing user narrow. 2019-06-28 16:56:58 -07:00
sameerchoubey
4dcc1b744f api_docs: Add documentation for remove_user_group. 2019-06-28 16:34:39 -07:00
sameerchoubey
d351564798 api_docs: Add documentation for update_user_group. 2019-06-28 16:33:54 -07:00
sameerchoubey
1b2f67f1bf api_docs: Add documentation for create_user_group. 2019-06-28 16:28:56 -07:00
sameerchoubey
f84e84d6c7 api_docs: Add documentation for update_stream. 2019-06-28 16:26:06 -07:00
sameerchoubey
0ceea2713c api_docs: Add documentation for delete_stream. 2019-06-28 16:18:22 -07:00
Mohit Gupta
487861554f search: Fix searching and search suggestion in Group PM.
Fix the .get_suggestions and .get_suggestions_legacy
to correctly handle search terms in group PM and treat
it as search term by not concatenating it at end of pm-with
email list operand.
2019-06-28 12:45:37 -07:00
Tim Abbott
bf9e0c3239 messages: Improve variable names and comments around mirroring.
This should help make this part of the codebase easier to understand.
2019-06-28 12:42:19 -07:00
Vishnu Ks
a5c69fb707 emails: Simplify content styling of missed_message emails.
This is a dramatic redesign of the look and feel of our missed-message
emails, designed to decrease the feeling of clutter and just provide
the content users care about in a clear, visible fashion.
2019-06-28 11:58:52 -07:00
Vishnu Ks
3a6cc4214f emails: Improve the reply wording in missed_message emails.
This cleans up the reply_warning feature in favor of a more coherent
explanation of whether or not one can reply.

(Also, critically, it now advertises the ability to enable
missed-message email replies with some administrative configuration
work.)
2019-06-28 11:53:52 -07:00
Vishnu Ks
f67c85892b emails: Move email preferences to footer. 2019-06-28 11:38:32 -07:00
Soumya Himanish Mohapatra
2688741c67 emails: Improve subject of missed_message email. 2019-06-28 11:38:32 -07:00
Vishnu Ks
66ee5b870a emails: Extract get_narrow_url into a function.
Reorganized a bit by tabbott to avoid doing a bunch of database
queries twice.
2019-06-28 11:38:17 -07:00
Vishnu Ks
443439d388 slack_import: Support importing private slack channels. 2019-06-28 11:03:32 -07:00
Vishnu Ks
196388cee3 slack_import: Extract processing channels into a seperate function. 2019-06-28 11:00:59 -07:00
Rohitt Vashishtha
c03efd2971 markdown: Make backend status message detection logic mimic frontend.
In 93914d8cd8, we intended to change our
markdown processor to add support for multi-line /me messages.
However, we neglected to change the backend processor, resulting in
the change only taking effect for the user sending the message :(.

We fix this by changing the backend processor too.

Fixes #12450.
2019-06-28 10:31:20 -07:00
Rohitt Vashishtha
4489df7cd6 echo: Add tests for echo.process_from_server. 2019-06-28 06:13:41 +00:00
Rohitt Vashishtha
fbd4c389d4 echo: Update is_me_message flag when we get messages back from server.
Fixes #12450.
2019-06-28 06:13:41 +00:00
Rohitt Vashishtha
047086b81c markdown: Make raw urls in topic names navigable.
We reuse the link regexes we use elsewhere inn markdown
for parsing links in topic names and add a button to open
them in new tabs similar to our behavior with linkifiers
in topic names.

Fixes #12391.
2019-06-27 15:18:42 -07:00
Rohitt Vashishtha
96d7c1f3b0 markdown: Test escaping of topic_links and document. 2019-06-27 15:18:30 -07:00
Anders Kaseorg
2d50dcf7cc test-help-documentation: Validate HTML with vnu.jar.
The VNU_IGNORE whitelist lets in some crazy-invalid preexisting HTML,
but hopefully this will stop the problem from getting much larger.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-06-27 14:53:21 -07:00
Anders Kaseorg
f407a12ba2 test-documentation: Validate HTML with vnu.jar.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-06-27 14:53:21 -07:00
Anders Kaseorg
12e6189970 signup, settings: Update password strength meter on input events.
Pasting a generated password into the password box triggers neither a
change event (until the password box is unfocused) nor a keyup event.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-06-27 14:51:19 -07:00
Aman Agrawal
a264c84397 docs: Give additional solutions for "os.symlink error" on windows. 2019-06-27 14:49:47 -07:00
Aman Agrawal
7a3e8c4868 zulint: Add option to list groups using --list-groups. 2019-06-27 14:42:33 -07:00
Aman Agrawal
4424867adc zulint: Show errors in --verbose in a more readable format. 2019-06-27 14:42:33 -07:00
Aman Agrawal
e275457387 zulint: Avoid changing the color of next line by using ENDC.
ENDC was not being applied due to missing `{}` in the end.
2019-06-27 14:42:33 -07:00
Anders Kaseorg
02d19d48fc tooling: Remove static/node_modules symlink.
It appears not to have been useful and makes it marginally harder to
reason about how module resolution works.  Paths to static content in
node_modules should be resolved through Webpack instead.

(This node_modules symlink was originally created in the pre-webpack world
where all of our static asset paths were based in static/.)

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-06-27 14:42:16 -07:00
Tim Abbott
297c79eaa9 api docs: Fix typo in name of has_alert_word message flag. 2019-06-27 11:55:15 -07:00
Anders Kaseorg
23cd064c86 webpack: Elide node_modules when importing JS modules.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-06-26 16:49:32 -07:00
Puneeth Chaganti
c6fcf36c8d documentation: Add open graph metadata for integrations pages. 2019-06-26 16:32:13 -07:00
Puneeth Chaganti
a14d2a5f45 user_info: Extract function get_custom_profile_field_data. 2019-06-26 16:15:08 -07:00
Puneeth Chaganti
3cab98169b casper: Fix link to casper Zulip docs. 2019-06-26 16:15:08 -07:00
Puneeth Chaganti
9c33261728 casper: Add a verbose flag to run casper tests in verbose mode. 2019-06-26 16:15:08 -07:00
Puneeth Chaganti
3bfb08806c docs: Server logs in casper tests are now written inline.
Also, move note about remote debugging to the remote debugging section.
2019-06-26 16:15:08 -07:00
Puneeth Chaganti
0409db3c9d narrow: Improve window titles of is:<type> narrows.
We capitalize the type name, and add a " messages" suffix.
2019-06-26 16:06:22 -07:00
SatyendraBanjare
066c168448 narrow: Window title shows user's name, in private message narrows.
Modified heavily by punchagan to correctly handle narrowing to huddles, and
for `group-pm-with` narrows. Also, fixed broken tests in the original PR.

Closes #5876
2019-06-26 16:06:22 -07:00
Anders Kaseorg
caecd1c2ad install: Disable installation and provisioning on Ubuntu 14.04 Trusty.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-06-26 15:58:53 -07:00
Anders Kaseorg
4e1060b29e docs: Remove references to Ubuntu 14.04 Trusty as a supported platform.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-06-26 15:09:13 -07:00
Rishi Gupta
de2ba4743e compose: Rename New conversation button to New private message.
Right now we have buttons for "New conversation" and "New private message"
in different views, but both buttons do the same thing.

The current state is confusing for new users, since there is already a lot
of terminology one needs to learn in order to understand the Zulip
conversation model. It's very plausible a user would think a "conversation"
is something different from a "private message" or a "topic".
2019-06-26 14:12:24 -07:00
Rishi Gupta
32435bde3f settings: Update strings explaining name/email change restrictions.
Better to be short and to the point.
2019-06-26 14:10:52 -07:00
Rishi Gupta
d84238ce74 ktlo: Contact org admin instead of server admin for wrong subdomain error. (#12543)
Did a quick pass through the codebase; I think this is the only place we
suggest contacting server admin instead of org admin for an issue like this.
2019-06-26 14:09:20 -07:00
Rishi Gupta
02b051b77c stream settings: Simplify text on who can post to public streams.
The UI does not allow you to send a message to a stream you're not
subscribed to, even if the API does.

And since it's clear any member of the organization can join and then send, 
there's no real harm in giving the simpler explanation.
2019-06-26 14:08:05 -07:00
Mateusz Mandera
7950aaea1e retention: Add code for deleting old archive data. 2019-06-26 12:24:47 -07:00
Mateusz Mandera
3fba4cfbba retention: Add restore_messages management command. 2019-06-26 12:21:46 -07:00
Mateusz Mandera
3ac11a3fc5 retention: Use ON CONFLICT DO UPDATE to handle re-archiving properly.
When archiving Messages, we stop relying on LEFT JOIN ... IS NULL to
avoid duplicates when INSERTing. Instead we use ON CONFLICT DO UPDATE
(added in postgresql 9.5) to, in case of archiving a Message that
already has a corresponding archived objects (this happens if a Message
gets archived, restored and then archived again), re-assign the existing
ArchivedMessage to the new transaction.

This also allows us to fix test_archiving_messages_second_time, which
was temporarily disable a few commits before.
2019-06-26 12:05:59 -07:00
Mateusz Mandera
7b2b4435ed retention: Combine run_message_batch_query and run_archiving_in_chunks.
We combine run_message_batch_query and run_archiving_in_chunks
functions, which makes the code simpler and more readable - we get rid
of hacky generator usage, for example.
In the process, move_expired_messages_* functions are adjusted, and now
they archive Messages as well as their related objects.
Appropriate adjustments in reaction to this are made in the main
archiving functions which call move_expired_messages_* (they no longer
need to call move_related_objects_to_archive).
2019-06-26 12:05:59 -07:00
Mateusz Mandera
6e46c6d752 retention: Add functions for restoring archived data.
Functions for restoring archived data are added and existing tests are
expanded to restore data they archived and check correctness.
2019-06-26 12:05:59 -07:00
Mateusz Mandera
9acd3b0f46 retention: Rewrite move_messages_to_archive to use existing functions.
Instead of having a bunch of custom code in the function, we make it use
run_message_batch_query and run_archiving_in_chunks to do the necessary
operations in a consistent way, using the same codepaths as the rest of
the archiving system.
This breaks test_archiving_messages_second_time temporarily, but we will
fix it and re-enable the test in the next commits, where we'll address
various other issues with re-archiving of messages.

We also remove the @transaction.atomic wrapper, because atomicity is
handled by the logic inside run_archiving_in_chunks.
2019-06-26 12:05:59 -07:00
Mateusz Mandera
5b20317379 retention: Add __str__ method to ArchiveTransaction. 2019-06-26 12:05:59 -07:00
Mateusz Mandera
c869ea8e1e test_retention: Factor out a class with shared helper functions. 2019-06-26 12:05:59 -07:00
Mateusz Mandera
7fc48f8b93 test_retention: Check if messages get deleted when archiving.
We add additional checks in _verify_archive_data to make sure the
archived Messages and UserMessages are deleted from their normal tables.
2019-06-26 12:05:59 -07:00
Mateusz Mandera
80b834dd1b retention: Update move_rows() function code.
We make minor changes to the move_rows() function to allow its use in
the code for restoring from the archive.
2019-06-26 12:05:59 -07:00
Mateusz Mandera
e3fe66a084 retention: Set savepoint=False on atomic wrapper on move_rows().
Savepoints create unnecessary overhead, and there's no benefit from
them, with the way we use this function.
2019-06-26 12:05:59 -07:00
Mateusz Mandera
5d8d5910a8 retention: Log archive_transaction id and information. 2019-06-26 12:05:59 -07:00
Mateusz Mandera
a2cce62c1c retention: Use new ArchiveTransaction model.
We add a new model, ArchiveTransaction, to tie archived objects together
in a coherent way, according to the batches in which they are archived.
This enables making a better system for restoring from archive, and it
seems just more sensible to tie the archived objects in this way, rather
the somewhat vague setting of archive_timestamp to each object using
timezone_now().
2019-06-26 12:05:59 -07:00
Anders Kaseorg
e8d49330f2 templates: Replace logic helpers with sensible logic helpers.
`if_not_a_or_b_and_not_c`?  Really?

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-06-26 12:03:53 -07:00
Tim Abbott
aea1279e8c puppet: Remove trusty configuration for static_asset_compiler.
Trusty is desupported.
2019-06-26 11:32:06 -07:00
Tim Abbott
8fbd965ab5 puppet: Remove legacy pgtune related configuration for trusty.
Since we no longer support Ubuntu Trusty, we no longer need this
backwards-compatibility cruft (which we only kept around to avoid
randomizing configuration for existing systems).
2019-06-26 11:32:06 -07:00
Anders Kaseorg
33c941407b puppet: Remove legacy unauthenticated local uploads backend.
This was only used in Ubuntu 14.04 Trusty.

Removing this also finally lets us simplify our security model
discussion of uploaded files.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-06-26 11:31:46 -07:00
Anders Kaseorg
6112d020f4 migrate, create_large_indexes: Use CREATE INDEX IF NOT EXISTS.
We no longer support Postgres versions missing this syntax.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-06-26 11:01:30 -07:00
Anders Kaseorg
bfa82a70c8 ci: Remove Ubuntu 14.04 (trusty) from CI.
Tweaked by tabbott to improve our CI docs discussion of these.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-06-26 11:01:13 -07:00
Anders Kaseorg
b4204e7cfd Remove legacy (pre-Vagrant) Docker development environment setup.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-06-26 10:58:02 -07:00
Hemanth V. Alluri
cd9c1bfb9d devtools: Update the send_all feature of the integrations tool for headers.
Now that we have a system for storing HTTP headers for each integration, we
should fix the send_all button. Previously, it used the same user entered
custom HTTP header (from the GUI) for all of the fixtures, but now we
automatically determine the header with the new system instead.
2019-06-26 10:35:16 -07:00
Hemanth V. Alluri
ef52aa0fc1 webhooks: Eliminate the usage of a headers.py file.
For storing HTTP headers as a function of fixture name, previously
we required that the fixture_to_headers method should reside in a
separate module called headers.py.

However, as in many cases, this method will only take a few lines,
we decided to move this function into the view.py file of the
integration instead of requiring a whole new file called headers.py

This commit introduces the small change in the system architecture,
migrates the GitHub integration, and updates the docs accordingly.
2019-06-26 10:35:14 -07:00
Hemanth V. Alluri
4691028097 webhooks: Extract the '__' method of mapping to headers.
In the GitHub integration we established that for many integrations,
we can directly map the fixture filename to the set of required
headers and by following a simple naming convention we can greatly
ease the logic involved in fixture_to_headers method required .

So to prevent the need for duplicating the logic used by the GitHub
integration, we created a method called `get_http_headers_from_filename`
which will take the name of the HTTP header (key) and then return a
corresponding method (in a decorator-like fashion) which could then be
equated to fixture_to_headers in headers.py.

The GitHub integration was modified to use this method and the docs
were updated to suggest using this when possible.
2019-06-26 10:32:34 -07:00
Tim Abbott
271319fb13 puppet: Fix hacky release test for whether we're in EC2.
The result is still a bit hacky, but guaranteed to be correct if we
adjust the OS version of our systems, which we of course will do over
time.
2019-06-25 22:19:04 -07:00
Tim Abbott
8d8cfb314b puppet: Remove zulip_ops configuration for trusty.
There are no longer any zulip_ops systems using trusty.
2019-06-25 22:09:06 -07:00
Pragati Agrawal
e42abc2396 org_settings: Optimize data collected by populate_data_for_request.
With the help of `check_property_changed` function now we collect the data
whose values are changed from the current one. Currently this optimizes
only for those elements whose values are collected by
`populate_data_for_request` function i.e. it doesn't optimize data
collected by `get_complete_data_for_subsection`.
2019-06-25 16:57:59 -07:00
Pragati Agrawal
bdbf63ed27 org_settings: Move populate_data_for_request down.
This is preliminary commit which moves `populate_data_for_request` function
down after the definition of all functions with which it will interact in
the future.
2019-06-25 16:57:59 -07:00
Pragati Agrawal
81492362d7 org_settings: Refactor populate_data_for_request.
This is a preliminary commit which refactors `populate_data_for_request`
function, now this function traverse on all "property elements" of a given
subsection, but get the data only of those properties which have
`setting-widget-type` data attribute. Therefore, it doesn't change the
functionality of this function and overall changes don't make any
difference. In upcoming commits, we're going to use `input_elem` as an
argument to `check_property_changed` function, so that only those elements
whose values are changed are sent to the backend.
2019-06-25 16:57:59 -07:00
Pragati Agrawal
d200d662d7 org_settings: Move get_subsection_property_elements from build_page.
This moves `get_subsection_property_elements` out from the local context of
`settings_org.build_page` function, as it was unnecessarily initialized at
the time of page setup.
2019-06-25 16:57:59 -07:00
Pragati Agrawal
15ff8fb73f settings: Fix sort order display settings.
This fixes the mis-alphabetized `fluid_layout_width` at few places in
the codebase, along with that it also fixes sorting order of
`property_types` dictionary in models.py and few model fields of
`UserProfile` model class.
2019-06-25 16:57:06 -07:00
Tim Abbott
216267e279 Revert "message_edit: Change scroll calculations based on .message_content."
This reverts commit edc5337d53.

This somehow broke the 08-edit casper test.
2019-06-24 23:29:28 -07:00
Anders Kaseorg
bac63f5a3e documentation_crawler: Reimplement crawl_with_status so it wraps crawl.
This way we inherit more of the upstream command’s behavior.
Importantly, this means we pass everything in `opts.spargs` to the
spider, not just `opts.spargs.skip_external`.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-06-24 23:20:17 -07:00
Anders Kaseorg
a37fa74dce templates: Fix new low-hanging HTML validation problems.
"http://localhost:9981/api/update-message-flags":318.16-319.34: error: “th” start tag in table body.
"http://localhost:9981/api/update-message-flags":344.35-344.38: error: Stray end tag “a”.
"http://localhost:9981/api/incoming-webhooks-walkthrough":412.4-412.77: error: An “img” element must have an “alt” attribute, except under certain conditions. For details, consult guidance on providing text alternatives for images.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-06-24 23:20:17 -07:00
Eeshan Garg
daea9a543b webhooks/bitbucket2: Account for missing username in PR payloads.
Certain PR payloads do not have a username for the reviewer, in
such cases, we just return the reviewer's nickname or display
name.
2019-06-24 23:19:06 -07:00
Tim Abbott
f9aef15e72 message_edit: Clean up comments around scroll position. 2019-06-24 22:53:57 -07:00
Vaibhav
edc5337d53 message_edit: Change scroll calculations based on .message_content.
This concerns the part where the message viewport is scrolled in
order to keep the message content and edit box textarea at the same
vertical position.

Earlier calculations involved use of `.message_top_line`. Similar
adjustments can be made using only the message_content (which also
makes the calculation simpler).
2019-06-24 22:49:42 -07:00
Tim Abbott
6763e77ee2 api docs: Fix syntax for get-user-groups.
This apparently had some sort of rebase conflict issue with the
migration to the nicer syntax for tabs.
2019-06-24 22:24:46 -07:00
Pragati Agrawal
2e97b03b2b css: Use SCSS nesting in settings.scss for .new-style. 2019-06-24 22:14:13 -07:00
Pragati Agrawal
b30ae0b7f5 css: Remove redundant #settings from settings.scss.
This commit removes `settings` element from setiings.scss since now no
such element exists.
2019-06-24 22:12:42 -07:00
Pragati Agrawal
45677990fd css: Remove redundant #organization from settings.scss.
This commit removes the redundant `#organization` from settings.scss as
organization id no longer exists.
2019-06-24 22:12:42 -07:00
Vaibhav
fa85b92eda populate_db: Add MD content to stream descriptions and user bio.
This adds a 'bold' element to `all` stream and 'code' element to
`test` stream in populate_db. Also changes the bio for Hamlet to
include a list.
2019-06-24 22:10:24 -07:00
Vaibhav
6e05131e9a markdown: Add .rendered_markdown to elements in with MD content.
These elements include:
* Stream description in the subscription overlay
  * sidebar and
  * stream settings
* Custom profile fields with rendered MD content
2019-06-24 22:10:24 -07:00
Vaibhav
336ea98dd9 css: Remove buggy white-space style from profile modal content.
This is to make the user profile settings rendered content in accordance
to the message box styling.
2019-06-24 22:10:24 -07:00
Anders Kaseorg
0f30c8c4ba dev-vagrant-docker: Upgrade docker-systemctl-replacement.
This fixes the 45 second boot delay bug.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-06-24 22:06:32 -07:00
Yago González
4dc206ad2e api docs: Document PATCH /settings/notifications.
With significant tweaks by tabbott after rebasing.
2019-06-24 18:42:44 -07:00
Thomas Ip
80f972d42c webpack: Use correct types in config.
Cache-loader is used as an item in the use member so the correct
type should be RuleSetUseItem not RuleSetRule.
See: DefinitelyTyped/DefinitelyTyped/webpack/index.d.ts#L498
2019-06-24 17:58:51 -07:00
Thomas Ip
637b2b784a dependencies: Upgrade mini-css-extract-plugin to 0.6.0 and use HMR.
Given mini-css-extract-plugin can now do hot module replacement,
this commit also removed css-hot-loader. Not upgrading to 0.7.0
as that cause webpack to crash.
2019-06-24 17:58:51 -07:00
Thomas Ip
413c3066f0 dependencies: Upgrade to ts-loader 6.0.2. 2019-06-24 17:58:27 -07:00
Thomas Ip
1c99cb320e dependencies: Upgrade swagger-parser to 6.0.5.
4.0.0 changed how options worked but we didn't use that so no
changes needed.
2019-06-24 17:58:27 -07:00
Thomas Ip
6f2a909e22 dependencies: Upgrade style-lint to 10.0.1. 2019-06-24 17:58:27 -07:00
Thomas Ip
308d7bb8f5 dependencies: Upgrade cache-loader to 4.0.0. 2019-06-24 17:58:27 -07:00
Thomas Ip
90a011a3c4 dependencies: Upgrade nyc to 14.1.1. 2019-06-24 17:58:26 -07:00
Thomas Ip
7738273e5a dependencies: Upgrade style-loader to 0.23.1. 2019-06-24 17:58:26 -07:00
Thomas Ip
380114d709 dependencies: Upgrade lazysizes to 5.1.0. 2019-06-24 17:58:26 -07:00
Thomas Ip
1bfb5e48fe dependencies: Upgrade file-loader to 4.0.0. 2019-06-24 17:58:26 -07:00
Thomas Ip
e17fb33b47 dependencies: Upgrade katex to 0.10.2.
The markup output changed but the rendering is the same, so modified
expected output in tests.

There is a regression introduced in one of the new versions of KaTeX,
which produces a warning in our node tests:
```
No character metrics for ' ' in style 'Main-Bold'
```
but the rendering is correct so we can ignore it.
Tracking issue: KaTeX/KaTeX#1994

Fixes #12472.
2019-06-24 17:58:26 -07:00
Thomas Ip
8fd55cea9d dependencies: Upgrade jsdom to 15.1.1. 2019-06-24 17:58:26 -07:00
Thomas Ip
f92d244930 dependencies: Remove cssstyle, htmlparser2, nwmatcher & xmlhttprequest.
All of these are no longer needed.
2019-06-24 17:58:26 -07:00
Thomas Ip
aabf041d69 dependencies: Upgrade css-loader to 2.1.1. 2019-06-24 17:58:26 -07:00
Thomas Ip
caa860f7a2 dependencies: Upgrade @types/node to 12.0.7. 2019-06-24 17:58:26 -07:00
Thomas Ip
e3ab233a68 dependencies: Upgrade webpack to 4.33.0. 2019-06-24 17:58:26 -07:00
Pragati Agrawal
747e797092 stream settings: Disable Mobile notifications if push bouncer not set up.
This commit disables "Mobile notifications" if `push_notifications` are not
enabled. It also adds a tooltip explaining why this is disabled.

Fixes #12208
2019-06-24 14:46:45 -07:00
Yashashvi Dave
84234cabcb stream settings: Disable click handler on label for mute settings.
If stream setting is disabled, setting-checkbox can not be
clicked. Although, it does allow to change value by clicking
on setting label.
This commit fixes above bug and disable click handler on
setting-label for disabled stream settings.
2019-06-24 14:46:45 -07:00
Yashashvi Dave
02e82ef10c static/js/stream_events: Deduplicate notification settings updates. 2019-06-24 14:46:45 -07:00
Yashashvi Dave
5c88475378 static/js/stream_data: Deduplicate notification setting updates.
Commit also add `stream_data.js` to full test covered
enforced files for `test-js-with-node` tests.
2019-06-24 14:46:45 -07:00
Yashashvi Dave
e0a78af494 static/js/stream_data: Extract function receives_notifications. 2019-06-24 14:46:45 -07:00
Yashashvi Dave
88f3325970 stream settings: Deduplicate stream settings click handlers. 2019-06-24 14:46:45 -07:00
Yashashvi Dave
1b9c1a7898 stream settings: Deduplicate template rendering. 2019-06-24 14:46:45 -07:00
Yashashvi Dave
30821dbcbb handlebars: Register if_equal handlebar helper.
`if_equal` execute conditional code if both
conditions are equal in templates.
2019-06-24 14:46:45 -07:00
Yashashvi Dave
1f5720d1b8 stream settings: Add name attr to settings elements.
Add `name` attribute to stream settings `input` elements
and change `id` attribute corresponding to name.
`name` attribute stores value of settings name which is
stored in frontend data sets.
2019-06-24 14:46:45 -07:00
Yashashvi Dave
de1f4066ba stream settings: Change settings element-id to match with pattern.
Change element ids of `is_muted` and `pin_to_top` settings,
to macth with the pattern of other stream settings.

This is preparatory refactor to support removing code duplication in
the stream settings templates.
2019-06-24 14:46:22 -07:00
Yashashvi Dave
02e7655c4e display settings: Deduplicate display settings click handlers. 2019-06-24 14:41:53 -07:00
Yashashvi Dave
47f9cbf824 display settings: Deduplicate template rendering. 2019-06-24 14:41:53 -07:00
Tim Abbott
83c2287da2 docs: Add some basic documentation on linter options. 2019-06-24 14:24:31 -07:00
Thomas Ip
a2de8ab44f lint: Add --fix option to ./tools/lint.
Linters with the fix option are stylelint, eslint and puppet-lint.
2019-06-24 14:13:04 -07:00
Yashashvi Dave
c0ecd06f31 help docs: Add message formatting keyboard shortcuts. 2019-06-24 14:08:57 -07:00
Yashashvi Dave
c667e16a29 keyborad shortcuts: Document message formatting keyboard shortcuts.
Fixes #12246
2019-06-24 14:08:50 -07:00
Yashashvi Dave
fed64cc59d static/js/common: Extract function adjust_mac_shortcuts. 2019-06-24 14:04:42 -07:00
Yashashvi Dave
251ed94bfc static/js/common: Use platform navigator to detect MacOS.
Replace `userAgent` navigator with `platform` navigator
to detect user's OS.
2019-06-24 14:04:42 -07:00
Yashashvi Dave
371343709b static/js/common: Extract function has_mac_keyboard. 2019-06-24 14:04:42 -07:00
Hemanth V. Alluri
e2549b3b84 webhooks: Replace headers parsing logic with a common source.
When parsing custom HTTP headers in the integrations dev panel, http
headers from fixtures system and the send_webhook_fixture_message
we now use a singular source of logic: standardize_headers which
will take care of converting a dictionary of input headers into a
standard form that Django expects.
2019-06-24 13:23:21 -07:00
YashRE42
50d43902fb narrows: Show invalid banner for invalid narrows.
Some search queries always return empty because of how we handle search,
this adds text that ensures users trying bad searches realize that they
are doing so.
2019-06-24 13:14:10 -07:00
YashRE42
02413f9a1b search: Show stopwords in multi-operator search.
Fixes #10592.
2019-06-24 13:08:08 -07:00
YashRE42
450e675b11 night-mode: Fix invite_user_form overlap bug.
Adding the element for the invite link would cause the modal footer to
shift upwards, in nightmode this caused the stream list to appear
beneath the footer as the footer background was transparent. This commit
replaces that styling with a solid equivalent color.
2019-06-24 13:00:49 -07:00
YashRE42
8fe86e5e24 tooltips: Fix alignment with keyboard-icon. 2019-06-24 12:57:52 -07:00
YashRE42
ae6e99ae34 tooltips: Fix doubling of keyboard-icon.
This fixes a bug where the default fade-in animation of bootstrap tool
tips caused the tool tip over the keyboard-icon to change shape slightly
while fading away.

Fixes #11766.
2019-06-24 12:57:48 -07:00
Wyatt Hoodes
bc4e7627d6 docs: Add documentation for var/<uuid>/test-backend/. 2019-06-24 12:50:13 -07:00
Wyatt Hoodes
6670b15234 provision: Clean up var/ for the move to var/<uuid>/test-backend. 2019-06-24 12:42:00 -07:00
Wyatt Hoodes
b1fe1ef42b test-backend: Clean up leak data import files after test-suite run.
This is a simple, non-intrusive way of removing the bulk of the
clutter from `var/<uuid>/test-backend` after running `test-backend`.

Ideally, we'll replace this logic with proper tearDown methods.
2019-06-24 12:39:56 -07:00
Wyatt Hoodes
0d20e0e9d5 test-backend: Move test-upload dirs to var/<uuid>/test-backend. 2019-06-24 12:23:09 -07:00
Wyatt Hoodes
fb58b54293 test-backend: Move test_messages.json to var/<uuid>/test-backend. 2019-06-24 12:23:09 -07:00
Wyatt Hoodes
3c1982ecab wsgi.py: Fix broken error ouput for django.setup() call.
It's common for a broken settings.py file to result in Django not
starting, thus never writing to `/var/log/zulip/errors.log`.  Such
behavior can be discouraging when the server 500s without a traceback
to accompany it.  To fix this, we simply catch any exceptions in
django.setup(), if raised, and log the exception appropriately.

Comments tweaked by tabbott.

Closes: #7032.
2019-06-24 12:19:51 -07:00
Thomas Ip
b44d97688d eslint: Convert 0 to off in config. 2019-06-23 23:17:55 -07:00
Thomas Ip
71caf114fb eslint: Convert 2 to error in config. 2019-06-23 23:17:55 -07:00
Puneeth Chaganti
9f916f78da upgrade-zulip-from-git: Fetch tags to make version info more useful.
To be able to show more detailed git information in ZULIP_VERSION, we need
to fetch tags when running `upgrade-zulip-from-git`.
2019-06-23 23:10:47 -07:00
Aman Agrawal
8fc7c89874 zulint: Add --verbose arg to print good/bad lines in error.
This argument probably still needs some iteration, but it's already
useful.
2019-06-23 22:24:46 -07:00
Aman Agrawal
8eee19a160 lint: Add descriptions for all the linters. 2019-06-23 22:23:15 -07:00
Aman Agrawal
6d42b2392b zulint: Print description of linter with it in --list. 2019-06-23 22:23:15 -07:00
Aman Agrawal
e236d39ef1 zulint: Add option to specify description of linter functions.
Extract description of function from __doc__ if used as wrapper.
2019-06-23 22:23:15 -07:00
Aman Agrawal
e9ff9e34b3 lint: Use --groups to specify specific groups to run.
This helps generalize the use of groups inside zulint.
Introduce list_files to return `by_lang` files dict.
Add feature to create custom groups.
Make custom groups for backend and frontend files.
2019-06-23 22:23:15 -07:00
Aman Agrawal
b5b3d9bd5f zulint: Refactor duplicate error printing code into print_error. 2019-06-23 21:59:00 -07:00
Aman Agrawal
7b7e887386 lint: Pass args to LinterConfig when initializing it.
This makes it easy to use args inside LinterConfig.
2019-06-23 21:55:02 -07:00
Aman Agrawal
0b12ec1417 lint: Initialize logger inside zulint.
This also helps move verbose_timing logic inside zulint.
2019-06-23 21:55:02 -07:00
Aman Agrawal
b6d4438726 lint: Pass args instead of passing individual attributes to do_lint.
Pass the args to linter_config.do_lint.
2019-06-23 21:55:02 -07:00
Aman Agrawal
b2b49089fd tools: Extract get_provisioning_status check logic.
Move get_provisioning_status check logic into
assert_provisioning_status_ok and use it instead of duplicating the
check code.
2019-06-23 21:55:02 -07:00
Shubham Padia
80a3651cf3 auth: Let user choose emails in GitHub auth.
Previously, our Github authentication backend just used the user's
primary email address associated with GitHub, which was a reasonable
default, but quite annoying for users who have several email addresses
associated with their GitHub account.

We fix this, by adding a new screen where users can select which of
their (verified) GitHub email addresses to use for authentication.

This is implemented using the "partial" feature of the
python-social-auth pipeline system.

Each email is displayed as a button. Clicking on that button chooses
the email. The email value is stored in a hidden input above the
button. The `primary_email` is displayed on top followed by
`verified_non_primary_emails`. Backend name is also passed as
`backend` to the template, which in our case is GitHub.

Fixes #9876.
2019-06-23 21:27:04 -07:00
Tim Abbott
f8b0727e5a test-backend: Check for venv before importing modules like ujson.
Previously, we were giving the wrong error message when running
test-backend not inside the Zulip venv if ujson wasn't installed on
the machine.
2019-06-23 16:12:21 -07:00
Hemanth V. Alluri
720c866e06 devtools: Tweak the integrations tool to use http headers fixtures.
Now that we store HTTP headers in a way that is easy to retreive
by specifying the integration name and fixture name, we should
use it to pre-load the "Custom HTTP Headers" field in the
integrations dev panel.
2019-06-20 16:40:42 -07:00
Hemanth V. Alluri
37d90d9add webhooks: Migrate the GitHub integration to new http headers system.
Idea courtesy of tabbott. See PR #12515 for more details.
2019-06-20 16:37:42 -07:00
Hemanth V. Alluri
7c145c3f68 webhooks: Add a system for storing http headers for integrations.
Using this system, we can now associate any fixture of any integration
with a particular set of HTTP headers. A helper method called
determine_http_headers was introduced, and the test suite was upgraded
to use determine_http_headers.

Comments and documentation significantly edited by tabbott.
2019-06-20 16:36:38 -07:00
Tim Abbott
1817f657ee models: Rename get_admin_users to get_admin_users_and_bots.
This provides much more clarity that administrative bot users are
included in this query as well.
2019-06-20 14:36:15 -07:00
Tim Abbott
4eb9d67b70 models: Extract get_human_admin_users function.
This function is an alternative to get_admin_users that we use in all
places where we explicitly want only human administrative users (not
administrative bots).  The following commits will rename
get_admin_users for better clarity.
2019-06-20 14:32:30 -07:00
Aman Agrawal
aa217efdbe lint: Add rule to ban rgb(a) in css/scss files, use hsl(a) instead. 2019-06-20 11:34:59 -07:00
Aman Agrawal
904422d8bc css: Convert colors from rgba to hsla format. 2019-06-20 11:34:59 -07:00
Aman Agrawal
3e589cf65e css: Convert colors from rgb to hsl format.
Note that we are not converting the stream colors.
2019-06-20 11:34:34 -07:00
Thomas Ip
549338dc50 refactor: Use variables for repeated colors in alerts.scss. 2019-06-20 11:20:29 -07:00
Thomas Ip
1fa82b9dea refactor: Extract display and animation properties from alert styling. 2019-06-20 11:20:29 -07:00
Yashashvi Dave
25dbda1e53 stream settings: Fix bug in deactivate stream modal appearance.
Stream deactivation modal should be append to main
unique id, stream overlay element.
This commit also add `new-style` class to modal.

Fixes #12394
2019-06-20 11:09:52 -07:00
Puneeth Chaganti
b530c87d26 create_user: Try to read password file only when param specified.
The argument parser has default empty values set for the options
`--password` and `--password-file`, and this causes the script to try and
read a password file even when the argument was not provided.
2019-06-20 11:04:17 -07:00
Puneeth Chaganti
9576ce589d check_user: Get rid of incorrect encode call for initial password. 2019-06-20 11:04:17 -07:00
Hemanth V. Alluri
51793f70cf docs: Provide link to available message flags from get-messages. 2019-06-19 11:44:48 -07:00
Mohit Gupta
db3d81613b decorator: Refactor @require_non_guest_human_user decorator.
Rename @require_non_guest_human_user to @require_member_or_admin.
This is a refactor commit prior to introduction of Administrator
Bots.
2019-06-18 17:11:58 -07:00
Tim Abbott
4818011199 zulint: Add a basic README. 2019-06-18 12:25:46 -07:00
Aman Agrawal
6d040d330c lint: Add --list arg which lists all the registered linters. 2019-06-18 11:32:04 -07:00
Aman Agrawal
6457c1f7c6 lint: Generalize --skip arg and move logic to zulint/command. 2019-06-18 11:32:04 -07:00
Aman Agrawal
995b357cde lint: Add --only agr to run only the specified linters. 2019-06-18 11:32:04 -07:00
Aman Agrawal
cf8653945f lint: Rename commit_messages to gitlint.
Use `gitlint` name to register gitlint linter since it is the commonly
used name for it.
2019-06-18 11:32:04 -07:00
Aman Agrawal
6b73926e93 lint: Add --skip arg to replace --no-gitlint/mypy.
Use --skip=gitlint,mypy instead of --no-gitlint/mypy.
2019-06-18 11:32:04 -07:00
Aman Agrawal
426a222b7e lint: Rename --verbose to --verbose-timing. 2019-06-18 11:32:04 -07:00
Aman Agrawal
dcd46f1c11 lint: Move shebang_rules out of RuleList class to generalize it.
shebang_rules was moved to custom_check.py. Also add shebang_rules only
to those rules which need it.
2019-06-18 11:27:59 -07:00
Aman Agrawal
db25c0c2ca lint: Combine functions in custom_rules into RuleList class.
This makes linting rules in zulint more general. Make necessary
changes in tools/lint and tools/custom_check.py to run with the new
RuleList class.

Modify tests for `RuleList` class. Tests only include minor changes to
test with the new class.
2019-06-18 11:27:50 -07:00
Tim Abbott
fd25ced43c import: Fix check for whether data-user-id is present.
Apparently, the `in` keyword in Beautiful Soup does something different.
2019-06-18 11:13:32 -07:00
Tim Abbott
649e363ee3 import: Fix handling of legacy and wildcard mentions.
Our recently-added code for rewriting user IDs on data import didn't
correctly handle wildcard mentions and mentions generated by very old
versions of Zulip (pre data-user-id).
2019-06-18 10:35:01 -07:00
Tim Abbott
2538f84447 import: Fix bad database query for first_message_id.
The previous query ended up doing an awkward join that did not
guarantee use of the Recipient index on zerver_message, turning a very
fast query into something that could take much longer for a single
stream than the rest of the import combined.
2019-06-18 10:25:00 -07:00
Pragati Agrawal
5af8b980fe css: Remove redundant #settings from zulip.scss.
Since `settings` element no longer exists, hence removing it from
zulip.scss.
2019-06-18 10:09:23 -07:00
Pragati Agrawal
6105b05f50 css: Remove redundant #organization from zulip.scss.
This has been dead code since 1143ed7219.
2019-06-18 10:03:35 -07:00
Tim Abbott
a716b09a3f upgrade-zulip-from-git: Fix handling of errors in git clone.
Apparently, the `chown -R` would never run if the original clone
attempt had networking errors, leading to inability to use
upgrade-zulip-from-git without manual intervention.
2019-06-18 10:00:50 -07:00
Priyank Patel
d7b4de2348 messages: Add support for passing user IDs for pm-with clause.
We also document support for user IDs in the pm-with narrow operator.

Edited by tabbott to document on /api rather than in the /help page.

Fixes part of #9474.
2019-06-17 17:38:51 -07:00
Priyank Patel
33e798168a docs: Declare the markdown code block to be json.
This just adds json syntax highlighting to api documentation page
at /api/construct-narrow.
2019-06-17 17:38:18 -07:00
Priyank Patel
e3431976ce validator: Add validator for checking string or integer list.
This validator will be used to check if string or user IDs list is
passed in.
2019-06-17 17:33:58 -07:00
Hemanth V. Alluri
b8268c66d5 webhooks/bitbucket3: Add the diagnostics:ping event.
Note: Unlike with the other events supported by this webhook so far,
to determine this event's event type, we need to use the X-Event-Key
HTTP Header.
2019-06-17 17:33:32 -07:00
Tim Abbott
09e57389ca Revert "settings_profile_fields: Refactor read_field_data_from_form."
This seems to have made our Casper tests fail.

This reverts commit e3237cdee2.
2019-06-17 16:35:57 -07:00
Tim Abbott
9760c8cfc9 tools: Fix postgres-init-*-db cache handling.
Previously, it didn't properly update the stamp files that determine
our caching behavior, so if one ran test-backend afterwards, nothing
would happen.

A secondary issue that this commit does not fix is that provision will
end up rerunning the whole thing.
2019-06-17 16:24:13 -07:00
Tim Abbott
544f9c74ce export: Use outbox emoji for managing who is exported.
This is a little more unambiguous.
2019-06-17 16:10:28 -07:00
Yashashvi Dave
e3237cdee2 settings_profile_fields: Refactor read_field_data_from_form.
This is important setup for supporting external account type fields.
2019-06-17 15:02:36 -07:00
Yashashvi Dave
0b4384f4cd custom profile fields: Extract function validate_custom_field_data. 2019-06-17 14:56:02 -07:00
Wyatt Hoodes
e7b9b93f84 test-backend: Move bot_avatar to var/<uuid>/test-backend. 2019-06-17 13:56:34 -07:00
Wyatt Hoodes
fbcb05dae6 test-backend: Move test-log-dir to var/<uuid>/test-backend. 2019-06-17 13:56:34 -07:00
Wyatt Hoodes
dd339a57af test-backend: Move import/export ouput into var/<uuid>/test-backend. 2019-06-17 13:51:40 -07:00
Wyatt Hoodes
8e626d3db3 zulip_tools: Add a function to get or create the var uuid path. 2019-06-17 13:51:40 -07:00
Tim Abbott
ff38d125b1 settings: Configure LDAP avatar synchronization in dev environment.
This should make it a lot more convenient to do manual testing of
these common LDAP configuration options.
2019-06-17 13:18:36 -07:00
Tim Abbott
88b77af54f puppet: Add support for changing the nginx port directly.
This provides a clean process for changing Zulip's nginx port.
2019-06-17 12:24:22 -07:00
Tim Abbott
efe5e53118 docs: Update list of links to not check in tests. 2019-06-17 12:24:22 -07:00
Tim Abbott
e6cb83b6e9 docs: Add a new heading section on Casper debugging.
Also enhance the error output from the casper tool.
2019-06-16 22:20:41 -07:00
Thomas Ip
4049a19e0e docs: Update and polish docs on the static asset pipeline.
Tweaked by tabbott to make the claims about new modules in TypeScript
more muted.
2019-06-16 19:09:45 -07:00
Fabian Stanke
51ba9ddd89 postfix: Inserted compulsory setting for postfix ≥ 2.10.
One of smtpd_relay_restrictions or smtpd_recipient_restrictions is
required by postfix ≥ 2.10 (see
http://www.postfix.org/SMTPD_ACCESS_README.html).

This is important for using the email mirror on Ubuntu Bionic.
2019-06-16 18:48:39 -07:00
Benjamin Melançon
b633092ff1 settings: Fix linkifier settings page example.
The Linkifier settings page example crossed wires with GitHub commit
hashes and issue IDs.

Fixes #12591
2019-06-16 16:40:36 -07:00
Wyatt Hoodes
496671b04a docs/git: Fix small grammatical error. 2019-06-16 16:28:39 -07:00
Tim Abbott
b41c2d93d1 puppet: Exclude squashfs filesystems from nagios disk checks.
These generally aren't being written to.
2019-06-16 16:22:23 -07:00
Tim Abbott
0ec1b4e82c puppet: Move check_send_receive_time to the _once ruleset.
We don't actually want to run this bundle of message-sending Nagios
checks to run on every single server.
2019-06-16 15:48:35 -07:00
Tim Abbott
df83979c76 zulip_ops: Extract a prod_app_frontend_once ruleset. 2019-06-16 15:48:35 -07:00
Tim Abbott
d2fbd62b63 install: Fix argument parsing for no-overwrite-settings option.
This had the same bug as our other recent change to the install
script.
2019-06-16 15:24:20 -07:00
Tim Abbott
738cfe54c3 puppet: Move app_frontend_once out of prod configuration.
That logic made it inconvenient to run multiple prod servers with the
same top-level puppet configuration.
2019-06-16 15:24:20 -07:00
Eeshan Garg
f645de255c webhooks/jira: Avoid UnboundLocalErrors for event handler functions.
If the event key is None, the handler content_func never gets
defined, which leads to an UnboundLocalError. This can be easily
avoided by having a dedicated function that handles the case for
when the event key is None.
2019-06-16 15:19:53 -07:00
Thomas Ip
0253ef12c6 popovers: Encode brackets in URI to avoid conflict with markdown links.
This fixes an issue where one could end up with a `(` in the markdown
syntax for a link after copy-pasting this, which doesn't work in
markdown.

Fixes #12579.
2019-06-16 15:18:33 -07:00
Greg Price
b6ce366d61 docs: Add a comment explaining the fancy conditional-include syntax.
We only use it in this one place, so a comment right here seems the
most discoverable place to put it.  If we started using it more...
probably the section in docs/documentation/overview.md about the
dev/sysadmin docs system should split off into a new file, and this
info would become a subsection there.
2019-06-15 09:35:04 -07:00
Hemanth V. Alluri
52a5474000 realm_plan_type: Restrict uploading organization logos by plan type.
Using the page_param variable "plan_includes_wide_organization_logo"
disallow users in a realm with a "LIMITED" plan type from uploading
their own wide organization logos and instead suggest that they
upgrade their plan using the page_param variable
"upgrade_text_for_wide_organization_logo" for the suggestion message.

Backend validation for this feature already exists.
2019-06-14 16:21:12 -07:00
Hemanth V. Alluri
5a1043237c realm_plan_type: Add wide organization logo related fields to state.
Namely, here we add the "plan_includes_wide_organization_logo" and
"upgrade_text_for_wide_organization_logo" to the page_params (which
is set in zerver/lib/events.py).

"plan_includes_wide_organization_logo" is True if the plan is not of
the Realm.LIMITED type. We need to add this extra boolean parameter
instead of just using "realm_plan_type" to make things a lot easier
to work with on the frontend side, especially considering that
handlebars won't allow checking for equality in its {{#if}} blocks.
2019-06-14 15:59:28 -07:00
Hemanth V. Alluri
5d8050f822 realm_plan_type: Send an event when the realm's plan type is updated.
When a realm's plan type is updated using "do_change_plan_type" we
notify active users of the realm. This way certain plan features
could be enabled instantaneously for active users.
2019-06-14 15:59:28 -07:00
Hemanth V. Alluri
611808381f webhooks/stripe: Blacklist invoice changes under invoiceitem category. 2019-06-14 15:55:07 -07:00
Hemanth V. Alluri
325b1fd6c4 webhooks/stripe: Modify the invoice.updated event handling logic.
If the invoice was paid then the message should simply be
"Invoice is now paid." with a link to the invoice.

Also, suppress the "status_transitions" and "payment_intent"events.
2019-06-14 15:55:07 -07:00
Hemanth V. Alluri
eaa89d47fa webhooks/stripe: Add fixtures for invoice and invoiceitem updates. 2019-06-14 15:55:07 -07:00
Hemanth V. Alluri
1a33d73554 management: Don't prepend "HTTP_" to non-headers in parse_headers.
Django does not prepend "HTTP_" to the "Content-Type" or
"Content-Length" headers. So parse_headers should not do that either.
2019-06-14 15:53:59 -07:00
Vishnu Ks
fdcae3b0b7 provision: Add cd /srv/zulip to .bashrc only if /srv/zulip exists. 2019-06-14 15:49:56 -07:00
Vishnu Ks
d703e3638e droplets: Update snapshot id.
The new snapshot has zulip/zulip commit till
ac0d60f577. I have also included
the custom motd from b594708915
in base image.
2019-06-14 15:49:56 -07:00
Wyatt Hoodes
6b033c7909 test-backend: Add steps to deal with potential database leaks.
A function was written in `test_fixtures.py` to drop a test database
template if the corresponding database id doesn't belong to a file.
Alongside this fact, every file that is written is removed after 60
minutes.  Meaning any potential database template can never exist
longer than one hour.

This follow-up work was added to deal with the potential race
conditions when running `test-backend`.  Ensuring that all templates
are properly dealt with.

Essentially rewritten by tabbott for cleanliness.

Fixes the remainder of #12426.
2019-06-14 15:23:25 -07:00
Wyatt Hoodes
0b05d91e62 test_runner: Write database ids to file for reference in clean up.
The ids that will be used for each particular run of the test suite are
written to a unique file. Each file will then be used as a time
reference of when the suite was ran.

This change sets up the ability for a complete clean up of potentially
leaked database templates.

Tweaked by tabbott to remove these files after successful database
cleanup.
2019-06-14 15:23:20 -07:00
Wyatt Hoodes
900d9d3e49 test_runner: Add comment explaining abnormal database destruction.
When running the test-backend suite in serial mode, `destroy_test_db`
double appends the database id number to the template if passed an
argument for `number`.  The comment here explains this behavior.
2019-06-14 14:35:39 -07:00
Vishnu Ks
6e52779ed5 install: Include no-dist-upgrade in args list.
This was missed out in 2e51ac8c49
2019-06-14 14:24:08 -07:00
Yashashvi Dave
981433d13c notification settings: Deduplicate template rendering. 2019-06-14 14:14:03 -07:00
Yashashvi Dave
31bb0439f9 notification settings: Reorder notification settings labels.
This is pre-refactoring commit for notification settings template
deduplication using a loop. This commit refactors notifications
section and reorder labels to match the ordering in the templates.
2019-06-14 14:13:29 -07:00
Yashashvi Dave
15cd238acb notification settings: Remove unused template argument.
This commit removes `propagate_stream_notifications_change`
element from notification template, as it is neglected
since commit b553507412.
Commit also removes `end_content` argument from
`settings_checkbox.handlebars` which was only used
for removed property.
2019-06-14 14:07:22 -07:00
Vishnu Ks
44d16d76c1 activity: Extract most js from realm_summary_table to activity.js. 2019-06-14 10:20:59 -07:00
Vishnu Ks
14e582fb59 support: Add functionality to copy admin emails.
Also renamed a bunch of functions in test_views for better
readability.
2019-06-14 10:19:50 -07:00
Vishnu Ks
cc91e6cb94 auth: Allow setting GOOGLE_OAUTH2_CLIENT_ID from dev-secrets.
This makes it much more convenient to use Google/GitHub authentication
in a Zulip development environment for testing; one only has to set it
up once.
2019-06-14 10:16:26 -07:00
Vishnu Ks
16a345a766 auth: Document setting social_auth_github_key in dev-secrets.
This is a simpler configuration method for development, because
dev_settings.py isn't something the developer can edit.
2019-06-14 10:16:26 -07:00
Alexandra Ciobica
5a4f7d9ade css: Align Invite more users button. 2019-06-14 09:59:59 -07:00
Puneeth Chaganti
6f4414e3f0 version: Fail gracefully if git describe cannot get version.
When running the `./tools/cache-zulip-git-version` script on Travis, the script
fails because Travis gets a shallow clone of the repository, and not a full
clone. This commit changes the script to fail gracefully, if we are unable to
get the version information using `git describe`.

When the command fails, it still writes an empty `zulip-git-version` and that
has not been changed to keep creation of the release tarball simple, and
avoiding a check for whether the file has any content. The code that sets
`ZULIP_VERSION` checks whether the contents of the `zulip-git-version` file are
empty, before setting `ZULIP_VERSION`. So, the version should never be set to an
empty string.
2019-06-14 13:47:27 +05:30
vinitS101
a6eda858d0 ldap: Fix avatar sync not working with the S3 backend.
This fixes an issue that caused LDAP synchronization to fail for
avatars.  The problem occurred due to the lack of a 'name' attribute
on the BytesIO object that we pass to the upload backend (which is
only used in the S3 backend for computing Content-Type).

Fixes #12411.
2019-06-13 15:12:13 -07:00
Tim Abbott
05e0e99b6e install-aws-server: Use our settings.py if available. 2019-06-13 14:39:25 -07:00
Tim Abbott
8a53686f41 install: Add --no-overwrite-settings option.
This commit needs more work to make this option reasonable.
2019-06-13 14:39:25 -07:00
Tim Abbott
2d1c2d4802 install-aws-server: Stop using ssh -t without a real terminal.
More modern Linux versions like Bionic will block this, and what we
actually want to do is just run the code in our <<EOF block via bash,
so we should do that explicitly.
2019-06-13 14:39:25 -07:00
Tim Abbott
e85250941d puppet: Fix quoting of commented-out python3-boto.
This will avoid a linter error if/when we uncomment it.
2019-06-13 14:39:24 -07:00
Tim Abbott
337efe0fb7 puppet: Remove puppet-el, which no longer exists.
This package was only every available on Ubuntu Xenial.
2019-06-13 14:39:24 -07:00
Yago González
57c80669a0 api docs: Remove migrated endpoints from deprecated specs. 2019-06-13 14:31:55 -07:00
Yago González
c9920ab902 api docs: Add explanatory note to zulip-2.0.yaml. 2019-06-13 14:31:55 -07:00
Thomas Ip
da8473e958 draft: Fix draft list not being able to scoll to bottom.
Fixes #12552.
2019-06-13 11:35:14 -07:00
Mateusz Mandera
8f15884c7d retention: Delete objects tied to a Message in one query with archiving.
Rather than relying on the CASCADING property of the ForeignKey to the
Message table to clean up these objects, we delete them in the same
query as we archive them - since it's guaranteed that any of these
objects that we archive will be deleted due to their Message being
deleted later.
We don't have this guarantee for Attachment objects, which is why we
can't apply this scheme to them.
2019-06-13 11:18:11 -07:00
Mateusz Mandera
25810752fe retention: Fully process each Message chunk in a transaction.
To ensure the database retains a consistent state if archiving gets
interrupted, we process each Messages chunk together with related
objects in a single atomic transaction.
2019-06-13 11:17:54 -07:00
Mateusz Mandera
55eb46433b retention: Use yield when batching instead of returning a list of lists.
This generator architecture will be cleaner for supporting the
transactionality model we want.
2019-06-13 11:11:34 -07:00
Mateusz Mandera
37a22844b9 retention: Clean up code of move_messages_to_archive(). 2019-06-13 11:02:11 -07:00
Mateusz Mandera
a68c460a14 retention: Clean up code for archiving attachment_messages.
We had two duplicate functions for archiving zerver_attachment_messages
rows, doing the same thing - archiving by message_id. One of them had a
redundant INNER JOIN, so we get rid of that too.
2019-06-13 11:02:11 -07:00
Mateusz Mandera
cbee5beeac retention: Log progress through the archiving process. 2019-06-13 11:02:11 -07:00
Mateusz Mandera
e3c7a5d896 retention: Loop over realms in archive_messages.
Since we loop over realms in the functions for archiving stream messages
and then personal+huddle messages, and also want to split cleaning up
attachments by realm - it makes sense to do it all in one single loop.
2019-06-13 11:02:11 -07:00
Alexandra Ciobica
fbfd5d577a integrations: Move the css for the integrations page into a separate file.
The integrations page had css in both `landing-page.scss` and
`portico.scss`.  With this commit, the styles are mostly unified into
a single separate file.
2019-06-12 17:42:22 -07:00
Alexandra Ciobica
ab02fb81c5 css: Remove unused portico css.
This *-page-header CSS all dates from a nearly-original version of the
portico design system, and hasn't been functional in years.
2019-06-12 17:41:50 -07:00
Alexandra Ciobica
13d78e9da7 integrations: Make header of integrations/docs on mobile look good.
Change the display from `block` to `flex` in order to be able to
arrange the elements as wanted. Reset the css of the header elements
only for the description view. Add `font-size: 1.2em` because the font
doesn't need resizing in this case, it needs resizing only when the
title is in the box.

Removed the `padding-bottom` from the `nav` on mobile because it
overlaps the new header and you cannot click the back button from the
integrations.

Fixes: #12365.
2019-06-12 17:33:53 -07:00
Alexandra Ciobica
869c5ce27b integrations: Change integrations content.
We remove the title from `errbot` integration documentation so that
all documentations have the same style.  See
https://github.com/zulip/python-zulip-api/pull/515 for a similar
change to integrations where the docs live elsewhere in version control.

We also remove the `margin: 0` from the instruction tip because where
the tip is followed by a list, there is no space between the two; this
change doesn't mess up the other places where the tip is used.
2019-06-12 17:33:00 -07:00
Vaibhav
f3d0d955c3 css: Use SCSS nesting in lightbox.scss for #lightbox_overlay. 2019-06-12 17:07:41 -07:00
Vaibhav
a7b820ddc3 css: Use SCSS nesting in lightbox.scss for .image-actions. 2019-06-12 17:07:41 -07:00
Vaibhav
7610c5f025 css: Cleanup lightbox.scss for download and open buttons.
* There is only one word inside the buttons and that too was wrapped
  inside `span.text` which was unnecessary. This is removed. All
  corresponding properties (font-size) are moved to `.button`.

* Since the only `a` inside image actions are these buttons, all
  the properties are transfered to `.button`.

* Similarly, properties for `.icon` are moved to `.button` and it is
  also removed from the template.
  * Font size was redundant for `.icon`
  * display property is moved
2019-06-12 17:07:41 -07:00
Vaibhav
b97ba0b026 css: Remove redundant span:nth-of-type(2) rule from lightbox.scss.
Since no such element exists inside `.image-actions`.
2019-06-12 17:07:41 -07:00
Vaibhav
288a0c241c css: Reorder lightbox.scss so that .image-actions are in same place. 2019-06-12 17:07:41 -07:00
Vaibhav
96fecdd7d5 css: Use SCSS nesting in lightbox.scss for .button. 2019-06-12 17:07:41 -07:00
Vaibhav
ede9faef2e css: Remove redundant .download top positioning in lightbox.scss.
* This rule was already invalid since `.download` is used in
  templates as `.button.download` and here it was defined as
  `.button .download`

* Even if the above was to be corrected, `.download` has position
  `static` and hence the top positioning would never have affected
  anything.
2019-06-12 17:07:41 -07:00
Vaibhav
3641855a2c css: Change rule from a.button to .button in lightbox.scss.
This works since the buttons in lightbox overlay are `a`s. Even if
they weren't so, this style can generally be applied to all the
`.button`s.
2019-06-12 17:07:41 -07:00
Vaibhav
351b3e9332 css: Remove redundant .clear-float since already defined in app_components. 2019-06-12 17:07:41 -07:00
Vaibhav
b75b6ce64c css: Use SCSS nesting in lightbox.scss for .center. 2019-06-12 17:07:41 -07:00
Vaibhav
a1f2b2b5ba css: Nest .image-list .image.selected inside .center. 2019-06-12 17:07:41 -07:00
Vaibhav
7b059fe8bf css: Use SCSS nesting in lightbox.scss for .player-container. 2019-06-12 17:07:41 -07:00
Vaibhav
414358e0a0 css: Use SCSS nesting in lightbox.scss for .image-description. 2019-06-12 17:07:41 -07:00
Vaibhav
a64aac4299 css: Reorder lightbox.scss so .image-descriptio are in same place. 2019-06-12 17:07:41 -07:00
Vaibhav
8ab4d38b6e css: Use SCSS nesting in lightbox.scss for .image-preview. 2019-06-12 17:07:41 -07:00
Vaibhav
249416e94a css: Use SCSS nesting in lightbox.scss for media queries. 2019-06-12 17:07:41 -07:00
Rishi Gupta
60bf4c0546 settings: Use fa-question-circle-o instead of (?) in org permissions. 2019-06-12 17:02:04 -07:00
Rishi Gupta
fe2c0fbf21 help: Update docs for new member settings.
Fixes various mistakes and also rewrites some stuff.
2019-06-12 17:02:04 -07:00
Rishi Gupta
495efada4b help: Rename configure-waiting-period-for-full-members. 2019-06-12 17:02:04 -07:00
Rishi Gupta
799d6b9203 org settings: Standardize strings in Other permissions section.
Also, options are now ordered from most restrictive to least restrictive.
A standard style here will be easier to understand and maintain as we add
more settings here.
2019-06-12 17:02:04 -07:00
Vaibhav
9096affe77 css: Move stylesheets not included in the app to another directory.
This moves all the stylesheets like stats, billing etc. to another
directory called `static/styles/portico/`, matching the directory
structure of our JavaScript.
2019-06-12 16:59:52 -07:00
Yashashvi Dave
ee072da47a static/js/settings_notifications: Deduplicate code. 2019-06-12 16:24:51 -07:00
Yashashvi Dave
8e269b4651 models: Rename notification to enable_stream_audible_notifications.
Rename notification property `enable_stream_sounds` to
`enable_stream_audible_notifications` to match with other
notification property patterns.

Fixes part of #12304
2019-06-12 16:24:51 -07:00
Alexandra Ciobica
8f9fa151a6 css: Center left sidebar Add streams icon.
The `+` from the add streams button was not on the same line as the
`#`s and the text was not aligned with streams name.  These changes
fix that.
2019-06-12 16:22:51 -07:00
Alexandra Ciobica
7544d0eb11 css: Add space below Add streams button.
This ensures the browser's showing the link feature doesn't occlude
this button.

Fixes: #12519.
2019-06-12 16:22:02 -07:00
Seth Nickell
93696729c6 notifications: Disable default permission pop up.
Prior to this commit, we'd put up the green "Enable desktop
notifications" bar on page load AND the first time a desktop
notification worthy message was received, it would attempt to notify,
automatically triggering a browser permission popup (the same one as
clicking the green bar results in).

Now, desktop notifications are not attempted at all until the green
bar is clicked. Additionally Firefox and Webkit browser-specific
checks are made more uniform and done at the same point.

Tested written by YashRE42.

Fixes #11504.
2019-06-12 16:12:13 -07:00
Mateusz Mandera
5b8140cf75 retention: Group stream message archiving by realm.
We group the process of archiving stream message by realm, to allow
logging and keeping track of time taken per realm.
2019-06-11 09:25:25 -07:00
Mateusz Mandera
f06a4b4eab retention: Batch Message archiving queries.
We batch queries that archive Messages, to limit the maximum amount of
Message objects archived in a single query. This leads to the archiving
of other related objects being batched as well, because we loop over
chunks of archived messages and archive their related objects per-chunk.
2019-06-11 09:25:25 -07:00
ppreethi
86840adda5 version: Show number of commits and commit sha in ZULIP_VERSION.
We use `git describe --tags` to get information about the number of commit since
the last major version, and the sha of the current HEAD. This is added to the
ZULIP_VERSION when a deploy is done from `git`.

Modified heavily by punchagan to:
* to use git describe instead of `git log` and `wc`
* use a separate script to run the git describe command
* write the file with version info to var/ and remove it from the repo

Fixes #4685.
2019-06-07 13:39:12 -07:00
Vishnu Ks
8261c394b9 webpack: Include channel.js to email-log bundle.
During the refactoring in c27d927663
$.post was replaced with channel.post without including
channel.js in email-log webpack bundle.
2019-06-07 11:34:17 -07:00
Alexandra Ciobica
161d196759 css: Add nightmode variant for fetching more messages loading indicator
Fixes: #12522.
2019-06-07 10:45:29 -07:00
Yashashvi Dave
ac0d60f577 settings_profile_fields: Extract func set_up_choices_field_edit_form. 2019-06-06 22:36:16 -07:00
Yashashvi Dave
1fef813914 static/js/settings_account: Clean function append_custom_profile_fields. 2019-06-06 22:36:16 -07:00
Yashashvi Dave
f25e00bcaa zever/lib/validator: Rename function to validate_choice_field_data. 2019-06-06 22:36:16 -07:00
Rishi Gupta
799a5e73c0 settings: Remove spurious colons after label text. 2019-06-06 22:17:04 -07:00
Rishi Gupta
49f8b9abbe help: Add manage-inactive-streams. 2019-06-06 22:17:03 -07:00
Tim Abbott
9fbc6ab022 version: Update version and changelog for Zulip 2.0.4 release. 2019-06-06 22:04:41 -07:00
Priyank Patel
b70bd6be30 tests: Add tests for the logic of typing_status.handle_text_input.
This tests was added to make sure we catch subtle bug related to
comparing new_recipient and current_recipient. When we changed the
recipient to use arrays instead of string to use new user IDs based
api we encoured this bug and out testing suite couldn't detect this.
2019-06-06 19:56:24 -07:00
Priyank Patel
b8250fc61e typing: Use user IDs instead of user ids string. 2019-06-06 19:56:24 -07:00
Priyank Patel
5228403eb5 people: Refactor out user id string to array function. 2019-06-06 19:56:24 -07:00
Tim Abbott
3b502fa235 settings: Fix getting API key when using social auth.
Long-term, we want this flow to do a full re-authentication, but this
makes the frontend consistent with the backend and fixes a confusing
bug where submitting the form ended up adding a weird `?password=`
thing to the URL, in addition to not working.

Fixes #12200.
2019-06-06 17:05:34 -07:00
Tim Abbott
f5375adf8f settings: Improve example for RABBITMQ_HOST.
We prefer 127.0.0.1 over localhost for RabbitMQ because of weird IPv6
issues, so we should avoid mentioning localhost as an example.
2019-06-06 16:41:15 -07:00
Tim Abbott
5748bae71d restore-backup: Run configure-rabbitmq to update RABBITMQ_PASSWORD.
Previously, if you restored onto a different production system from
the one where you took the backup, backup restoration would fail
because the generated rabbitmq passwords for the two systems would be
different, and we didn't update the restored system to use the
password from the original system.

Fixes #12114.
2019-06-06 16:38:27 -07:00
Tim Abbott
3c4030a421 restore-backup: Run zulip-puppet-apply before pg_restore.
This should ensure that we apply any special configuration for the
database system (e.g. installing `pgroonga`) before we try to restore
the database contents from the archive.

For pgroonga in particular, this is important so that we can preserve
the configuration of the extension in the `pg_restore` process.

Fixes #12345.
2019-06-06 16:34:28 -07:00
Thomas Ip
d1d06af2c6 dependencies: Upgrade jQuery to 3.4.1.
API changes:
* Positional selectors (eg :first, :eq) are deprecated in 3.4.0 and
  will be removed in 4.0. Use positional methods instead.
2019-06-06 15:21:26 -07:00
Thomas Ip
5b94e1dfad jQuery: Remove unnecessary :first selectors.
See example here: https://jsbin.com/relewizita/edit?html,js,output
Basically the original statement get the first of each input, button
and select element, and then select the first of these in the next
line. We can simply query the first one in one step. The settings
menu have at most 20 of these input elements so performance should
have no impact.
2019-06-06 15:21:26 -07:00
Thomas Ip
3b90eed007 jQuery: Replace positional selectors on the first of multiple selectors.
A selector like `$('.elem1:first .elem2')` selects all `.elem2` under
the first `.elem1`. We can instead use `$('.elem1').first().find('.elem2')`.
2019-06-06 15:21:26 -07:00
Thomas Ip
b72f30bd06 jQuery: Replace positional selectors at the end of multiple selectors.
A selector like `$('.elem1 .elem2:first')` selects the first descendant
with class name `.elem2` under `.elem1`. This is the same as saying
`$('.elem1 .elem2').first()`. See example here:
https://jsbin.com/bohehesari/edit?html,js,output
2019-06-06 15:21:26 -07:00
Thomas Ip
6cad1988a9 jQuery: Use positional methods on single selectors.
For selectors like `$('.element:first')`, we can simply write
`$('.element').first()`.
2019-06-06 15:21:26 -07:00
Tim Abbott
13a20a1ab5 restore-backup: Fix error on systems using S3 upload backend.
With the S3 file upload backend, we don't store uploads locally, so
the `uploads` directory in the backup will be empty, and more
importantly, LOCAL_UPLOADS_DIR will be None, which the previous code
crashed on.
2019-06-06 15:08:18 -07:00
YashRE42
869aaba6a7 overlays: Fix stream edit click-through bug.
Fixes #12369.
2019-06-06 14:57:16 -07:00
Wyatt Hoodes
ccfcd6b4d8 test_runner: Fix accumulation of uniquely named test templates.
N = self.parallel templates are created, and these templates were
previously named 'zulip_test_template_<1, N>'.  However, to support
running multiple instances of `test-backend`, a unique
`random_id_range_start` was created for each template database.

There was no problem prior because the templates would simply be
used again and thus did not require any clean up. Now that there are
unique database names being created, every time `test-backend` is run
these templates can accumulate on disk.  Instead, we clean up our
templates at the end of every complete run of the test suite, or upon a
SIGINT.

Fixes: #12426
2019-06-06 14:45:32 -07:00
Wyatt Hoodes
d3500867d9 test_runner: Fix small typo in comment. 2019-06-06 14:29:57 -07:00
Tim Abbott
1de4b94fbe openapi: Add validation of parameter lists against actual code.
This validation is incomplete, in large part because of the long list
of TODOs in this code.  But this test should provide a ton of support
for us in avoiding regressions as we work towards having complete API
documentation.

See https://github.com/zulip/zulip/issues/12521 for a bunch of
follow-up improvements.
2019-06-06 13:41:07 -07:00
Tim Abbott
72bc497f7d urls: Fix URL definitions with missing ^/$ symbols.
This is mostly for consistency, though I also found it while writing
code to parse our regular expressions for validation purposes.
2019-06-06 12:58:10 -07:00
Tim Abbott
58c11fd249 api: Update documentation of subscription properties endpoint.
This covers the recent field rename as well as the addition of
email_notifications.
2019-06-06 12:05:49 -07:00
Vaibhav
90a67a6b4f css: Use SCSS nesting in alerts.scss for .alert. 2019-06-06 11:41:35 -07:00
Vaibhav
4b315a63cc css: Cleanup alerts.scss combing rules under same selector .alert. 2019-06-06 11:41:35 -07:00
Vaibhav
7c51e59a35 css: Use SCSS nesting in alerts.scss for .alert-box. 2019-06-06 11:41:35 -07:00
Vaibhav
b04e1c918a css: Reorder alerts.scss so .alert-box .alert are in same place. 2019-06-06 11:41:35 -07:00
Vaibhav
9f5b1f19e9 css: Use SCSS nesting in alerts.scss for .alert. 2019-06-06 11:41:35 -07:00
Tim Abbott
065575debf retention: Add a quick comment explaining how deletion works. 2019-06-06 11:41:07 -07:00
Mateusz Mandera
323be57151 retention: If stream has no retention policy set, use realm policy.
We add the following behavior:
If stream has message_retention_days set to -1, archiving for it is
disabled.
If stream has message_retention_days set to null, use the realm's
policy. If the realm has no policy, we don't archive for this stream.
2019-06-06 11:17:42 -07:00
Mateusz Mandera
8bef82c7f9 retention: Clean up redundant code for special handling of UserMessages.
UserMessages no longer need special handling, they can be archived by
move_models_with_message_key_to_archive and automatically cleaned up
like the other models with a message key with CASCADING=True.
2019-06-06 11:17:42 -07:00
Mateusz Mandera
0e9fa4f028 retention: Support stream-based retention policies.
We change the archiving scheme to allow having stream based retention
policies. In the first step of the archiving process, we loop over
streams and archive their expired messages and related objects.
Then we separately archive all expired personal and huddle messages and
related objects. As the last step, we scan for redundant attachments
which can now be deleted.
To achieve this, we have to rewrite a significant portion of the
retention code and rework some of the database queries.
For the sake of simplicity, we neither archive nor delete cross-realm
messages, except cross-realm stream messages – in their case they can
be processed in the same manner as ordinary stream messages.
In the query for archiving personal and huddle messages we simply
exclude those sent by cross-realm bots.
We change the tests to adapt to these modifications.
2019-06-06 11:17:42 -07:00
Mateusz Mandera
aa45325b5f retention: Rename move_expired_rows to move_rows. 2019-06-06 11:17:42 -07:00
Mateusz Mandera
d481ee9a40 retention: Add message_retention_days field to Stream model. 2019-06-06 11:17:42 -07:00
Mateusz Mandera
d373a16910 retention: Remove realm_id check when archiving attachments.
Since we archive attachments and attachment_messages tied to a list of
ids of Messages that we just archived (so from the current realm), it's
unnecessary to check their realm in the queries. This could potentially
cause archiving of an attachment with realm_id of another realm, but
this isn't an issue, as long as we make sure we don't end up deleting
the original Attachment object incorrectly - but realm_id check is
included in delete_expired_attachments() to ensure that.
2019-06-06 11:17:42 -07:00
Rishi Gupta
bbf6dc5427 user docs: Fix fake email in restrict-visibility-of-email-addresses.
Fixes regression from 2ff969c.
2019-06-05 17:55:37 -07:00
Thomas Ip
c6cdcd082e dependencies: Upgrade node to 12.3.1.
API changes:
* The behaviour of Date.toLocaleTimeString() reverts to pre 8.0.0,
  this only affects automated tests. Lots of other API changes but
  we didn't use any of those.
* The internal sorting algorithm changed which causes one of our own
  compare function to miss coverage.
2019-06-05 17:15:52 -07:00
Vaibhav
af5d3769a7 css: Nest .hotspot-popover arrows inside .hotspot.overlay.
No changes were required in night mode since the night-mode css
already includes the same level of nesting.
Tested visually as well.
2019-06-05 17:08:59 -07:00
Vaibhav
4c41bc1324 css: Use SCSS nesting in hotspots.scss for .hotspot-popover. 2019-06-05 17:08:59 -07:00
Vaibhav
d43548c7ca css: Use SCSS nesting in hotspots.scss for .hotspot-popover.arrow-*. 2019-06-05 17:08:59 -07:00
Vaibhav
209b16e667 css: Use SCSS nesting for in hotspots.scss for .hotspot-confirm. 2019-06-05 17:08:59 -07:00
Vaibhav
2b6acbfe03 css: Nest hotspot inline elems inside .hotspot-inline.
No changes required here for night-mode.
2019-06-05 17:08:59 -07:00
Vaibhav
ce34fe51cd css: Use SCSS nesting in hotspots.scss for .hotspot-inline. 2019-06-05 17:08:59 -07:00
Vaibhav
9db1a5458d css: Reorder hotspots.scss so .hotspot-inline are in same line. 2019-06-05 17:08:59 -07:00
Vaibhav
74e6b5c926 css: Use SCSS nesting in hotspots.scss for .hotspot.overlay. 2019-06-05 17:08:59 -07:00
Vaibhav
5f18cc16b7 css: Reorder hotspots.scss so .hotspots.overlay are in same place. 2019-06-05 17:08:59 -07:00
Vaibhav
25db1d953d css: Use SCSS nesting in hotspots.scss for .hotspot-icon. 2019-06-05 17:08:59 -07:00
Vaibhav
e664eb736a css: Reorder hotspots.scss so .hotspot-icon are in same place. 2019-06-05 17:08:59 -07:00
Rishi Gupta
3b6969e4c9 docs: Add link to linkedin to summer-with-zulip. 2019-06-05 17:03:24 -07:00
Vishnu Ks
14ed0e283d install: Add option to skip dist-upgrade. 2019-06-05 15:50:02 -07:00
Tim Abbott
afb0d1ccce Revert "puppet: Use nice to deprioritize various processes."
This reverts commit d959de7a89.

This broken our Travis CI, so I'm pulling it off while we investigate.
2019-06-05 12:55:56 -07:00
Vaibhav
a52c157dd3 css: Add similar nesting to night-mode emoji elements as in reactions.scss.
Due to additional nesting added in reactions.scss, night-mode styles
were prioritized lower than the original rules defined.

Fixes regressions introduced by changes in PR #12473
2019-06-05 12:36:53 -07:00
Tim Abbott
d959de7a89 puppet: Use nice to deprioritize various processes.
Our priority hierarchy is:
(1) Tornado and base services like memcached, redis, etc.
(2) Django and message sender queue workers.
(3) Everything else.

Ideally, we'd have something a bit more fine-grained (e.g. some queue
workers are potentially in the sending path, while others aren't), but
this should have a big impact on ensuring Tornado gets the resources
it needs during load spikes.

I think this has a good chance of causing some load spikes that would
previously have resulted in a user-facing delivery delays no longer
having any significant user-facing impact.
2019-06-05 11:56:48 -07:00
Rishi Gupta
2ff969c5a9 user docs: Update restrict-visibility-of-email-addresses.
That we are working to fix the caveats is implied by the (beta) label.

More generally, for /help articles, explanations, apologies, etc can go in a
section at the top, but the rest of the text should be a straightforward
description of the current state.
2019-06-05 11:01:24 -07:00
Rishi Gupta
2556127ae1 help: Remove mark as spam from moderation guide.
We're not sure this feature is the best solution to this category of
problem, in that use of this feature might cause spam to stick around
longer, vs features that encourage immediate deletion.
2019-06-05 10:53:07 -07:00
Tim Abbott
9be3f30340 webpack: Don't import pyinotify in production context.
We only added the dependency for the development environment, but were
imported it unconditionally.
2019-06-04 18:10:58 -07:00
Tim Abbott
3225fd39a5 docs: Split internationalization.md from translation.md.
This provides a better entrypoint for developers to learn about
internationalization in Zulip without cluttering the article for
translators.

I also took the opportunity to add a proper for-developers
introduction, including a link to the very nice EdX guide on the
topic.
2019-06-04 17:35:44 -07:00
Tim Abbott
57a748ad63 node: Remove stream_ui_updates.js from modules expecting coverage.
This module is a UI module, which are harder to test, and in any case,
doesn't actually have any tests.
2019-06-04 16:45:54 -07:00
Priyank Patel
01f8c89294 webpack: Use cache-loader for various loaders.
Profiling shows that using cache-loader saves ~6-7 seconds of time take
by webpack-dev-server on subsequent runs. The overhaul this adds when
nothing is cached (when running first time) is around 1-2 seconds. We don't
use cache loader for ts-loader since webpack docs says it will slow it down
and file-loader since it just copies files over and caching it would just
was disk space.

This is the second merge of this commit.  It fixes the issue with the
previous one by placingn cache-loader after mini-css-loader because it
just extracts css and caching that will make file-loader not run which
in turn makes developement enviorment break.
2019-06-04 16:43:04 -07:00
Vaibhav
25b063ad95 css: Setup .tab-switcher.allow-overflow for informational overlays.
This changes the information-overlay tab-switcher to have the class
`.allow-overflow` too.

Fixes a regression introduced in 30da8bdf9b.
2019-06-04 00:43:51 -07:00
Hemanth V. Alluri
c6b03432bc docs: modify update-message-flag to contain information about flags.
This makes it a lot more useful for understanding how our flag update
endpoints work.

With significant edits by tabbott to explain what these are.

Fixes #12092.
2019-06-04 00:40:47 -07:00
Tim Abbott
fa77467d5d api: Don't allow editing non-editable flags.
Previously, we didn't have validation to prevent editing certain flags
that don't make sense for a client to edit, like whether a user was
mentioned in a given message.

This isn't a security issue -- the user could only mess up their own
personal search results (etc.), but it does seem worth fixing to avoid
confusion for folks developing Zulip clients.

While we're at it, clearly document the situation in comments.
2019-06-04 00:33:21 -07:00
sahil839
5a130097bf settings: Add display setting for demoting inactive streams.
This adds a setting to control Zulip's default behavior of sorting to
bottom and graying out inactive streams.  The previous logic is still
the default "automatic", but this gives users more control.  See the
models.py comment for details.

Fixes #11524.
2019-06-03 23:07:56 -07:00
Tim Abbott
710fc6767f test_fixtures: Fix buggy reuse of migrations_hash path.
We were apparently reusing the path for both the development and test
databases, which meant that we would not always correctly run
`generate_fixtures` when changes were required.

This was a recent regression introduced when we added this cache a few
days ago.
2019-06-03 23:07:56 -07:00
Tim Abbott
5d0e144d62 Revert "webpack: Use cache-loader for various loaders."
This reverts commit eb53b5e8de.

This appeared to not have the right logic yet for handling branch
switches.

See https://chat.zulip.org/#narrow/stream/3-backend/topic/frontend.20hot.20reloading/near/749259 for details.
2019-06-03 22:11:47 -07:00
Priyank Patel
9be6b79945 eslint: Turn off warning from eslint about using unsupported typescript.
We are mostly fine using newer versions of typescript since they
work fine; eslint just warns since it doesn't test against it.
2019-06-03 20:42:58 -07:00
Priyank Patel
ceff7e51bd package.json: Remove webpack-cache after installing dependencies.
This is recommended by webpack's cache-loader.
2019-06-03 20:15:51 -07:00
Priyank Patel
eb53b5e8de webpack: Use cache-loader for various loaders.
Profiling shows that using cache-loader saves ~6-7 seconds of time take
by webpack-dev-server on subsequent runs. The overhaul this adds when
nothing is cached (when running first time) is around 1-2 seconds. We don't
use cache loader for ts-loader since webpack docs says it will slow it down
and file-loader since it just copies files over and caching it would just
was disk space.

Profiling data:

-------- Master ---------

~/zulip (master) $ tools/webpack --watch | ts -s '%.S' # master
03.995825 ℹ 「wds」: Project is running at http://127.0.0.1:9994/
03.996161 ℹ 「wds」: webpack output is served from /webpack/
03.996289 ℹ 「wds」: Content not from webpack is served from ...
19.284477 ℹ 「wdm」:
19.285371 ℹ 「wdm」: Compiled successfully.

-------- cache-loader ---------

~/zulip (cache-loader)$ tools/webpack --watch | ts -s '%.S'
04.107913 ℹ 「wds」: Project is running at http://127.0.0.1:9994/
04.108646 ℹ 「wds」: webpack output is served from /webpack/
04.109068 ℹ 「wds」: Content not from webpack is served from ...
12.633782 ℹ 「wdm」:
12.634083 ℹ 「wdm」: Compiled successfully.
2019-06-03 20:15:51 -07:00
Priyank Patel
4bb6c29d59 webpack: Use webpack's type defination.
Before we used to defined our own type Loader which was
partly incorrect because the use property can only
be string which is incorrect. We use the RuleSetRule type
provided by webpack instead.
2019-06-03 20:15:51 -07:00
Priyank Patel
e590ce95ea dependencies: Add cache-loader for webpack build caching. 2019-06-03 20:15:51 -07:00
Tim Abbott
6236dfab9a docs: Clarify section on local configuration changes.
We still should add a section documenting all the options.
2019-06-03 20:11:07 -07:00
Eeshan Garg
0d519ab146 webhooks/bitbucket2: Account for missing username in user data.
Not all payloads contain the user's username. In such cases, we
should use the user's display name or nickname instead.
2019-06-03 20:00:17 -07:00
YashRE42
1ab4eaf819 stream_list: Pinned streams are never grayed out as inactive.
We have had a longtime bug where the state of pinned streams would not
update properly from the greyed out/inactive state to the active state
when a first message arrived to them.

After some discussion, we determined that likely the right fix for
this is to simply configure pinned streams to never be marked as
inactive; that's more in line with the intended user experience.

Fixes #8201.
2019-06-03 17:23:01 -07:00
Tim Abbott
807e5c7a1a auth: Fix fetching personal API key with email addresses hidden.
This was a corner case missed in the main migration.
2019-06-03 15:55:07 -07:00
Vaibhav
3444691fc1 css: Nest elems inside .emoji-info-popover.
These include:
* `.emoji-showcase-container`
* `.emoji-popover`
2019-06-03 15:30:51 -07:00
Vaibhav
c6071c0d7a css: Reorder so that elems inside emoji info popover are together. 2019-06-03 15:30:51 -07:00
Vaibhav
14a850dcb4 css: Nest elements inside .emoji-popover.
These include:
* `.emoji-popover-top`
* `.emoji-popover-category-tabs`
* `.emoji-popover-emoji-map`
* `.emoji-search-results-container`
* `.emoji-popover-emoji`
2019-06-03 15:30:51 -07:00
Vaibhav
3d21cb4bea css: Reorder reactions.scss so elems inside emoji popover are together. 2019-06-03 15:30:51 -07:00
Vaibhav
e33f8f0730 css: Nest popover subheading inside emoji map. 2019-06-03 15:30:51 -07:00
Vaibhav
7189de9722 css: Seperate height of emoji map from results container.
The only difference between emoji popover map and results container
is their height. For the results container the height is overridden
in the next rule. Seperating just makes it clearer that both of them
have the same styles except for the height. This also makes it easier
to nest the sub-heading inside the map in the following commit.
2019-06-03 15:30:51 -07:00
Tim Abbott
ddb9d41288 i18n: Update translation data from Transifex. 2019-06-03 15:29:56 -07:00
vinitS101
59c38a3598 settings: Show message in empty linkifier and custom emoji tables.
Show placeholder messages to the user if the Linkifier and Custom emoji
tables are empty.
The linkifier page does not show the message to the admin as there are
other UI elements in the table.

Resolves #12453.
2019-06-03 13:03:07 -07:00
Yashashvi Dave
516d189cf6 org settings: Fix missing <th> element in deactivated-user setting. 2019-06-03 12:51:56 -07:00
Vaibhav
62b1ccee26 css: Nest emoji results heading inside results container. 2019-06-03 12:36:32 -07:00
Vaibhav
1f425d8e58 css: Nest emoji preview and canonical name inside showcase container. 2019-06-03 12:36:32 -07:00
Vaibhav
a418984bf2 css: Nest .message_reaction .emoji inside .message_reactions. 2019-06-03 12:36:32 -07:00
Tim Abbott
cd1356f024 version: Bump major PROVISION_VERSION.
This should ensure that folks need to re-provision downgrade if they
switch branches to before this big frontend package upgrade.
2019-06-03 12:32:49 -07:00
Thomas Ip
3b105921bb dependencies: Upgrade winchan to 0.2.1. 2019-06-03 12:24:00 -07:00
Thomas Ip
537014ee47 dependencies: Upgrade typescript to 3.5.1. 2019-06-03 12:24:00 -07:00
Thomas Ip
676acd4ed1 eslint: Allow unused variables with _ prefix in typescript. 2019-06-03 12:24:00 -07:00
Thomas Ip
be48eb165d dependencies: Upgrade webpack-dev-server to 3.5.1 and install types. 2019-06-03 12:24:00 -07:00
Thomas Ip
545508da7b dependencies: Upgrade webpack(-cli) to 4.32.2 (3.3.2).
webpack 4.20.0 require webpack-cli 3.1.1.
2019-06-03 12:24:00 -07:00
Thomas Ip
4097025df7 dependencies: Upgrade svgo to 1.2.2. 2019-06-03 12:24:00 -07:00
Thomas Ip
19d18bdfbb dependencies: Upgrade source-sans-pro to 2.45.0. 2019-06-03 12:24:00 -07:00
Thomas Ip
57e9b21d90 dependencies: Remove source-map-loader.
The loader is not currently used.
2019-06-03 12:24:00 -07:00
Thomas Ip
238ea25fca dependencies: Upgrade sortablejs to 1.9.0.
Also set it to concrete version.
2019-06-03 12:24:00 -07:00
Thomas Ip
eccd258407 dependencies: Upgrade sass-loader to 7.1.0.
v7.1.0 allows the loader to use any sass implementation. The new
reference implementation of sass, dart-sass, is faster than libsass
in toy benchmarks but perform about the same when compiling
bootstrap. So we will stay on libsass for now.
2019-06-03 12:24:00 -07:00
Thomas Ip
37b0b0f246 dependencies: Upgrade plotly.js to 1.48.1.
v1.41.0 introduced the {resposive: true} option, we could use it.
2019-06-03 12:24:00 -07:00
Thomas Ip
ecd746e8c8 dependencies: Upgrade nwmatcher to 1.44.0. 2019-06-03 12:24:00 -07:00
Thomas Ip
ec47608aaf dependencies: Upgrade node-sass to 4.12.0. 2019-06-03 12:24:00 -07:00
Thomas Ip
e75017b0b5 dependencies: Upgrade moment(-timezone) to 2.24.0 (0.5.25). 2019-06-03 12:24:00 -07:00
Thomas Ip
657448b053 dependencies: Upgrade jquery-validation to 1.19.0. 2019-06-03 12:24:00 -07:00
Thomas Ip
562f6c1c39 dependencies: Upgrade htmlparser2 to 3.10.1. 2019-06-03 12:24:00 -07:00
Thomas Ip
de606373c2 dependencies: Upgrade handlebars to 4.1.2. 2019-06-03 12:24:00 -07:00
Thomas Ip
34aaa64a72 dependencies: Upgrade eslint to 5.16.0. 2019-06-03 12:24:00 -07:00
Thomas Ip
efb37d9794 dependencies: Upgrade @typescript-eslint/parser to 1.9.0. 2019-06-03 12:24:00 -07:00
Thomas Ip
1268616ca2 dependencies: Upgrade @typescript-eslint/eslint-plugin to 1.9.0.
Updated .eslintrc with new rules.
2019-06-03 12:24:00 -07:00
Thomas Ip
7643417c82 dependencies: Upgrade packages with patch level updates. 2019-06-03 12:24:00 -07:00
Thomas Ip
9a84a60029 dependencies: Upgrade yarn to 1.16.0. 2019-06-03 12:24:00 -07:00
Vaibhav
30da8bdf9b css: Rename info-overlay tab-switcher to .tab-switcher.allow-overflow.
This apparently is no longer used in any place hence there were no
changes required in the templates.
2019-06-03 12:16:16 -07:00
Vaibhav
56e97d5c37 css: Use SCSS nesting in app_components.scss for .new-style. 2019-06-03 12:16:16 -07:00
Vaibhav
c6b50fbba6 css: Add :focus rule for .new-style .button.btn-warning.
Same as the `:hover` rule similar to other buttons.
2019-06-03 12:16:16 -07:00
Vaibhav
09791b9c29 css: Use SCSS nesting in app_components.scss for .button. 2019-06-03 12:16:16 -07:00
Vaibhav
331f1fc4b7 css: Reorder app_components.scss so .button are in same place. 2019-06-03 12:16:16 -07:00
Vaibhav
6d588b683c css: Use SCSS nesting in app_components.scss for .tab-switcher. 2019-06-03 12:16:16 -07:00
Vaibhav
8ebc8602a5 css: Reorder app_components.scss so .tab-switcher .ind-tab are together. 2019-06-03 12:16:16 -07:00
Vaibhav
5460c4fce5 css: Use SCSS nesting in app_components.scss for .informational-overlays. 2019-06-03 12:16:16 -07:00
Vaibhav
a3ec301218 css: Reorder app_components.scss so .informational-overlays are seperate.
Two rules corresponding to `.informational-overlays` were placed among the
`.new-style` rules. The file is reordered to seperate them.
2019-06-03 12:16:16 -07:00
Vaibhav
082e0bc6f6 css: Use SCSS nesting in app_components.scss for .overlay. 2019-06-03 12:16:16 -07:00
Vaibhav
6abd05f77b css: Reorder app_components.scss so that .overlay.show are in one place. 2019-06-03 12:16:16 -07:00
Vaibhav
ff7aedd78a css: Use SCSS nesting in app_components.scss for .clear_search_button. 2019-06-03 12:16:16 -07:00
Tim Abbott
d0d497fc2d docs: Update contributor count to over 500. 2019-06-03 12:14:40 -07:00
Rishi Gupta
849bc382f9 portico: Remove core-team profiles from /team.
This makes the Zulip team look smaller than we are.
2019-06-03 12:14:40 -07:00
Tim Abbott
2bd6d275a7 test_import_realm: Fix test robustness.
The previous version hardcoded assumptions about user IDs.
2019-06-02 15:00:16 -07:00
Tim Abbott
a85fee333c test_import_export: Fix some spelling errors. 2019-06-02 14:57:03 -07:00
Mateusz Mandera
6c3ba25474 retention: Use RETURNING to speed up database queries.
We add RETURNING to fetch relevant message and usermessage ids in
archiving queries and use them to make other queries faster and slower.
A side-effect of this implementation is that with cross-realm messages,
the UserMessage of the recipient and the Message will not be deleted -
but cross-realm messages are rare, will still get correctly put in the
archive tables and so failing to delete should not be a problem for now.
They will be fully handled later.
2019-06-02 14:55:14 -07:00
Mateusz Mandera
426e3bbbd9 retention: Remove redundant LEFT JOIN in archiving UserMessages.
zerver_archivedmessage is already INNER JOIN-ed earlier in the query, so
we check the pub_date in it, instead of joining zerver_message, which
would just redundantly join the analogical rows.
2019-06-02 14:55:14 -07:00
Vishnu Ks
a9a44392d1 tests: Add test to highlight that bs4 modifies html sometimes. 2019-06-02 14:53:13 -07:00
Vishnu Ks
8718846c2a import: Use html.parser instead of lxml in bs4.
lxml parser appends html and body tags to the soup object which
are not reqired. There are no other major parsing diffrences between
the two parsers as long the HTML input is perfectly formated.
lxml parser is much faster than html.parser but it hardly matters
in our case.
https://www.crummy.com/software/BeautifulSoup/bs4/doc/#differences-
between-parsers
2019-06-02 14:53:13 -07:00
Puneeth Chaganti
64c40287f1 url preview: Rename type_ variable to oembed_resource_type. 2019-06-02 14:31:39 -07:00
Puneeth Chaganti
30dcf805ea url preview: Use oEmbed preview for Vimeo, instead of custom code. 2019-06-02 14:31:39 -07:00
Puneeth Chaganti
717d1e504d ldap: Turn off the AUTH_LDAP_ALWAYS_UPDATE_USER setting.
The `AUTH_LDAP_ALWAYS_UPDATE_USER` is `True` by default, and this would sync the
attributes defined in the `AUTH_LDAP_USER_ATTR_MAP` to the user profile. But,
the default code in `django-auth-ldap` would work correctly only for `full_name`
field. This commit disables the setting by default, in favour of using the
`sync_ldap_user_data` script as a cron job.
2019-06-02 11:24:19 -07:00
Mateusz Mandera
569d79b9d8 email_mirror: Add support for "+include-quotations" in address.
We add an option to disable the stripping of quotations from the email
body, if "+include-quotations" token is included in the email address.
2019-06-02 10:50:59 -07:00
Mateusz Mandera
e4138c5463 email_mirror: Add support for "+include-footers" in address.
In addition to the "+show-sender" option, we now add "+include-footers"
which disables stripping of the footer from the email body if this token
is included in the email address.
2019-06-02 10:50:59 -07:00
Mateusz Mandera
a5aa4adb54 email_mirror: Add general support for optional tokens in the address.
To enable a comfortable way of adding more optional tokens in the
address (like current '+show-sender') we change decode_email_address to
return a general dictionary containing options specified through adding
these optional tokens in the To: address. For now, we only have
"+show-sender", but more can be easily added using this change.
2019-06-02 10:50:59 -07:00
Anders Kaseorg
5c734f7048 dev-vagrant-docker: Clear redis-server ExecStart before overriding it.
Real systemd requires this.  docker-systemctl-replacement currently
doesn’t but maybe it will later.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-06-01 16:55:56 -07:00
vinitS101
9ddc27f318 docs: Fixed a small typo in the LDAP documentation. 2019-06-01 16:54:32 -07:00
Wyatt Hoodes
db69cdbcde public_export: Add support for deleting export after access.
The RealmAuditLog object ID was stored in the event sent to the
deferred_work queue as a means to update the row's extra_data field.
The extra_data field then stores the location of the export.
2019-05-31 22:54:27 -07:00
vinitS101
ed3e9be142 org_settings: Add collapse/show settings button for users and guests.
For non-admins some organisation settings tabs are 'collapsed' by default.
A button at the bottom of these settings can be used to toggle
show/collapse for these settings tabs.

Resolves #12313.
2019-05-31 22:42:02 -07:00
vinitS101
20e6f67e70 org_settings: Permanently hide some settings tabs from users and guests.
Some organisation settings tabs have been permanently hidden from
non-admins, since they are useful to non-admins and can create
confusion for new users.
2019-05-31 22:41:46 -07:00
Tim Abbott
43e634a9b8 Revert "dependencies: Upgrade webpack-dev-server to v3.4.1."
This seems to have broken the development server.

This reverts commit daf8dd1960.
2019-05-31 17:59:13 -07:00
Wyatt Hoodes
4a79be331e test_fixtures.py: Use hashing to optimize migrations check.
Instead of running `what_to_do_with_migrations` unconditionally, we
first hash and compare the files located in `*/migrations/*`. Only if
a migration file has changed (or the hash file does not exist yet) do we
call `what_to_do_with_migrations`.

It was discovered that the call to Django's `showmigrations.py` file was
causing roughly a 500ms increase in `test-backend`'s start up time.

However, this fix only saves about 100ms, apparently because a lot of
that work was importing Django dependnecies we need for most tests
anyway.

Fixes: #12428.
2019-05-31 17:44:17 -07:00
Tim Abbott
320812ccec docs: Reorganize remote development docs a bit. 2019-05-31 17:35:10 -07:00
Kanishk Kakar
747096c123 docs: Add rmate instructions for remote dev. 2019-05-31 17:15:56 -07:00
Anders Kaseorg
faa4cf629a webpack: Close potential race condition leaking webpack-dev-server process.
This exchanges a race condition where webpack-dev-server might not be
stopped on a poorly timed KeyboardInterrupt for a less bad race
condition where we might get an UnboundLocalError.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-05-31 17:08:48 -07:00
Eeshan Garg
cf921d5981 webhooks/buildbot: Add missing "skipped" build result code.
The payload for when a build is cancelled was causing an error
because the build result code mapping was missing one of the
codes. This commit also fixes a minor typo in the result codes.
2019-05-31 16:59:42 -07:00
Priyank Patel
2a864ebad3 webpack: Restart webpack-dev-server on config file changes.
This should make the run-dev.py user experience a lot nicer when
switching branches away from a branch that is at least as new as this
commit, since we won't need to manually restart run-dev.py to restart
webpack.

Fixes #9042.
2019-05-31 16:10:47 -07:00
Puneeth Chaganti
9aa5a2b369 url preview: Use oEmbed html for videos.
Ensure that the html is safe, before using it. The html is considered if it is
in an iframe with a http/https src, based on the recommendations here:
https://oembed.com/#section3

We directly embed the `iframe` html into the lightbox overlay.
2019-05-31 15:59:03 -07:00
Puneeth Chaganti
c8cb785950 url preview: Show inline images as previews for oEmbed photo pages. 2019-05-31 15:59:03 -07:00
Puneeth Chaganti
a1590c613e url preview: Enable server level setting for url embed previews.
This significantly simplifies the process for enabling this feature in
new organizations.
2019-05-31 15:37:03 -07:00
Puneeth Chaganti
8c0c9ca7a4 url preview: Turn Realm.inline_url_embed_preview off by default. 2019-05-31 15:28:32 -07:00
Kleidi Eski
4d8ee17a98 images: Add header design for Zulip Twitter account. 2019-05-31 15:24:56 -07:00
Priyank Patel
daf8dd1960 dependencies: Upgrade webpack-dev-server to v3.4.1. 2019-05-31 15:07:17 -07:00
Yashashvi Dave
7d75cdef7f subs: Rename in_home_view checkbox-setting template element. 2019-05-30 21:39:06 -07:00
Yashashvi Dave
2a943d3b40 static/js/stream_muting: Rename update_in_home_view function. 2019-05-30 21:39:06 -07:00
Yashashvi Dave
784d02bf60 static/js/stream_data: Rename in_home_view functions. 2019-05-30 21:39:06 -07:00
Yashashvi Dave
40f550038d subs: Replace all in_home_view uses with is_muted property.
Replace all uses of `in_home_view` subscription property
with `is_muted` property in frontend.

Fixes #12322
2019-05-30 21:39:06 -07:00
Mateusz Mandera
f73600c82c rate_limiter: Create a general rate_limit_request_by_entity function. 2019-05-30 16:50:11 -07:00
Puneeth Chaganti
22d0cd9696 url preview: Don't cache embed data when fetch has network errors. 2019-05-30 16:45:22 -07:00
Pragati Agrawal
69ec96b63e search suggestion: Hide email under hidden email-address-visibility cases.
This commit hides the email address from the search bar for the email
hidden cases.
2019-05-30 16:22:54 -07:00
Shubham Dhama
03d188b5bd settings_org: Fix show_email function when email visibility is admin only.
`show_email` function should return false when email visibility is set
anything other than `everyone` (, for now, irrespective of privileges).
2019-05-30 16:22:54 -07:00
Shubham Dhama
c691ed433b settings_org: Fix the typo in settings_org.show_email() function. 2019-05-30 16:22:54 -07:00
YashRE42
5ff27c130a info-overlay: Fix "message formating" styling.
This reverts the temporary solution from 04d9d1d and introduces a
better, more permanent solution for the same bug.
2019-05-30 16:18:54 -07:00
YashRE42
43bc1d4d5a info-overlay: Increase size of arrow icons. 2019-05-30 16:18:54 -07:00
YashRE42
5f1a32a9ee arrow-icons: Replace ⇽ , ⇾ with ← , → everywhere.
We were using these hollowed out arrows characters (⇽ , ⇾) in a few
places, these were inconsistent with the solid up and down arrow
characters (↑ , ↓) we use otherwise. This commit replaces them
everywhere in the codebase.
2019-05-30 16:18:54 -07:00
YashRE42
19ad090c99 info-overlay: Switch arrow key names to icons.
This commit switches "Up" with "↑", "Down" with "↓" and etc.
2019-05-30 16:18:54 -07:00
Anders Kaseorg
eeeaf01eef Vagrantfile: Update Docker fallback patch for installed but broken case.
The corresponding upstream PR has been updated as well.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-05-30 16:01:45 -07:00
Vaibhav
f366c50913 user_info: Add bot owner to the user info popover.
This includes all the changes on the frontend side to include the
bot owner in the popover. Includes the bot owner name as a link which
opens the full profile of the bot owner.

For bots without any owner (such as Notification Bot or Welcome Bot)
in place of bot owner name, 'System Bot' appears for cross realm bots
and 'Bot' for in-realm bots.

Fixes #10844.
2019-05-30 15:45:56 -07:00
Vaibhav
20d4aa96a9 user_info: Add is_cross_realm_bot to user info dataset. 2019-05-30 15:43:18 -07:00
Vaibhav
3462db3ecc node: Add test for updating bot_owner_id and enable user_events test suite.
Reverts the commit 4442509ec3
2019-05-30 15:43:18 -07:00
Vishnu Ks
55bf44152a import: Handle hidden_by_limit case for files in slack import.
Fixes #12011
2019-05-30 12:01:09 -07:00
Mateusz Mandera
4facc93670 retention: Add archiving of SubMessages. 2019-05-30 11:40:20 -07:00
Mateusz Mandera
37c42a09e5 retention: Archiving of models tied to a Message, applied to Reactions.
We add general code that will archive models that are tied to a specific
Message (such as Reactions and SubMessages). Certain details of the
model are grabbed from a list models_with_message_key, and then used to
create queries that will archive these database tables.
We put Reaction in that list in this commit, and add appropriate tests.
To have archiving of other analogical models (for example SubMessage),
one only needs to make an appropriate entry in the
models_with_message_key list.
2019-05-30 11:40:20 -07:00
Mateusz Mandera
dfee559333 test_retention: Check that Reactions get correctly deleted. 2019-05-30 11:33:41 -07:00
Mateusz Mandera
29729b7748 test_retention: Check that SubMessages get correctly deleted. 2019-05-30 11:27:38 -07:00
Mateusz Mandera
6d69405f54 test_retention: Keep helper functions in a base class. 2019-05-30 11:27:38 -07:00
Mateusz Mandera
2370e6717c test_retention: Factor out _make_expired_zulip_messages helper function. 2019-05-30 11:27:38 -07:00
Rafid Aslam
b52a7aed07 docs: Move tutorials/documenting-api-endpoints to documentation/api.
Move docs/tutorials/documenting-api-endpoint.md to
docs/documentation/api.md.

This makes it easier to find when browsing the complete set of
materials on writing Zulip documentation.
2019-05-30 11:12:25 -07:00
Hemanth V. Alluri
b67d263b1a api docs: Avoid using \" in curl examples.
It's much cleaner to encode the JSON without quote-escaping.

closes #12196.
2019-05-30 11:05:41 -07:00
Anders Kaseorg
d9f12cfb49 documentation_crawler: They’re called fragments, not permalinks.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-05-30 10:39:47 -07:00
Anders Kaseorg
4f28b88746 documentation_crawler: Set a 15 second download timeout.
By default it just hangs for as long as the server keeps the
connection open.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-05-30 10:39:47 -07:00
Anders Kaseorg
c59747360a documentation_crawler: Set the default log level to warning.
This doesn’t seem to add any noise in the normal case, but if anything
shows up here we might want to see it.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-05-30 10:39:47 -07:00
Anders Kaseorg
2f547eaee4 documentation_crawler: Improve error handling.
* Remove the custom has_error logic in favor of checking whether any
  errors were logged, which gives us a much better chance at catching
  unanticipated exceptions.
* Use our error_callback for the initial requests of start_urls too.
* Clean up mypy types.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-05-30 10:39:47 -07:00
Anders Kaseorg
4c60e994c8 test-documentation: Fail on any nonzero exit code.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-05-30 10:39:47 -07:00
Anders Kaseorg
0ca9c260ae test-documentation: Use getopt; don’t silently ignore multiple arguments.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-05-30 10:39:47 -07:00
Vishnu Ks
8c249644b1 billing: Seperate out tests for invoice and autopay form fields. 2019-05-30 10:34:56 -07:00
Vishnu Ks
a46b2386b6 billing: Add node tests for helpers.js. 2019-05-30 10:34:56 -07:00
Vishnu Ks
b7d210a932 billing: Use javascript onhashchange handler instead of jQuery one.
Makes it easier to obtain the onhashchange handler
in node tests.
2019-05-30 10:34:56 -07:00
Vishnu Ks
5fc538cac0 billing: Use on(click) instead of click handler.
Makes it easy to get the click handler in node tests.
2019-05-30 10:34:56 -07:00
Vishnu Ks
50989a3380 billing: Use location.hash instead of window.location. 2019-05-30 10:34:56 -07:00
Puneeth Chaganti
75635844db lightbox: Set URL in payload instead of computing from video IDs.
Lightbox previews for youtube playlists use the "current" video in the playlist
for the preview. The open link for such previews is incorrectly set to the first
video alone, and not the playlist. This commit fixes the bug by linking to the
original URL for lightbox preview is being shown, instead of computing the URL.
2019-05-29 23:01:54 -07:00
Puneeth Chaganti
85b8be0ace zjquery: Add length attribute to wrapped elements. 2019-05-29 23:01:54 -07:00
Puneeth Chaganti
be527905ca zjquery: Add closest() method. 2019-05-29 23:01:54 -07:00
Tim Abbott
b13add3eaf docs: Add missing index.rst for documentation/.
Apparently I failed to commit this part of our documentation
migration.
2019-05-29 17:54:02 -07:00
Aman Agrawal
a1fadc28ba lint: Make custom_rules.py pass all lint checks.
The functions here weren't checked by all linters when they were in
 `custom_check.py`. Hence, modified to pass all lint checks.
2019-05-29 16:53:59 -07:00
Aman Agrawal
90c3578a88 lint: Move custom_check_file from custom_check.py to custom_rules.py. 2019-05-29 16:53:59 -07:00
Aman Agrawal
cf038f0880 lint: Allow shebang_rules to use include_only/exclude.
Make shebang rules generic to be later extracted out of the
`custom_check_file` function.
2019-05-29 16:53:59 -07:00
Aman Agrawal
42efb60665 lint: Extract general funcs from custom_check.py to zulint/custom_rules.py. 2019-05-29 16:53:59 -07:00
Aman Agrawal
337060de01 lint: Move runnable code form pyflakes.py to zulint/linters.
Extract runnable code from `linter_lib/pyflakes.py` and move it to
`zulint/linters`. This keeps zulip specific pyflakes config separate
form zulint.
2019-05-29 16:53:59 -07:00
Priyank Patel
352b864124 requirements: Add pyinotify dependency. 2019-05-29 16:49:33 -07:00
Rishi Gupta
6d92d628a6 scrollbar: Add data-simplebar-auto-hide=False to several modals.
We're changing our style to always show the scrollbar on the right
pane of modals, because that makes it consistently clear when there
are more items below.
2019-05-29 16:45:42 -07:00
Tim Abbott
ac73dc81f7 settings: Remove rendered_markdown from settings overlay.
It's not clear why we added this (I didn't notice it in review), and
it seems to have been in error, since none of the previous CSS in
5c36918c17 applied to that overlay.

So reverting that hunk.

See #12435 for the original investigation.
2019-05-29 16:43:24 -07:00
Mateusz Mandera
29529cf2e7 retention: Add ArchivedSubMessage model. 2019-05-29 16:26:11 -07:00
Mateusz Mandera
292b4bb0d7 retention: Add ArchivedReaction model. 2019-05-29 16:26:11 -07:00
Mateusz Mandera
2bc6d52c72 retention: Fix name of move_attachment_message_to_archive_by_message.
The first instance of the word "message" should be in plural. We rename
to move_attachment_message_to_archive_by_message.
2019-05-29 16:26:11 -07:00
Mateusz Mandera
2ca650be4d retention: Clean up move_messages_to_archive() for more clarity. 2019-05-29 16:26:11 -07:00
Anders Kaseorg
f0b72a81f3 docs: Document UBUNTU_MIRROR option.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-05-29 16:21:53 -07:00
Anders Kaseorg
630f0fa761 Vagrantfile: Add UBUNTU_MIRROR configuration option.
The default http://archive.ubuntu.com/ubuntu/ is pretty slow in some
locations.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-05-29 16:19:39 -07:00
Anders Kaseorg
ae393456f9 Vagrantfile: Remove LXC provider; move Docker provider to default.
This also means the default dev environment is now based on Ubuntu
18.04 (bionic), part of our overall effort to migrate off Ubuntu
Trusty.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-05-29 16:12:30 -07:00
Anders Kaseorg
a698f87ed8 Vagrantfile: Add monkey patch to fix fallback from Docker provider.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-05-29 16:07:49 -07:00
Anders Kaseorg
2c0980e3a6 Vagrantfile: Remove VMmare Fusion provider.
Ubuntu 14.04 is EOL.  Mac users can use the VirtualBox provider (and
now maybe the Docker provider?).  We can add back the VMware Fusion
provider later if someone cares enough to get it working with Ubuntu
18.04.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-05-29 16:06:33 -07:00
Anders Kaseorg
dc11f197a1 Vagrantfile: Update virtualbox image to bionic.
This is a key part of our process to deprecate Ubuntu trusty: migrating
the Zulip development environment on macOS and Window to Ubuntu 
Bionic.

As part of this, we need to remove ubuntu-server, because it now
depends on update-notifier-common.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-05-29 16:04:13 -07:00
Tim Abbott
0330a5ed82 docs: Use bulleted list for user-facing subsystems.
This makes it a bit more visually obvious that there are more than 3
total things expected below.
2019-05-29 15:52:18 -07:00
Tim Abbott
19666aacbf docs: Update link to FCM. 2019-05-29 15:52:11 -07:00
Tim Abbott
fa37c5cee1 docs: Extract a Writing Documentation top-level section.
This should make this easier to find, and also makes "Subsystems" a
bit smaller of a catch-all.
2019-05-29 15:52:11 -07:00
Anders Kaseorg
1a68ef2951 Vagrantfile: Restore idempotency to vagrant provision.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-05-29 15:38:36 -07:00
Anders Kaseorg
03cfe10da7 coveragerc: Omit blub.
The jedi package exec()s some code in the context of the fake module
blub, causing errors when generating the coverage report.  See
https://github.com/davidhalter/jedi/issues/1122.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-05-29 15:04:47 -07:00
Tim Abbott
7134a12231 pgroonga: Fix do_batch_update logic for all postgres versions.
Apparently, the fix in 430ed061c1
requires a sufficiently modern postgres version not available in
Xenial.

Fixes #12382.

Patch by Sutou Kouhei.
2019-05-29 14:58:44 -07:00
Wyatt Hoodes
857c16d52d Vagrantfile: Add customization to remove log file.
An unnecessary log file gets generated when running vagrant up for the
first time with the Ubuntu Bionic box.  This looks like it is being
caused upstream by the base box containing a Vagrantfile with a line
that looks something like:

vb.customize [ ..., ..., ..., ..., \
File.join(Dir.pwd, "ubuntu-bionic-18.04-cloudimg-console.log") ]

The line added here negates this.
2019-05-29 14:46:54 -07:00
Tim Abbott
49b261b211 i18n: Update translation data from Transifex. 2019-05-28 17:03:35 -07:00
Eeshan Garg
cecea75457 api_docs: Detect missing arguments in curl examples.
This commit adds automated tests that make sure that every curl
example command in our API docs has the '-X (POST|GET)' argument.

Fixes: #11927
2019-05-28 16:53:48 -07:00
Tim Abbott
8339c21637 test-backend: Fix db issues with running two copies in parallel.
Sometimes it's useful to run two copies of test-backend at the same
time.  The problem with doing so is that we need to make sure no two
threads are using the same test database ID.

Previously, this worked only if at most one of those copies was
running in the single-threaded mode, because we used a random database
ID for the single-threaded code path, but the same IDs counting from 0
for the parallel code path.

Fix this, mostly, by generating a random start for the range of IDs
used by the process, and then counting off database IDs starting from
there (both in the parallel and non-paralllel modes).

There's still a very low probability race, see the TODO.
Additionally, there appear to be some other races with running two
copies of test-backend at the same time not related to the database.

See https://github.com/zulip/zulip/issues/12426 for a follow-up issue
that's sorta created by this.
2019-05-28 16:38:45 -07:00
Tim Abbott
095ff28277 test-backend: Avoid dropping/rebuiling zulip_test database.
The test-backend parallel test runner system doesn't actually use the
zulip_test database; instead, it creates its own databases off the
zulip_test_template database.

We were accidentally running `tools/generate_fixtures` even when there
are no changes, because this function is shared with the
tools/lib/test_server.py codebase, which needs us to do the work of
creating a test database for it off the zulip_test_template database.

Fixing this saves about 1.5s / 4s of the runtime of a single test.
2019-05-28 16:38:45 -07:00
Tim Abbott
e0afdb675f test_fixtures: Rename and document update_test_databases_if_required.
The previous name was confusing because `generate_fixtures` isn't
actually a good name in the first place.
2019-05-28 16:38:45 -07:00
Tim Abbott
7b6f219663 test-backend: Flush stdout when starting testing.
This makes the output more properly ordered.
2019-05-28 16:38:45 -07:00
Tim Abbott
4442509ec3 node: Disable a test suite that's missing a line of coverage. 2019-05-28 16:36:30 -07:00
Tim Abbott
0c06c64f77 docs: Extend background discussion on LDAP integration. 2019-05-28 13:53:36 -07:00
Vishnu Ks
31151dadbf import: Replace data-user-group-id in rendered_content.
See the data-user-id commit for details.
2019-05-28 12:53:20 -07:00
Vishnu Ks
ce1d6044db import: Replace data-stream-id in rendered_content.
See the data-user-id commit for details.
2019-05-28 12:53:20 -07:00
Vishnu Ks
cb5b3f347b import: Replace data-user-id in rendered_content with new user id.
Previously, if you exported a Zulip organization and then re-imported
it, we'd end up renumbering the user IDs and all direct foreign key
references to them in the database, but not the data-user-id
references in mentions.  Fix this by parsing the message content and
doing that renumbering.

(Because we import raw markdown, not HTML, from third-party tools,
these changes won't affect data import from slack etc.)

Fixes the high-priority part of #11293.
2019-05-28 12:53:19 -07:00
Vaibhav
61371cbe9a user_info: Add bot_owner_id to user info dataset.
Modifies the dict with the user info to include the key `bot_owner_id`
so it can be displayed in the user info popover.

Tests concerned with changing bot owner have been modified to have
number of events=2 because while updating the bot info, two events
are fired -- updating the `realm_bot` and `realm_user` since the
key `bot_owner_id` is a part of realm user info.
2019-05-28 12:41:52 -07:00
Anders Kaseorg
802d3dbbf4 authenticate: Use keyword-only parameters.
Since positional arguments are interpreted differently by different
backends in Django's authentication backend system, it’s safer to
disallow them.

This had been the motivation for previously declaring the parameters
with default values when we were on Python 2, but that was not super
effective because Python has no rule against positional default
arguments and that convention for our authentication backends was
solely enforced by code review.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-05-27 23:49:54 -07:00
Anders Kaseorg
082f23a659 authenticate: Remove default values for required parameters.
It is now the caller’s responsibility to check that realm is not None.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-05-27 23:47:22 -07:00
Anders Kaseorg
725582850f login_or_register_remote_user: Remove unused invalid_subdomain parameter.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-05-27 23:47:22 -07:00
David Wood
2e9e653af1 webhooks/jira: Fix markup conversion of full links.
This commit modifies the regex used when parsing JIRA's full links of
the form `[text|link]` so that if you have two in a message, Zulip
markup conversion doesn't think that the first link extends to the
closing `]` of the second link.
2019-05-27 23:41:11 -07:00
Tim Abbott
1fec51d73c help: Update the discussion of fake email addresses. 2019-05-27 23:23:48 -07:00
Rishi Gupta
b09c961ef5 docs: Clarify use of we in user docs subsystem. 2019-05-27 23:21:39 -07:00
Rishi Gupta
a2cf66c39e help: Update enable-full-width-display. 2019-05-27 23:21:39 -07:00
Rishi Gupta
0eeae3b6d0 email visibility: Enable feature and add user documentation. 2019-05-27 23:21:39 -07:00
Rishi Gupta
ca942b4878 settings: Restructure CSS for fa-question-circle-o.
There are only two of these icons in the codebase, so it is a relatively
safe change.

Making this change to make it easier to add this icon to labels and other
places in settings.
2019-05-27 23:14:26 -07:00
Puneeth Chaganti
b9eb2aa8e8 lightbox: Switch to using one argument variation of $(...). 2019-05-27 23:07:07 -07:00
Priyank Patel
3f32ffc4eb compose: Use new ID-based api for sending messages.
This only happens if the realm is not a zephyr realm.

Finishes part of #9474.
2019-05-27 22:58:42 -07:00
Vaibhav
eed09527d5 css: Use SCSS nesting in components.scss for .new-style. 2019-05-27 22:50:11 -07:00
Vaibhav
f6051d8819 css: Use SCSS nesting in components.scss for .simplebar-track. 2019-05-27 22:50:11 -07:00
Vaibhav
5cc331b93f css: Cleanup CSS corresponding to .flex-row .field.
A `.field` element already has left margin set as 10px and setting
left-margin explicitly for a `.field + .field` equal to the same
value is redundant. This rule is removed.

Margin is set as `10px 10px` which can be equivalently written as
`10px`.
2019-05-27 22:50:11 -07:00
Vaibhav
c50206b824 css: Use SCSS nesting in components.scss for .flex-row. 2019-05-27 22:50:11 -07:00
Vaibhav
95ab1f238e css: Reorder components.scss so that .flex-row are in same place. 2019-05-27 22:50:11 -07:00
Wyatt Hoodes
5c82c52b52 export.py: Clean up redundant import statements.
There existed duplicate import statements for the S3 backend as a
result of the prior refactoring work.
2019-05-27 20:13:56 -07:00
Wyatt Hoodes
46790b3280 public_export.py: Reorder the creation of the RealmAuditLog object.
This reordering was originally made with regard to the delete after
access feature for the public export.  However, this reordering is
more correct overall, i.e., the object should be created before the
event pertaining to the object is sent.
2019-05-27 20:07:28 -07:00
Wyatt Hoodes
55ff497099 test_realm_export.py: Remove unnecessary variable assignments.
The `queue_data` variable is an intermediate step that's unnecessary.
Instead, the values from the queue event are assigned dierectly.

Also, the `worker` variable is not worth an assignment as it is only
referenced a single time per test case.
2019-05-27 20:07:28 -07:00
Wyatt Hoodes
d32ce0ed7e test_realm_export.py: Clean up the mocking of do_export_realm.
A FileNotFound error was set as the side-effect of the do_export_realm
mock and the DeferredWorker was made to consume the event explicitly.

Previously, the mock of do_export_realm was producing spammy output
as a result of a FileNotFound error coming from the queue processing of
`do_write_stats_file_for_realm_export`.
2019-05-27 20:07:28 -07:00
Wyatt Hoodes
d3a39d6a5b test_realm_export.py: Remove the create_s3_buckets call.
We don't need to create any s3 buckets before hand in this test
case, as we don't get to a point in the testing flow where this
is necessary.
2019-05-27 20:07:28 -07:00
Wyatt Hoodes
551458e776 test_realm_export.py: Remove setUp method to match standard style.
The setUp method for two basic lines of code was removed to match
the typical style of Zulip's unit tests.
2019-05-27 20:07:28 -07:00
Wyatt Hoodes
c0ef6c2fc6 export: Add LOCAL_UPLOADS_DIR support to the export feature.
A unique path was created using the `LOCAL_UPLOADS_DIR` backend, similar
to the code used in `LocalUploadBackend`.  The exported tarball was
copied to the directory, and an nginx url was created to serve the file
publicly.

Tweaked by tabbott to output an actual URL.
2019-05-27 20:06:35 -07:00
Anders Kaseorg
f21d3be5fb dev-vagrant-docker: Copy the host user’s uid for the vagrant user.
This allows /srv/zulip to be writable from the guest even if the host
user’s uid is not 1000.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-05-27 19:21:51 -07:00
Mohit Gupta
a98447b312 bots: Bots can post to announcement-only streams if their owner can.
Bot owned by a non-admin gets blocked but bots owned by an admin
can post to announcement-only stream.

Fixes: #12310.
2019-05-27 18:43:07 -07:00
Mohit Gupta
d60f6c9ad9 test_messages: Fix buggy test, bot tests must use /api/v1 endpoint. 2019-05-27 18:43:07 -07:00
Mayank Madan
7fedcbd840 tests: Extract and use assert_logged_in_user_id test helper.
This cleans up the pattern for how we check which user is logged in
during Zulip's backend unit tests to be much more readable (replacing
the arcane session code that does this check).
2019-05-27 18:32:27 -07:00
Anders Kaseorg
90a9dfa7f5 setup-apt-repo: Try to download pre-setup deps before skipping update.
Simulate isn’t enough in some cases.  The error message when this
fails looks sufficiently non-alarming.

LXC:

    default: + apt-get -dy install lsb-release apt-transport-https gnupg
    default: Reading package lists...
    default: Building dependency tree...
    default:
    default: Reading state information...
    default: lsb-release is already the newest version.
    default: gnupg is already the newest version.
    default: The following NEW packages will be installed:
    default:   apt-transport-https
    default: 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
    default: Need to get 25.1 kB of archives.
    default: After this operation, 238 kB of additional disk space will be used.
    default: Err http://archive.ubuntu.com/ubuntu/ trusty-updates/main apt-transport-https amd64 1.0.1ubuntu2.3
    default:   404  Not Found [IP: 91.189.88.161 80]
    default: Err http://security.ubuntu.com/ubuntu/ trusty-security/main apt-transport-https amd64 1.0.1ubuntu2.3
    default:   404  Not Found [IP: 91.189.88.161 80]
    default: E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/a/apt/apt-transport-https_1.0.1ubuntu2.3_amd64.deb  404  Not Found [IP: 91.189.88.161 80]
    default:
    default: E: Some files failed to download
    default: + apt-get update
    […]
    default: Fetched 4,504 kB in 7s (611 kB/s)
    default: Reading package lists...
    default: + apt-get -y install lsb-release apt-transport-https gnupg
    default: Reading package lists...

Docker:

    default: + apt-get -dy install lsb-release apt-transport-https gnupg
    default: Reading package lists...
    default: Building dependency tree...
    default:
    default: Reading state information...
    default: Package gnupg is not available, but is referred to by another package.
    default: This may mean that the package is missing, has been obsoleted, or
    default: is only available from another source
    default: E: Package 'gnupg' has no installation candidate
    default: + apt-get update
    […]
    default: Fetched 16.2 MB in 5s (3,326 kB/s)
    default: Reading package lists...
    default: + apt-get -y install lsb-release apt-transport-https gnupg
    default: Reading package lists...

(All in green.)

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-05-27 15:25:00 -07:00
YashRE42
04d9d1d27a info-overlay: Fix "message formating" styling.
The introduction of ".rendered_markdown table" in 00eaf3a, caused some
styling glitches in the "message formatting" overlay, such as an extra
right border and darker internal borders. This commit fixes these
glitches by duplicating bootstrap's table styles.
2019-05-27 14:39:09 -07:00
YashRE42
e274ed8c3f info-overlay: Capitalize all hotkeys. 2019-05-27 14:39:09 -07:00
YashRE42
c2e5aa0f1e info-overlay: Shrink bubble around small_hotkey.
Adding a line-height here makes the bubble around the keys smaller which
makes the text within the bubble seem better aligned.
2019-05-27 14:39:09 -07:00
Tim Abbott
8a04284c62 docs: Rewrite translation guide to be much more user-facing.
This guide was originally written as part of the process of adding
i18n support to Zulip, so it had way too much focus on development
tooling details not relevant to translators.

There's probably a separate follow-up project we should do to move the
developers-only content to a separate article, since it's kinda lost
here for that audience.

Thanks to David Wood for asking a question that inspired me to do
this.
2019-05-27 14:28:25 -07:00
Tim Abbott
b1eafde84c transifex: Sort config arguments.
The new version of the `tx push` tool seems to do this automatically.
2019-05-27 13:42:23 -07:00
Mateusz Mandera
0bf90be886 retention: Clean up and rewrite test_retention.py.
test_retention.py had various issues - we opt for keeping its essence
(what should the tests do and verify), but rewriting a lot of it in
order to have more clarity in what's happening there.
2019-05-27 12:53:32 -07:00
Mateusz Mandera
c5ac66b9c8 retention: Split archive_messages code into two functions.
We split archive_messages code into two functions: moving to archive and
cleanup. This allows cleaning up the tests - they can call
these functions directly instead of copying several lines of
archive_messages here and there in multiple tests.
2019-05-27 12:53:32 -07:00
Anders Kaseorg
5231c8e575 dev-vagrant-docker: Unminimize the minimized Ubuntu cloud image.
This restores man pages and other documentation that have been
stripped from the default Ubuntu cloud image and installs
ubuntu-minimal and ubuntu-standard.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-05-27 12:53:11 -07:00
Rohitt Vashishtha
eb44b7d69d linter: Do not lint scripts parsed with tail (like dev-motd). 2019-05-27 12:40:02 -07:00
Vishnu Ks
9e86a8b4d4 requirements: Explicitly specefy phonenumberslite as a dependency.
If we don't specify phonenumberslite explicitly it would
be removed when setuptools is upgraded to latest version.
2019-05-27 12:07:47 -07:00
Anders Kaseorg
08f2ef0893 settings: Disable auto-hide on right pane scrollbar.
Fixes #11694.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-05-24 17:44:21 -07:00
Anders Kaseorg
b594708915 Vagrantfile: Be nicer to /etc/update-motd.d.
Some of its information is helpful.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-05-24 17:33:06 -07:00
Anders Kaseorg
407564086d provision: Move apt-get update from retry handler to setup-apt-repo.
This avoids unnecessarily alarming error messages if the apt cache is
missing.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-05-24 17:07:38 -07:00
Anders Kaseorg
ae524b677d ci: Move backend and production tests to Ubuntu 16.04 (xenial).
This is preparation for dropping support for Trusty in CI.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-05-24 17:07:15 -07:00
Vishnu Ks
e40addd181 jobs: Mention the email ID for applying to job. 2019-05-24 15:50:41 -07:00
Tim Abbott
669ac27d23 docs: Remove extensive motd from example output.
We don't actually display this motd anyway.
2019-05-24 15:49:28 -07:00
Anders Kaseorg
684ebc2a5e Vagrantfile: Support docker provider.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-05-24 15:43:23 -07:00
vinitS101
4c8f9f07d7 uploads: Add comment explaining how to disable uploads.
Added a comment to explain how to disable file uploads, and what other
changes that will cause.
2019-05-24 14:47:04 -07:00
Anders Kaseorg
3b7f3f1887 dependencies: Upgrade simplebar to 4.0.0.
Fixes #12347.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-05-23 17:31:07 -07:00
Anders Kaseorg
eec608d6a3 css: Improve SimpleBar scrollbar contrast.
Show black scrollbars with a thin light border in day mode, or white
scrollbars with a thin dark border in night mode (both at 50%
opacity).  This matches the native scrollbars on macOS pretty closely.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-05-23 17:26:19 -07:00
Greg Price
de66b3b0f1 corporate: Add a /jobs page, with job posts for mobile/fullstack.
With various edits from Rishi and Tim.
2019-05-22 22:20:58 -07:00
Hemanth V. Alluri
1dfac14e33 devtools: Change "message" to "results_notice" the integrations tool.
This was done to avoid confusion between the user notification (now
being called results_notice) and Zulip's messages.
2019-05-22 21:28:11 -07:00
Hemanth V. Alluri
0e88a368de devtools: Make http headers "{}" by default in the integrations tool. 2019-05-22 21:28:11 -07:00
Hemanth V. Alluri
c47521401f devtools: Move the integrations devtool JS to the portico folder. 2019-05-22 21:28:11 -07:00
Mateusz Mandera
db86043195 test_retention: Quick fix for the remaining test failure.
test_cross_realm_messages_archiving_two_realm_expired doesn't run the
code path patched in commit 3d1aa98b2ea344fba7fbb2373a37d4cf30f53e08i,
so it can still fail. We apply the analogical change in the test as
in the cited commit.
2019-05-22 14:15:18 -07:00
Tim Abbott
3d1aa98b2e retention: Use a consistent ordering for processing realms.
This is probably a good idea for the production use case, since then
there's some consistency of behavior, and if we extend logging, one
knows exactly which realms were or were not executed before a logged
failure.

This fixes the nondeterministic test failures we've been seeing in CI:
if you use `-id` in that order_by, it happens consistently.
2019-05-22 10:48:53 -07:00
Yashashvi Dave
3e50ed2075 org settings: Add organization profile preview option.
This should make it convenient and obvious how verify that their
organization profile looks nice after being markdown-rendered.

Fixes #12105.
2019-05-21 17:53:34 -07:00
David Wood
e87d468f76 docs/org settings: Use "full member" terminology.
This commit modifies the help documentation and templates to use a "full
member"/"new member" terminology throughout.

With some tweaks by tabbott.
2019-05-21 17:48:46 -07:00
David Wood
0a56a1904d docs: Update documentation for new user settings.
This commit updates the documentation to reflect changes to the new user
settings.
2019-05-21 17:36:48 -07:00
David Wood
6b9a9b1e31 org settings: Extract setting for new user waiting period.
This commit separates the `waiting_period_threshold` setting from
the `create_stream_policy` setting, adding a new setting that the user
can use to select a waiting period threshold.

Both the invite to stream policy and create stream policy now have
three options: admins only, members and admins, or members after
waiting period/admins.
2019-05-21 17:36:48 -07:00
David Wood
5e53e3d960 org settings: Remove hanging references.
`realm_invite_to_stream_by_admins_only` doesn't appear elsewhere in our
codebase. Introduced in 272ed90, so I'm guessing this is the intended
value.

Co-Authored-By: Rishi Gupta <rishig@zulipchat.com>
2019-05-21 17:36:47 -07:00
David Wood
24cb31329c org settings: Fix dropdown value inconsistency.
The value in the handlebars template for `invite_to_stream_policy`
is inconsistent with the value in the js file. Changing all three
occurances to a third value, since that's the one we'll want moving
forward.

Co-Authored-By: Rishi Gupta <rishig@zulipchat.com>
2019-05-21 17:36:47 -07:00
Kanishk Kakar
68d3b9f5ca docs: Update desktop app version to 3.0.0. 2019-05-21 15:16:06 -07:00
Mayank Madan
d5e61e20e5 dev tooling: Add "create new user" and "create new realm" buttons.
Significantly tweaked by tabbott to clean up and expand the tests.

Fixes: #6018.
2019-05-21 15:03:37 -07:00
Tim Abbott
6a42280e31 auth: Fix devlogin "All realms" view.
This was apparently accidentally broken (making it 500) by the
refactoring in 9efda71a4b.
2019-05-21 14:46:15 -07:00
YashRE42
7c7992f56b info-overlay: Replace all capitalized hotkeys.
In this commit, we replace all capitalized hotkeys with <Shift> + <Key>.
2019-05-21 14:25:24 -07:00
YashRE42
b8afddbd2a info-overlay: Add "bubble" style to keys. 2019-05-21 14:25:24 -07:00
YashRE42
8a914eb111 info-overlay: Unbold "or" between hotkeys. 2019-05-21 14:25:24 -07:00
YashRE42
15d04904bb info-overlay: Switch labels to left, keys to right. 2019-05-21 14:25:24 -07:00
YashRE42
e2ba65aa3f info-overlay: Improve styling of hotkeys.
Fixes: #11573.
This moves help_table to informational-overlays.scss, replaces "," with
"or" and "P" with "shift + p" in order to be more clear and legible
this also improves the styling of the text.
2019-05-21 14:25:24 -07:00
Vishnu Ks
9273d0e7be tests: Check for private message special case in consented realm export. 2019-05-21 14:10:29 -07:00
Vishnu Ks
0a466914c4 tests Add PM tests for test_export_realm_with_exportable_user_ids. 2019-05-21 14:10:29 -07:00
Vishnu Ks
044d620ee0 tests Add PM tests for test_zulip_realm. 2019-05-21 14:10:29 -07:00
Vishnu Ks
5a8ddffb0b tests: Split export realm with exportable_user_ids into seperate test. 2019-05-21 14:10:29 -07:00
Vishnu Ks
3f24cc4b86 tests: Move find_by_id to ZulipTestCase. 2019-05-21 14:10:29 -07:00
Vishnu Ks
68387b9f00 tests: Move get_set to ZulipTestCase. 2019-05-21 14:10:29 -07:00
Vishnu Ks
cc88f95229 tests: Test for PMs in test_export_realm_with_member_consent.
Sending PM from a hamlet(consented) to othello is a case
of sending message from a consented user to a non consented
user. This result in the generation of more than one message
files during realm export. To handle this case _export_realm
is updated.
2019-05-21 14:10:29 -07:00
Vishnu Ks
21e7763886 export: Remove unnecessary query from export_partial_message_files.
The query is not required anymore after the refactoring done
while merging #12225.
2019-05-21 14:10:29 -07:00
Vishnu Ks
319fe62d44 test: Fix third huddle variable name in test_import_export. 2019-05-21 14:10:29 -07:00
Tim Abbott
bde9b28589 test_retention: Update debugging code for CI failures.
This should provide more helpful output for the next stage of
debugging.
2019-05-21 14:10:15 -07:00
Tim Abbott
3de3cb7385 tests: Remove accidentally added empty test file. 2019-05-21 10:03:01 -07:00
Tim Abbott
55b15ba117 test_retention: Improve and extent print-debugging.
We needed flush=True to have output not be lost.

Also print the original messages, so we can compare what's missing.
2019-05-21 09:28:03 -07:00
Lobster
c1538fd0f5 docs: Update docs for Redmine Integration 2.0. 2019-05-21 09:21:28 -07:00
Tim Abbott
3996b62c79 test_messages: Fix logging in as a bot user.
Bot users can't login, but apparently one could force it with the
Django test system's login function.  We should just post to the API.
2019-05-20 20:21:35 -07:00
Wyatt Hoodes
4dd8c133a9 export: Rename --upload-to-s3 to be --upload.
The upload option will no longer be limited to strictly S3 uploads. This
commit serves as a preliminary step for supporting LOCAL_UPLOADS_DIR as
part of the public only export feature.
2019-05-20 19:59:57 -07:00
Tim Abbott
1353e94b29 test_retention: Add print-debugging.
We've been seeing nondeterministic failures in this test suite in CI
that we can't reproduce locally; these print statements should help
track them down.
2019-05-20 19:43:28 -07:00
Mateusz Mandera
58da8fd5f1 test-backend: Remove email_mirror from not_yet_fully_covered.
The preceding commits get the email mirror to 100% coverage, so we can
now remove zerver/lib/email_mirror.py from the list of not-fully-covered
files.
2019-05-20 19:35:32 -07:00
Mateusz Mandera
4f9bbe9d66 email_mirror: Clean up and expand test_get_missed_message_token.
This is the only function in TestEmailMirrorLibrary, so we rename this
class to more appropriate TestGetMissedMessageToken, clean it up a bit
and add some extra checks to finally get email_mirror.py to 100% test
coverage.
2019-05-20 19:35:32 -07:00
Mateusz Mandera
a0efd76f4e email_mirror: Rewrite log_and_report and cover it with tests.
log_and_report and its helper functions were mostly old code no longer
well adapted to how email mirror works currently, as well as having no
test coverage. We rewrite this part of the email to report errors in a
similar manner, and add tests for it. We're able to get rid of the
clunky and now useless debug_info dictionary in process message, as
log_and_report only needs the recipient email in its third argument.
2019-05-20 19:35:32 -07:00
Mateusz Mandera
2adcdd0c25 email_mirror: Don't pass debug_info to process_stream_message.
The only place in which process_stream_message used debug_info was to
set the 'stream' key, which would only be used if ZulipEmailForwardError
was raised after this line in the code - which is impossible, because after
that line only send_zulip (which doesnt raise this exception) and
logger.info get called, then process_stream_message successfully returns
and then process_message succesfully returns as well. So this debug_info
code wasn't doing anything. We remove it.
2019-05-20 19:35:32 -07:00
Anders Kaseorg
f146a2a5ac Revert "gitattributes: Mark yarn.lock as "binary", i.e. suppress diffs."
This reverts commit a717ac6d85.

.gitattributes affects the behavior of many Git operations like rebase
and merge and mergetool, not just the output of show and diff.
Treating yarn.lock as binary was making it too hard to deal with
yarn.lock diffs when we actually needed them.  Also, the GitHub
website ignores this setting and suppresses large parts of diffs
regardless.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-05-20 19:31:14 -07:00
Anders Kaseorg
2f43284dd8 user_profile_modal: Move SimpleBar back to the correct div.
Fixes a regression in commit 01613e71fb
(#12348).

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-05-20 19:25:21 -07:00
Anders Kaseorg
d267884cc1 node_cache: Run yarn install with --frozen-lockfile.
This way a yarn.lock inconsistent with package.json can’t slip through
unnoticed.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-05-20 19:23:37 -07:00
Anders Kaseorg
978357e55e dependencies: Update yarn.lock for simplebar@4.0.0-alpha.9 upgrade.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-05-20 19:23:37 -07:00
Tim Abbott
4cbe489576 docs: Highlight send messages API in incoming webhooks page.
While we already talk about this in the "overview" section, it appears
some folks skipped that and were confused.
2019-05-20 19:18:30 -07:00
Tim Abbott
e35773658b css: Remove weird whitespace rules in markdown content.
These seem to have been there since the very first version of our
markdown styling, and I can't imagine why we would the behavior of not
line-wrapping links now.

(I think the "weird bug" mentioned in the comment history might have
to do with an old animation when you hovered over a link on portico
pages).
2019-05-20 19:14:35 -07:00
Tim Abbott
734c18f356 integrations: Fix buggy ol/paragraph spacing.
This appears to caused by trying to reuse this bit of spacing logic
from the Help Center's CSS rules.

I'm not altogether happy with this fix, but it resolves the issue and
we can defer further work until we're ready to clean up the
portico/landing pages CSS more generally.
2019-05-20 18:54:46 -07:00
sameerchoubey
d711b1c8ba portico: Add responsive styling to /integrations/ subpages.
Tweaked by tabbott to clean up the commit message and some confusing
code duplication.

Fixes #11701.
2019-05-20 18:49:27 -07:00
Aditya Bansal
43591d6c71 archives: Display globe icon for web public streams.
In this commit we start reserving the globe icon for web public
streams and replace instances of mixed usage of globe for public
streams with a '#'.
2019-05-20 18:13:31 -07:00
Tim Abbott
ba56833b02 auth: Make development login work with emails hidden. 2019-05-20 18:13:31 -07:00
Joshua Pan
c28c301506 org_settings: Display delivery_email to admins always is admin UI.
Mostly rewritten by Tim Abbott to ensure it correctly implements the
desired security model.

Administrators should have access to users' real email address so that
they can contact users out-of-band.
2019-05-20 18:13:31 -07:00
Tim Abbott
07856ad648 api: Override client_gravatar for EMAIL_ADDRESS_VISIBILITY_ADMINS.
Clients won't have access to user email addresses, and thus won't be
able to compute gravatars.

The tests for this are a bit messy, in large part because our tests
for get_events call subsections of it, rather than the main function.
2019-05-20 18:13:31 -07:00
Tim Abbott
bcc6949461 zilencer: Add better error handling for IntegrityError.
This provides a clean warning and 40x error, rather than a 500, for
this corner case which is very likely user error.

The test here is awkward because we have to work around
https://github.com/zulip/zulip/issues/12362.
2019-05-20 17:53:43 -07:00
Pragati Agrawal
8eac7394f8 typeahead helper: Hide email under hidden email-address-visibility cases.
In email hidden case (that is when `email_address_visibilty` is set to
everyone), for "non admins", this commit hides emails from:
- compose box user typeahead.
- PM user typeahead
In email hidden case, for admins, email is shown in user typeaheads.
2019-05-20 15:56:23 -07:00
Pragati Agrawal
cdc50090b6 popovers: Hide email under hidden email-address-visibility cases.
In email hidden case (that is when `email_address_visibilty` is set to
everyone), for "non admins", this commit hides emails from:
- user popover
- custom profile popover
In email hidden case, for admins, email is shown in both user popovers and
custom profile popovers.
2019-05-20 15:56:21 -07:00
Pragati Agrawal
4df971c3c2 org settings: Add save/discard widget for realm authentication methods.
Along with this, we refactored settings_org.populate_auth_methods to use
HTML function after rendering all auth methods rows rather than appending
each row individually, which actually is a good practice.

Also in this commit, to compare `current_val` and `changed_val` in
`check_property_changed` function of the property
`realm_authentication_methods`, which are objects, and we found here
https://stackoverflow.com/a/1144249 that there is no easy way to do so. So
I followed this approach,

```js
 JSON.stringify(obj1) === JSON.stringify(obj2)
```

but before converting them to string we want the same order of keys, so we
used `sort_object_by_key` to sort `current_val` by keys and
`get_auth_method_table_data` always return `changed_val` having keys
sorted.

Since these refactor were closely related we kept them as a single commit
here.

Fixes: #11954.
2019-05-20 15:42:15 -07:00
Pragati Agrawal
c634d22de9 org settings: Add sort_obj_by_key function to sort objects.
Actually, this is a preliminary commit which adds a general
`sort_obj_by_key` function to sort objects according to keys.

In this commit, we have refactored `populate_auth_methods` function by
extracting the logic for the desired `sort_obj_by_key` and used that to
sort `auth_methods`, but the main motive of this function is to sort
`realm_authentication_methods` in `check_property_changed` to sort
`current_val` in the upcoming commit.
2019-05-20 15:41:45 -07:00
Tim Abbott
7042965102 docs: Remove Vagrant docs zulip-devel recommendation.
Nobody has actually gone to the email list in like 2 years, and we
just renamed it to be an announcement list.
2019-05-20 15:37:13 -07:00
Tim Abbott
a15d85e7c4 integrations: Remove zulip-devel@ recommendation for jenkins.
That list is deprecated, and further, the issue tracker for the plugin
is a better place to report issues/trouble with the plugin in any
case.
2019-05-20 15:30:04 -07:00
Tim Abbott
e006a628b1 docs: Update THIRDPARTY notes on upstream.
Mostly copyright date updates, but also removing references to the
deprecated zulip-devel@googlegroups.com.
2019-05-20 15:29:05 -07:00
Tim Abbott
136a0da30b provision: Update unsupported architecture logging messages.
We don't use zulip-devel@ anymore, and also add a comment that it's
probably not a huge project to support e.g. arm.
2019-05-20 15:23:40 -07:00
Vishnu Ks
d1007c0a6b docs: Mention twitter account as alternative to mailing list. 2019-05-20 15:21:15 -07:00
Vishnu Ks
6c6754d41c docs: Update mailing list id in contributing.md. 2019-05-20 15:21:15 -07:00
Rishi Gupta
fbc2239f73 keyboard shortcuts: Update description for S. 2019-05-20 15:10:11 -07:00
Rishi Gupta
3a02e362f5 keyboard shortcuts: Remove P from Basics.
This is not a top ten shortcut to know, and will eventually be g+p anyway.
2019-05-20 15:10:11 -07:00
Puneeth Chaganti
bdf8183f55 open graph: Uploaded realm icon URL is absolute for some backends.
The `LocalUploadBackend` returns a relative URL, while the `S3UploadBackend`
returns an absolute URL. This commit switches to using `urljoin` to obtain the
absolute URL, instead of simply joining strings.
2019-05-20 13:14:28 -07:00
Tim Abbott
263657dcb6 integrations: Clean up comments in devtool JavaScript.
Most of this is just editing for brevity or focus.
2019-05-20 12:52:56 -07:00
Hemanth V. Alluri
1a12e112d9 devtools: Completely overhaul the frontend for the integrations devtool.
This commit also adds a small functionality change where the results of
each webhook fixture message sent is now displayed to the user.

With a small tweak by tabbott to fix a styling bug.

Fixes #12122.
2019-05-20 12:36:15 -07:00
Hemanth V. Alluri
ef98211f68 devtools: Add support for non-json fixtures for the integrations tool.
Note: If you're going to send fixtures which are not JSON or of the
text/plain content type, make sure you set the correct content type
in the custom headers.

E.g. For the wordpress fixtures the "Content-Type" should be set to
"application/x-www-form-urlencoded".
2019-05-20 12:31:52 -07:00
Hemanth V. Alluri
8214d65336 devtools: Add support for send_all in the integrations dev panel.
Using this feature a reviewer can easily send and view all fixture
messages for any given integration - with only JSON fixtures that is.
2019-05-20 12:29:10 -07:00
Rishi Gupta
d17fb622c9 popovers: Refactor user popover to match visual order.
Just swapping an "if is_me" block with a consecutive "unless is_me" block,
so should be no change in logic.
2019-05-20 12:21:57 -07:00
Rishi Gupta
36ff56e741 message feed: Add hotkey hint to Edit pencil on message hover. 2019-05-20 12:18:13 -07:00
Tim Abbott
a28af1fd64 css: Remove unnecessary prefixed transitions.
The transition keyword has been standard for a while now; see the
previous commit for details.
2019-05-20 12:15:16 -07:00
Boris Yankov
18a350f042 css: Remove unnecessary 'prefixed-transition' mixin.
The `transition` property does not need prefixing. In fact, very
few properties need that nowadays. So remove it to simplify
the code. This is strictly a refactor with no style change intended.

Many of these styles shouldn't have been prefixed even if needed.
The prefixes exist exactly because the implementations might differ
from the incoming standard.

Looking at the supported browsers:
https://caniuse.com/#search=transition

We see that this property has had mainstream support from 2012 and
was supported on Firefox in 2006 !!!
2019-05-20 12:15:16 -07:00
Vaibhav
76295dd59f css: Club rules in reactions.scss under selector .message_reaction_count. 2019-05-20 12:01:49 -07:00
Vaibhav
ae47ddc16e css: Use SCSS nesting in reactions.scss for .reaction_button. 2019-05-20 12:01:49 -07:00
Vaibhav
e8c072a4c8 css: Reorder reactions.scss so that .reaction_button are in one place. 2019-05-20 12:01:49 -07:00
Vaibhav
c4b683a638 css: Use SCSS nesting in reactions.scss for .message_reaction. 2019-05-20 12:01:49 -07:00
Vaibhav
9ef3a660b3 css: Reorder reactions.scss so .message_reaction are in same place. 2019-05-20 12:01:49 -07:00
Vaibhav
9e1ee434a7 css: Use SCSS nesting in reactions.scss for .private-message.
Precisely for `.private-message .message_reactions .message_reaction`.
2019-05-20 12:01:49 -07:00
Vaibhav
129dfec297 css: Use SCSS nesting in reactions.scss for .message_reactions. 2019-05-20 12:01:49 -07:00
Vaibhav
c726198cbc css: Reorder reactions.scss so .message_reactions are in same place.
This atomically makes `.private-message` in same place too.
2019-05-20 12:01:49 -07:00
Vaibhav
7d8ced7375 css: Use SCSS nesting in reactions.scss for .emoji-popover-emoji. 2019-05-20 12:01:49 -07:00
Vaibhav
eb8a8fa0dc css: Reorder reactions.scss so .emoji-popover-emoji are in same place. 2019-05-20 12:01:49 -07:00
Vaibhav
a20b48589f css: Use SCSS nesting in reactions.scss for emoji popover rules. 2019-05-20 12:01:38 -07:00
Vaibhav
8eaa12c49a css: Reorder reactions.scss so .emoji-popover are in same place. 2019-05-20 11:53:34 -07:00
Vaibhav
09745d6637 css: Remove redundant .reaction_button rule from reactions.scss.
The removed rule does not apply in any case since it's always overridden
by `.message_reaction + .reaction_button` rule defined later on.
2019-05-20 11:53:34 -07:00
Tim Abbott
e4c3864772 docs: Further update architecture overview intro. 2019-05-20 11:48:34 -07:00
Tim Abbott
f140228528 docs: Update architecture overview introduction.
This doc needs significant further updates, but this at least makes
clear Zulip supports organizations well past 1000 users and adds some
links.
2019-05-20 11:35:47 -07:00
Steve Howell
6b39d6004e zjquery: Use Proxy to detect undefined stubs.
We now use a Proxy to wrap zjquery elements, so
that we can detect callers trying to invoke methods
(or access attributes) that do not exist.  We try
to give useful error messages in those cases.

The main impact here is that we force lots of tests
to explicitly stub `length`.

Also, we can't do equality checks on zjquery
objects any more due to the proxy object, but the
easy workaround is to compare selectors.  (This
is generally an unnecessary technique, anyway.)

The proxy wrapper is fairly straightforward, and
we just have a few special cases for things like
"inspect" that happen when you try to print out
objects.
2019-05-20 11:28:32 -07:00
YashRE42
9b32c844df navbar: Fix stream + topic jump at 500px.
This resolves a bug where the "stream" tab item would be missaligned
with the rest of navbar and leave some empty space.
2019-05-20 11:26:22 -07:00
Tim Abbott
c2baca2c78 ci: Don't run codecov on additional platforms.
The coverage data for the platform where we run the backend+frontend
tests should be complete, so there's no reason to upload coverage data
for the other platforms.

Hopefully this change will decrease the likelihood of codecov
producing flaky results.
2019-05-20 11:02:58 -07:00
Kanishk Kakar
77ab9a0eb0 docs: Update desktop repo URL. 2019-05-20 11:01:11 -07:00
K.Kanakhin
e930851d16 retention-period: Add more core code for retention policy.
This is a very old commit for #106, which has been on hiatus for a few
years.  It was significantly modified by tabbott to:
* Improve coding style and variable names
* Update mypy annotations style
* Clean up the testing logic
* Update for API changes elsewhere in our system

But the actual runtime code is essentially unmodified from the
original work by Kirill.

It contains basic support for archiving Messages, UserMessages, and
Attachments with a nice test suite.  It's still not usable in
production (e.g. it will probably break Reactions, SubMessages, etc.),
but upcoming commits will address that.
2019-05-19 20:22:47 -07:00
Tim Abbott
ec4221abb9 actions: Return message ID from internal_send_*_message.
This is handy for code that needs to do something with the sent
message.  We need it for a retention policy code path, but it seems
likely we'll use it a lot down the line.
2019-05-19 19:18:06 -07:00
Anders Kaseorg
01613e71fb ui: Replace set_up_scrollbar with data-simplebar attribute.
With perfectScrollbar, we needed to call a function from JavaScript to
enable a scrollbar on a new element, but simplebar has a much simpler
default API one can do by using data-simplebar attributes in the HTML.

So we can delete all the scrollbar creation/deletion code.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-05-19 18:06:38 -07:00
Tim Abbott
119948022f docs: Improve discussion of GitHub area teams.
The content in that paragraph had been written when GSoC was mainly
zulip/zulip.
2019-05-19 16:19:47 -07:00
Tim Abbott
cd1ec37404 puppet: Make uwsgi listen backlog limit configurable.
This can be useful for busy servers to limit the risk of bursts of
traffic causing them to reject requests.
2019-05-17 12:38:56 -07:00
Anders Kaseorg
3daa4fa64d pm_list: Set up #private-container once and replace its contents.
Instead of deleting and rebuilding #private-container every time its
contents need to be updated, just replace its contents.  This
eliminates some scrollbar flashing.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-05-17 12:06:51 -07:00
Anders Kaseorg
141088586b Completely replace perfect-scrollbar with SimpleBar.
perfect-scrollbar replaces both the appearance and the behavior of the
scrollbar, and its emulated behavior will never feel native on most
platforms.  SimpleBar customizes the appearance while preserving the
native behavior.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-05-17 12:06:51 -07:00
Anders Kaseorg
491589579a dependencies: Upgrade simplebar to 4.0.0-alpha.9.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-05-17 12:06:51 -07:00
Hemanth V. Alluri
e23d5e9631 devtools: Set default stream and topic in integrations dev panel.
This makes it a lot faster to just send a message with a few clicks.
2019-05-17 11:53:05 -07:00
Hemanth V. Alluri
2bd9c8cb42 devtools: Add custom HTTP headers support to the integrations dev panel.
This commit introduces a simple field where the user can now specify custom
HTTP headers. This commit does not introduce an improved system for storing
HTTP headers as fixtures - such a change would modify both the existing unit
tests as well as this devtool.
2019-05-17 11:50:53 -07:00
Hemanth V. Alluri
64b4fd5923 management: Extract parse_headers in send_webhook_fixture_message.
This way other devtools such as the integrations development panel
could also use the method.
2019-05-17 11:50:53 -07:00
Hemanth V. Alluri
5b4979806c devtools: Don't clear fields on fixture submission error. 2019-05-17 11:50:39 -07:00
Rishi Gupta
17774a80cb org settings: Update organization logo section.
This section was taking up too much visual weight, and drowning out other
elements on the page.

Once we remove the Upload buttons, we can likely shrink this further.

We remove the box-radius since at the smaller size it interferes with how
the logos look (and will look in the app).

We remove the margin-top to make this consistent with the spacing around
organization profile picture.

We change the max width from 730 to 500 since the Upload new logo button is
214px in length (not including margin), and those buttons are now inline
instead of on the next line.
2019-05-17 11:48:17 -07:00
Rishi Gupta
e9a180dcb4 org settings: Fix box-shadow in organization logos section.
The box-shadow was
* Not being applied to the images (the images get their box shadow from a
  more specific rule)
* Being unintentionally applied to the upload/delete buttons
* Being unintentionally applied to the container housing the buttons and
  error messages.

The last one especially looked bad, since it added boxes where there
otherwise wouldn't be a box.
2019-05-17 11:48:17 -07:00
Rishi Gupta
7c9f377db0 help: Add enable-full-width-display.
Tweaked by tabbott to briefly describe the reason for Zulip's default;
this rough description has been satisfying for many people who've
asked in the past on chat.zulip.org.
2019-05-17 11:45:33 -07:00
Rishi Gupta
d0dcee9b59 docs: Make minor edits to gsod-ideas.md. 2019-05-17 11:37:57 -07:00
Rishi Gupta
fbe9c31683 help: Simplify description of non-consenting member export caveat. 2019-05-17 11:37:57 -07:00
Rishi Gupta
f49103d1ee help: Clarify that deleting a topic also deletes messages with that topic. 2019-05-17 11:37:57 -07:00
Vishnu Ks
e7507a6eb1 tools: Avoid upgrading stripe automatically.
Upgrades to the stripe library can sometimes break semantics for our
billing system, and so we should make sure to use our documented 
testing process before doing them.
2019-05-17 11:36:35 -07:00
Vishnu Ks
56259c7acd lint: Catch exit(1) in management commands.
Using sys.exit(1) in a management command makes it impossible
to unit test the code in question.  The correct approach to
do the same thing in Django management commands is to raise
CommandError.
2019-05-17 11:34:00 -07:00
Puneeth Chaganti
5f50c4d799 cache: Clear realm descriptions when description is changed.
Clear both the rendered and the text descriptions for a realm, when the
description of the realm is changed.
2019-05-17 11:31:14 -07:00
Puneeth Chaganti
f084075c2a cache: Clear rendered realm text description when flushing realm.
The commit 2d9c5b3575 introduced this cache key,
and didn't setup clearing of the cache correctly.
2019-05-17 11:31:14 -07:00
Anders Kaseorg
76f25bca59 templates: Reenable mobile zooming on non-app pages.
Commit db45d220a8 (#3996) disabled
mobile zooming on all pages, with the reasoning that focusing an input
may automatically zoom the page and break content.  I’m not sure
whether that was a good reason, but at most it only applies to the app
page.  Reenable zooming on all other pages like the portico and
documentation to improve their accessibility.

(Note: the other common reason to disable zooming, which was that
mobile browsers once added a 300ms tap delay to recognize double-tap
zoom gestures, has been obsolete since 2014:
https://developers.google.com/web/updates/2013/12/300ms-tap-delay-gone-away)

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-05-17 11:30:30 -07:00
Anders Kaseorg
cdd09d0441 meta_tags: Remove twitter:title, twitter:description, twitter:image.
Twitter falls back to og:title, og:description, og:image, which we set
identically, so these are redundant.

https://developer.twitter.com/en/docs/tweets/optimize-with-cards/overview/markup.html

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-05-16 21:19:08 -07:00
Mohit Gupta
1902f5210c message_flags: Batch read flag requests to at most 1k message IDs at a time.
Send at most 1k message ids in a single read flag request to avoid locking
large number of rows in server database in a single request and avoid long
processing time.

Fixes #11956.
2019-05-15 17:56:48 -07:00
Rishi Gupta
d9d0285865 requirements: Downgrade stripe from 2.27.0 to 2.21.0.
Reverts c09962b and 697b4b2. The lines that break look like
stripe.Invoice.finalize_invoice(stripe_invoice).

Something like stripe_invoice.finalize_invoice() would work, but it's a big
change given how the tests in test_stripe.py currently work.
2019-05-15 17:27:32 -07:00
Tim Abbott
68255fe1df lint: Fix exclusion for development directory.
I forgot about running `test-tools` when making linter changes.
2019-05-15 13:40:33 -07:00
Tim Abbott
7f2fcea794 lint: Ban i18n usage under zerver/views/development. 2019-05-15 13:11:04 -07:00
Hemanth V. Alluri
bae8295c52 devtools: Add integrations dev panel.
This commit adds a new developer tool: The "integrations dev panel"
which will serve as a replacement for the send_webhook_fixture_message
management command as a way to test integrations with much greater ease.
2019-05-15 13:07:44 -07:00
Vishnu Ks
06983298ba export: Add support for exporting realm with member consent.
This lets us handle directly in our tooling the user experience that
we document for exporting a realm with member consent (before, it
required unpleasant manual work).
2019-05-15 12:35:32 -07:00
Vishnu Ks
8ebdbea4d5 tests: Remove commented out print statements in test_import_export. 2019-05-15 11:57:31 -07:00
vinitS101
611f1f8fd2 left_sidebar: Add "+Add streams" to bottom of streamlist.
Added a new button at the bottom of the stream list which redirects
users to '/#streams/all' where they can create new streams or subscribe
to new streams.
The button is not visible to guests.

Fixes #11642.
2019-05-14 16:12:51 -07:00
vinitS101
e8c1523aa2 left_sidebar: Gear icon now redirects to '/#streams/subscribed'.
The gear icon above the streamlist now redirects to
'/#streams/subscribed' instead of '/#streams/all'.
2019-05-14 16:12:51 -07:00
Puneeth Chaganti
64ad031d5c writing-bots: Use a fenced code block to fix rendering.
Type annotation for the function is not rendered correctly: `-> None` is
rendered as `-&gt; None`.
2019-05-14 15:35:12 -07:00
Tim Abbott
dc2aa031f6 linkifiers: Allow semicolons in target URLs.
This fixes another user report.  The right fix is to convert this to
use a normal URL validator after substitution.
2019-05-14 11:17:55 -07:00
vinitS101
a06f35182d copy_and_paste: Extract functions for div creation and removal.
This moves div creation and removal code in the copy_handler function
to separate functions for more reusability.
2019-05-13 18:07:21 -07:00
Vaibhav
d3b201337e copy_and_paste: Bind default copy handler to hotkeys.
This removes the 'copy' event listener and binds the copy handler
to `Ctrl+C` or `Cmd+C` (OSX) keys;
2019-05-13 17:58:12 -07:00
Yashashvi Dave
3c4971edc1 subscriptions: Fix error when guest user is subscribed to public stream.
When guest user is subscribed to public stream, it throws json
error. Because when guest user is subscribed to public stream,
the `stream-sub-count` element is not initialized.
This commit fix this error, by editing the function
`rerender_subscribers_count` to intialize the element
first, when guest user is subscribed.
2019-05-13 17:47:22 -07:00
Yashashvi Dave
b5b5700338 hashchange: Redirect guest user on not-allowed stream settings hash. 2019-05-13 17:27:32 -07:00
Yashashvi Dave
3f38fc6b79 streams: Redirect to subscribed-tab on unsubscription for guest user.
This commit add code to redirect guest users to
subscribed-stream-tab and removes the recently-unsubscribed
stream from settings tab on unsubscription.
2019-05-13 17:27:32 -07:00
Yashashvi Dave
b68c1bb6ac streams: Disable "All streams" tab for guest users.
Fixes #10980
2019-05-13 17:27:32 -07:00
Yashashvi Dave
2598db4a77 streams: Hide unsubscribed streams in settings to guest users. 2019-05-13 17:27:32 -07:00
Yashashvi Dave
80ceb1a46d components: Add disable_tab attribute. 2019-05-13 17:27:32 -07:00
Tim Abbott
ca48b4ec9f puppet: Set postgres max_connections to 1000.
There isn't much legitimate reason to have a limit as low as 100,
given how few resources a connection consumes.
2019-05-13 17:19:31 -07:00
Puneeth Chaganti
4ac9778d69 url preview: Catch network errors during get for page content.
We may be successfully able to get the page once, to get the content type, but
the server or network may go down and cause problems when fetching the page for
parsing its meta tags.
2019-05-13 13:55:00 -07:00
Puneeth Chaganti
9fd1c40bb1 url preview: Timeout requests after 15 seconds. 2019-05-13 13:54:59 -07:00
Puneeth Chaganti
0b76b16101 url preview: Set a custom user agent for requests.
Some sites seem to block the default user agent of the requests
library. Using a custom user agent lets us show previews for some of
these sites.
2019-05-13 13:54:43 -07:00
Puneeth Chaganti
59555ee7e5 url preview: Confirm content-type before trying to show previews.
Currently, we only show previews for URLs which are HTML pages, which could
contain other media. We don't show previews for links to non-HTML pages, like
pdf documents or audio/video files. To verify that the URL posted is an HTML
page, we verify the content-type of the page, either using server headers or by
sniffing the content.

Closes #8358
2019-05-13 13:45:17 -07:00
Tim Abbott
0f2d7a354f realm_filters: Allows more use of & and friends in URLs.
We had some excessively tight rules about what characters were
allowed, which in particular prevented using `?foo=bar&baz=quux`
structures in the realm filters URLs.

Fixes #12239.
2019-05-13 13:31:09 -07:00
Yashashvi Dave
6f6e87f45d models: Rename 'Jitsi' to 'Jitsi Meet' in Realm model.
Fixes #12293
2019-05-13 12:08:04 -07:00
Yashashvi Dave
3efead6f5f /json/realm: Return error on not-avaliable video chat provider value.
This adds some missing error handling from the video chat provider
code path.
2019-05-13 12:07:44 -07:00
Yashashvi Dave
cb85ca8601 models: Alter video_chat_provider field type to integer.
Migration rewritten by tabbott because it did not work.
2019-05-13 12:02:28 -07:00
Yashashvi Dave
d7f9b7eea3 models: Add dict for video chat providers in Realm model. 2019-05-13 11:34:34 -07:00
Yashashvi Dave
bbff797a93 zerver/tests/test_realm: Fix not-avaliable video-chat-provider value. 2019-05-13 11:34:34 -07:00
Tim Abbott
243db9a22f css: Fix width calculations for fluid width.
Apparently, while b38ae6e0ed was correct
for the default Zulip UI, it was not correct for the fluid width case,
where we did actually want to override the 1400px width rule for the
non-fixed `.app-main` element.

The right fix here is to add an additional CSS rule tweak to our
scrollbar logic.  This has been carefully tested with both initial
setting states as well as toggling the state.
2019-05-13 11:27:00 -07:00
Tim Abbott
45305c93ae auth: Fix Apache SSO port number in confirmation links.
We had a report in the thread around
https://chat.zulip.org/#narrow/stream/31-production-help/topic/Apache-based.20SSO/near/741013
that confirmation links were taking the user to the /register form on
the Apache server, which of course doesn't work because the Apache
server architecture we have is intended to only serve a single
endpoint, /accounts/login/sso, and not any static assets (etc.).

This manifested as users getting a broke page with a bunch of JS
errors about missing static assets when trying to sign up for an
account.  The right fix is to ensure that we serve these confirmation
links (and maybe in the future, redirects) to the nginx server.
2019-05-13 11:14:41 -07:00
Puneeth Chaganti
5dee17dca0 bugdown: Show previews for manually created youtube playlists.
Youtube playlists can be created by manually listing video_ids, as follows:
https://youtube.com/watch_videos?video_ids=vid1,vid2,vid3. This commit adds
previews for URLs of this type, using the first video ID.
2019-05-12 22:24:42 -07:00
Puneeth Chaganti
a1f0713b2c bugdown: Show previews for youtube playlist URLs, if possible.
If a youtube playlist URL has a video-id, we show a preview for the URL.

Closes #8562
2019-05-12 22:24:42 -07:00
Puneeth Chaganti
4de261c2de bugdown: Don't show previews for youtube URLs without video ids.
`youtube.com/playlist?list=<list-id>` incorrectly matches the regex since the
change in 8afda1c1bb. The regex was modified to
match URLs of the form `youtu.be/<id>` and this playlist URL incorrectly matches
with the `<id>` set to `playlist`.

This commit avoids this match by verifying that the ID is not playlist.
2019-05-12 22:24:42 -07:00
Roman Godov
a50824e031 models: Rename Subscription.in_home_view field to is_muted.
This renames Subscription.in_home_view field to is_muted, for greater
clarity as to what it does just from seeing the setting name, without
having to look it up.

Also disabled an obsolete test_migrations test.

Fixes #10042.
2019-05-12 22:08:10 -07:00
Tim Abbott
5ec8f6e812 test_migrations: Disable migrations test.
Our migrations test suite only really works when no future migrations
conflict with it.
2019-05-12 22:06:17 -07:00
Mateusz Mandera
f71c1e6a0c email_mirror: Add test for process_message not finding valid recipient. 2019-05-12 18:55:47 -07:00
Mateusz Mandera
fb3fa7883b email_mirror: Clean up TestStreamEmailMessagesEmptyBody.
These tests have some code and comments that only used to apply when
these empty body scenarios used to raise the regular
ZulipEmailForwardError - now they raise ZulipEmailForwardUserError.
We adapt the tests to this fact and test by mocking logging.warning and
making sure it gets called with the intended warning message. This is
also needed to cover the ZulipEmailForwardUserError case with tests to
get to 100% coverage of email_mirror.py.
2019-05-12 18:55:24 -07:00
Mateusz Mandera
f892ef1d3f email_mirror: Add tests for messages with attachments. 2019-05-12 18:55:24 -07:00
Mateusz Mandera
ede0991ef5 email_mirror: Add tests for filter_footer. 2019-05-12 18:55:24 -07:00
Mateusz Mandera
30c588636b email_mirror: Add test for stream missed message emails. 2019-05-12 18:55:24 -07:00
Mateusz Mandera
c2e5661f69 email_mirror: Add test for redis_client.hmget returning None values.
We add a test for the case "if not all(val is not None for val in result):"
on result returned by redis_client.hmget in send_to_missed_message_address.
2019-05-12 18:55:24 -07:00
Mateusz Mandera
2e9dfc1739 email_mirror: Add test to cover empty body after footer stripping. 2019-05-12 18:55:24 -07:00
Tim Abbott
b38ae6e0ed scrollbar: Fix incorrect CSS selector.
In a838de63d8, we incorrectly changed
the selector for accessing .fixed-app .app-main to just be .app-main,
which resulted in it affecting parts of the site it should not have.

The end result was a significant layout regression of the floating
recipient bar at some widths.
2019-05-10 11:45:46 -07:00
Tim Abbott
349c6f972b scroll_bar: Calculate the scrollbar width only once.
We wouldn't do it often in any case, but this is a cleaner workflow in
case a future design has us call these size adjustment functions more
often.
2019-05-10 11:44:27 -07:00
Puneeth Chaganti
4383c819cf digest: Fix visibility toggling of digest notifications checkbox. 2019-05-10 09:08:02 -07:00
Puneeth Chaganti
28df5f83dd digest: Always render digest day options as js controls visibility. 2019-05-10 09:08:02 -07:00
Tim Abbott
b7d50190b7 process_fts_updates: Batch updates when catching up.
Previously, if process_fts_updates ended up very far behind
(e.g. 100,000s of messages), it was unable to recover without doing
some very expensive databsae operations to fetch and then delete the
list of message IDs needing updates.  This change fixes that issue by
doing the catch-up work in batches.
2019-05-09 22:44:07 -07:00
Puneeth Chaganti
62d9ad534c digest: Trigger additional query to make tests more deterministic.
A couple of tests asserted that the number of queries were within a range,
because they ran one additional query when they were run individually, as
compared to running all the tests in `TestDigestEmailMessages`. We now trigger
these additional queries within the tests, to make the tests deterministic and
assert that the number of queries is a number, instead of a range.
2019-05-09 15:10:05 -07:00
Puneeth Chaganti
ab2850c225 digest: Re-enable digest emails for soft deactivated users.
Digest emails were disabled for soft deactivated users, since UserMessage
objects are created for such users lazily when they return.

We now compute the message list for gathering hot conversations by looking at
all the messages sent to the streams where the user is subscribed, while they
were subscribed.

Fixes #6297
2019-05-09 15:10:05 -07:00
Puneeth Chaganti
6abed82fb9 digest: Use one hour cutoff to generate digest emails in test.
Otherwise, the test may flake on a slow/hosed machine, where simulating a
conversation takes longer than 1 sec.
2019-05-09 15:10:05 -07:00
Tim Abbott
abae98a901 css: Add detailed comment explaining our 1400px max-width.
The reference to this being overriding in scroll_bar.js and how it
causes flashes is valuable.
2019-05-09 14:07:27 -07:00
Tim Abbott
beb3059547 css: Remove long-dead "sticky" CSS rules.
The code that uses these rules was removed in
f1e90086f5.
2019-05-09 13:58:41 -07:00
Pragati Agrawal
a838de63d8 settings: Add option for fixed/fluid width.
This adds a new option for "fluid width" under `Display settings` section
of SETTINGS/DISPLAY SETTINGS tab.

Fixes: #11844.
2019-05-09 13:57:57 -07:00
Pragati Agrawal
389c56e88d settings_display: Refactor settings_display.
This commit refactors settings_display in order to make code more precise
and clear.
2019-05-09 13:49:43 -07:00
Eeshan Garg
49ac516b50 webhooks/pivotal: Use proper punctuation. 2019-05-09 13:05:49 -07:00
Eeshan Garg
550ea64b4d webhooks/trello: Use proper punctuation. 2019-05-09 13:05:49 -07:00
Eeshan Garg
b434cc7054 webhooks/taiga: Use proper punctuation and new style string formatting. 2019-05-09 13:05:49 -07:00
Eeshan Garg
eaf1c4d8b2 webhooks/teamcity: Improve punctuation and message formatting. 2019-05-09 13:05:49 -07:00
Eeshan Garg
6d62522ff0 webhooks/raygun: Improve punctuation and message formatting. 2019-05-09 13:05:49 -07:00
Eeshan Garg
44038fc431 webhooks/raygun: Raise exception for unsupported event types. 2019-05-09 13:05:49 -07:00
Eeshan Garg
5a1f70f6e8 webhooks/opsgenie: Improve punctuation and message formatting. 2019-05-09 13:05:49 -07:00
Eeshan Garg
120937a1f4 webhooks/mention: Use proper message formatting. 2019-05-09 13:05:49 -07:00
Eeshan Garg
1948924cdb webhooks/jira: Improve punctuation and message formatting. 2019-05-09 13:05:49 -07:00
Eeshan Garg
ef070ef019 webhooks/github: Improve punctuation. 2019-05-09 13:05:49 -07:00
Eeshan Garg
9516699c73 webhooks/front: Use proper punctuation and fix spelling errors. 2019-05-09 13:05:49 -07:00
Tim Abbott
71f84a3a8b docs: Link to Ksplice blog for more example posts.
This update is in response to feedback that we only had one example
post available.
2019-05-09 11:47:27 -07:00
Mateusz Mandera
40f5755546 email_mirror: Handle case of unspecified charset in Content-Type header.
If the text part of an email message didn't specify the charset in the
Content-Type header, the text content wouldn't be found. We fix this, by
assuming us-ascii charset in those cases, as specified by RFC6657:
https://tools.ietf.org/html/rfc6657
2019-05-09 09:57:40 -07:00
Tim Abbott
7c94d350d4 ci: Run test-backend with limited parallelism.
See the comment for details; this should fix timeouts we've been
seeing in CI.
2019-05-08 18:26:26 -07:00
Harshit Bansal
b553507412 subscriptions: Migrate notification setting defaults model.
This commit migrates the Subscription's notification fields from a
BooleanField to a NullBooleanField where a value of None means to
inherit the value from user's profile.

Also includes a migrations to set the corresponding settings to None
if they match the user profile's values. This migration helps us in
getting rid of the weird "Apply to all" widget that we offered on
subscription settings page.

The mobile apps can't handle None appearing as the stream-level
notification settings, so for backwards-compatibility we arrange to
only send True/False to the mobile apps by applying those defaults
server-side.  We introduce a notification_settings_null value within a
client_capabilities structure that newer versions of the mobile apps
can use to request the new model.

This mobile compatibility code is pretty effectively tested by the
existing test_events tests for the subscriptions subsystem.
2019-05-08 17:45:10 -07:00
Tim Abbott
8a2057e3cf test_events: Print out the state when it hasn't changed.
This is often a part of what one will want when debugging.
2019-05-08 17:43:21 -07:00
vinitS101
18a424be79 uploads: Remove unusable UI elements if file uploading is disabled.
If MAX_FILE_UPLOAD_SIZE is set to 0, then UI elements like the upload
icon in the compose and message edit UI and "Attachments" menu in
"/#settings" are not displayed.
A different error message is also displayed if a user tries to drag and
drop or paste a file into the compose message box.

Fixes #12152.
2019-05-08 17:10:07 -07:00
Wyatt Hoodes
ececf0a209 provision.py: Add a conditional to remove '.eslintcache'.
It was discovered that the '.eslintcache' file was causing eslint to
throw a TypeError after a recent update/addition to the dependencies.
It makes sense to remove this file as part of the provisioning process
to avoid such exceptions.
2019-05-08 17:06:17 -07:00
Rishi Gupta
c40eb524de org settings: Change a few references to Jitsi to Jitsi Meet.
Jitsi Meet is the correct name for the product we integrate with. There is
one other reference to Jitsi, but it's in the db and will require a
migration.
2019-05-08 15:10:21 -07:00
Tim Abbott
1d44fd724b audit log: Log which server admin deactivated a realm too. 2019-05-08 15:09:48 -07:00
Rishi Gupta
0218da64f1 support: Update success message for plan type change. 2019-05-08 15:09:48 -07:00
Rishi Gupta
42c37ef2ee support: Update wording of scrub realm button. 2019-05-08 15:09:48 -07:00
Rishi Gupta
98da11c558 support: Rename deactive to deactivated. 2019-05-08 15:09:48 -07:00
Rishi Gupta
d2b32749cc audit log: Log acting_user for do_deactivate_realm.
Currently there's no way to tell the difference between "a server admin
deactivated a realm due to it being spammy" vs "a realm admin deactivated
the realm".
2019-05-08 15:09:48 -07:00
Yashashvi Dave
46f45f35d2 stream_ui_updates: Add generic initialize_disable_btn_hint_popover func. 2019-05-08 15:09:16 -07:00
Yashashvi Dave
a259b29322 streams: Update description for stream-privacy-type.
Fixes #10524
2019-05-08 14:49:27 -07:00
Tim Abbott
ddd3a36536 soft deactivation: Remove useless conditional.
Due to my misreading the code and a sloppy search, I thought in
8218bf101c that
all_stream_subscription_logs didn't filter for streams.

While changing this, we'll switch to using `.modified_stream_id` for
potentially better performance.
2019-05-08 14:40:33 -07:00
Puneeth Chaganti
b016ab257e digest: Toggle display of digest weekday setting dynamically.
Hide or show the digest weekday setting, based on whether
`digest_emails_enabled` flag is turned on or off.
2019-05-08 14:39:12 -07:00
Puneeth Chaganti
55a4c5751d digest: Move digest weekday drop-down next to the enable checkbox. 2019-05-08 14:39:12 -07:00
Puneeth Chaganti
b82ae987ef digest: Enable server level setting for sending digest emails. 2019-05-08 14:39:12 -07:00
Puneeth Chaganti
d474a41c03 digest: Turn off digest_emails_enabled flag for realms by default. 2019-05-08 14:39:12 -07:00
Shubham Padia
dd28413c4a ldap: Do not modify self._LDAPUser.attrs in test_query_email_attr.
Fixes #12273.
When running the test_query_email_attr test in reverse, the test failed
because self._LDAPUser.attrs was being modified and it was being shared
with other tests.
2019-05-08 09:55:44 -07:00
Vishnu Ks
ce88df5069 tests: Patch maybe_update_first_visible_message_id properly.
Otherwise this will result in error when running
tests with --parallel=1 --reverse.
2019-05-08 09:55:03 -07:00
Yashashvi Dave
ce917ef3e6 css: Remove display-none class css entirely.
All the elements to which `display-none` class
is applied, are handled with `.show()`/`.hide()`
functions instead of `.addClass('display-none')`
and `.removeClass('display-none')`.
Therefore, we should use apply `display: none;`
to elements with `style` attribute.

This commits removes all usage of `display-none`.
2019-05-08 09:41:48 -07:00
Yashashvi Dave
02a1b2e26b server events: Add realm-time-sync event to update stream privacy.
Add event to update stream settings whenever stream privacy is changed
accordingly.

Fixes #9470
2019-05-07 17:33:59 -07:00
Yashashvi Dave
a68a06d94f static/js/stream_events: Modify function update_property.
This commits modifies function `update_property` to
update more one stream-sub-property in one event.
2019-05-07 17:33:59 -07:00
Yashashvi Dave
78bb9bf37a streams: Update subs-ui-element on change-stream-privacy. 2019-05-07 17:33:59 -07:00
Yashashvi Dave
fbf25942d0 streams: Extract change-stream-permissions functions. 2019-05-07 17:33:59 -07:00
Eeshan Garg
3af4b7d750 webhooks/freshdesk: Improve message formatting and punctuation. 2019-05-07 16:45:01 -07:00
Eeshan Garg
c4e4ceadb5 webhooks/git: Use proper punctuation for branch creation templates. 2019-05-07 16:45:01 -07:00
Eeshan Garg
f1228b3550 webhooks/bitbucket3: Use proper punctuation. 2019-05-07 16:45:01 -07:00
Eeshan Garg
ab8aae6d0c git_webhooks: Use proper punctuation for PR/issue messages. 2019-05-07 16:45:01 -07:00
Eeshan Garg
2d4b734415 webhooks/solano: Improve message formatting and punctuation.
This commit also removes the conditional for when a build status
does not have a corresponding emoji. In such a case, it is better
to have no emoji than displaying some boilerplate text about no
appropriate emoji being available.
2019-05-07 16:45:01 -07:00
Yashashvi Dave
ccd3b49555 streams: Disable sub-btn with explanation if user not allowed to subscribe. 2019-05-07 16:38:36 -07:00
Yashashvi Dave
9d21b61f99 streams: Disable sub-check-btn if user is not allowed to subscribe.
This commit disable the subscription checkmark button in stream list
view, if user is not allowed to subscribe to stream.
2019-05-07 16:33:01 -07:00
ruchit2801
d2e1f5edc2 left sidebar: Add option to toggle 'Display starred count'.
This adds option in popover of starred messages, to toggle displaying
counts of starred messages.

This is a follow-up to #11645.
2019-05-07 10:58:12 -07:00
Yashashvi Dave
f25012f025 custom profile field: Fix styling regression in admin settings.
The css of `display-none` class was override by
`.rendered_markdown tr` class's css.
This commit fix this regression by applying style
to html element instead of class.
2019-05-07 08:56:01 -07:00
Rishi Gupta
529d424bed docs: Add numbering to import section of export-and-import.md.
The numbers are in parens to avoid the markdown processor interpreting them
as numbers -- I couldn't get the automatic numbering to work out with the
paragraph breaks and so on, and this is probably good enough for now.
2019-05-06 22:16:17 -07:00
Anders Kaseorg
9efda71a4b get_realm: raise DoesNotExist instead of returning None.
This makes the implementation of `get_realm` consistent with its
declared return type of `Realm` rather than `Optional[Realm]`.

Fixes #12263.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-05-06 21:58:16 -07:00
Vaibhav
1f76374e32 message_list_view: Move edited position conditionals to JS.
This adds three bools to message_container object which calculate bools
where the "(EDITED)" label should appear:

* `edited_in_left_col` -- when label appears in left column.
* `edited_alongside_sender` -- when label appears alongside sender info.
* `edited_status_msg` -- when label appears for a "/me" message.

We use the new bools and remove the complicated if else statements
from the templates for the "(EDITED)" label.

This also allows us to add a unit test to verify the logic.
2019-05-06 21:37:54 -07:00
Vaibhav
58874a08e3 message_list_view: Rename _add_msg_timestring to _add_msg_edited_vars. 2019-05-06 21:35:05 -07:00
Vaibhav
860406d1ad message_list_view: Extract _get_msg_timestring method.
This method gets the timestring for the message container when the
message was last edited.
2019-05-06 21:34:54 -07:00
Vaibhav
d93f5b2977 single_msg_handlebars: Cleanup moving css rules in stylesheets.
Cleanup single message template moving CSS rules for box shadow
of a private message stream inside stylesheets. For any messagebox
inside of a `.private-message` element, the box shadow is set using
the class. In cases of normal streams, the box shadow is set using
inline style since we cannot have different classes for each color.

Changes made in drafts.scss are to keep the current style of not
having the left border. Setting style using classes, this rule had
to be overridden.
2019-05-06 21:28:46 -07:00
Alexandra Ciobica
0162b7645d portico: Update android screenshot and associated svg. 2019-05-06 21:11:30 -07:00
Vishnu Ks
27cfc02b21 support: Use CSS from app_components for buttons and input. 2019-05-06 20:12:48 -07:00
Vishnu Ks
6c58603eaf support: Add support for scrubbing realm. 2019-05-06 20:12:54 -07:00
Vishnu Ks
f6203f068b support: Add support for activating and deactivating realm. 2019-05-06 20:12:48 -07:00
Vishnu Ks
9c1e409ea3 support: Update discount label to include nonprofit discount %. 2019-05-06 17:47:07 -07:00
Puneeth Chaganti
735b6cb761 digest: Remove code to gather new users and unread pms. 2019-05-06 17:43:53 -07:00
Puneeth Chaganti
77e0154800 test_users: Add assertion that guests can't see all realm users.
This commit adds coverage for the `UserProfile.can_access_all_realm_members`
method outside of tests in `test_digest`.
2019-05-06 17:43:53 -07:00
Puneeth Chaganti
be762f9485 digest: Strip down the digest email removing a lot of fluff. 2019-05-06 17:43:52 -07:00
Puneeth Chaganti
7000834a2b digest: Display the text email also in the /digest view. 2019-05-06 17:43:40 -07:00
Yashashvi Dave
81bcdf2e94 streams: Fix minor false html element selection. 2019-05-06 17:30:33 -07:00
Yashashvi Dave
bfabb86f39 stream hash: Update hash before updating settings UI elements. 2019-05-06 17:30:33 -07:00
Yashashvi Dave
6ae6da5d22 stream_ui_updates: Move function update_add_subscriptions_elements. 2019-05-06 17:30:33 -07:00
Yashashvi Dave
71e561de76 stream_ui_updates: Extract update_subscribers_list function. 2019-05-06 17:30:33 -07:00
Yashashvi Dave
7d7cf3d786 stream_ui_updates: Extract update_subscribers_count function. 2019-05-06 17:30:33 -07:00
Yashashvi Dave
4cd33f23bc stream_ui_updates: Refactor update-stream-privacy-type function. 2019-05-06 17:30:33 -07:00
Yashashvi Dave
d86ee6b4f0 stream_ui_updates: Extract update_stream_privacy function. 2019-05-06 17:30:33 -07:00
David Wood
f53a8f8bb6 settings: Rename create_stream_permission in templates.
This commit renames the `create_stream_permission` field in the
templates to `create_stream_policy`, matching the field used in the
database model. This matches what `invite_to_stream_policy` does and
will be clearer when the `waiting_period_threshold` is split into its
own field.
2019-05-06 16:30:01 -07:00
David Wood
34d810aac3 settings: Migrate to create_stream_policy structure.
This commit replaces the `create_stream_by_admins_only` setting with a
new `create_stream_policy` setting, which mirroring the structure of
the existing `invite_to_stream_policy`.

This is important preparation for migrating the waiting period feature
to be its own independent setting.

Fixes #12236.
2019-05-06 16:27:55 -07:00
Tim Abbott
3ecdabdc77 soft_deactivation: Add temporary nocoverage to fix CI. 2019-05-06 16:14:31 -07:00
Tim Abbott
cf0fc7c221 test_link_embed: Fix unused variable.
This should have been in bc2ebd0f09.
2019-05-06 16:04:37 -07:00
Puneeth Chaganti
0884764421 url preview: Add python-magic dependency for content-type sniffing. 2019-05-06 12:37:32 -07:00
Puneeth Chaganti
bc2ebd0f09 url preview: Refactor test code to create mock responses. 2019-05-06 12:37:32 -07:00
Puneeth Chaganti
da33b72848 url preview: Use in-memory caching in dev environment. 2019-05-06 12:37:32 -07:00
Puneeth Chaganti
1f6306a5a7 url preview: Cleanup import ordering. 2019-05-06 12:37:32 -07:00
Puneeth Chaganti
d56b16b275 url preview: Ignore open graph tags without a content attribute. 2019-05-06 12:37:32 -07:00
Puneeth Chaganti
d02eb99831 url preview: Return generic parser <p> text as str (not bs4 string). 2019-05-06 12:37:32 -07:00
Wyatt Hoodes
2b3de816a8 test_classes.py: Add activation to default language.
Running the backend tests with a high number of processes can cause
unexpected errors with language changes.  When certain tests that change
the default language, (without explicitly overriding the teardown method
to reset the default language), interleave with other tests that are
expecting the language to be in English, discrepancies arise.

This fixes a common nondeterministic test failure with high levels of
parallelization.
2019-05-06 11:16:08 -07:00
Tim Abbott
1af4f8fe20 soft_deactivation: Add some explanatory comments.
This function still doesn't make sense in the way I'd like it to, but
this at least records what algorithm we're trying to implement.
2019-05-05 18:33:15 -07:00
Tim Abbott
eb97e9fae0 soft_deactivation: Fix buggy handling of race condition.
If a soft deactivated user had a subscription double-toggled without
any new messages being sent in between, add_missing_messages might
incorrectly process those two subscription changes in the wrong order.

Fortunately, the failure mode was usually to throw this exception:

django.db.utils.IntegrityError: duplicate key value violates unique
constraint "zerver_usermessage_user_profile_id_message_id_4936d0df_uniq"
DETAIL:  Key (user_profile_id, message_id)=(4, 57) already exists.

Our unit tests actually had this precise setup some fraction of the
time, because a bit of the test setup code subscribed+unsubscribed the
target user without sending any messages in between, resulting in a
test failure something like 50% of the time.

The original exception was hard to reproduce reliably originally
(resulting in an extremely annoying nondetermnistic test failure), but
is easily reproducible by changing the "id" to "-id" in this change to
always mis-order the processing of those RealmAuditLog events.
2019-05-05 18:29:20 -07:00
Tim Abbott
8218bf101c soft_deactivation: Fix buggy handling of other streams.
Previously, our soft-deactivation logic incorrectly did not filter the
set of stream subscription changes to look at to only include the
target stream.

This could result in unspecified buggy behavior.
2019-05-05 18:29:20 -07:00
Tim Abbott
8e995deab5 soft_deactivation: Make the stream_messages mutation logic clearer.
This changes our code from something that's pretty nasty bad behavior
mutating objects during a loop to only somewhat bad behavior.
2019-05-05 18:29:20 -07:00
Tim Abbott
a1d2b73790 soft_deactivation: Clarify loop logic around stream_messages.
Break will do the same thing as continue here, as each iteration will
have the same result, and it's also worth explaining why this isn't
one layer up in the loop setup.
2019-05-05 18:29:20 -07:00
Mayank Madan
99414e2d96 provision: Add support for Debian 10 Buster. 2019-05-05 17:57:19 -07:00
Mayank Madan
aae01f5795 dependencies: Install line_profiler from our fork.
This is required for Python 3.7 support; line_profiler needs a release
with Cython rerun following the Python 3.7 release, and this achieves
that goal.
2019-05-05 17:53:00 -07:00
Mayank Madan
a86eccb2b6 pgroonga: Upgrade from 2.1.6 to 2.1.8.
This is necessary to support postgres 11 in Debian Buster.
2019-05-05 17:52:32 -07:00
Puneeth Chaganti
dc1571426e open graph: Use the complete URL for open graph URLs.
Closes #12199
2019-05-05 17:51:53 -07:00
Raymond Akornor
e01d3be1ba tools: Remove check-urls linter.
This commit removes `tools/check-urls`. It was added as
a useful tool in preparation for the Django 1.10 migration.
Since we completed that migration, it is no longer needed.

Fixes #12180.
2019-05-05 17:47:41 -07:00
Anders Kaseorg
bc9d7141b2 mypy: Enable strict_optional for test_outgoing_webhook_interfaces.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-05-04 23:15:58 -07:00
Vishnu Ks
176d37a513 tests: Make tests work in reverse order in mattermost_importer. 2019-05-04 08:49:34 -07:00
vinitS101
81b5a72252 admin_settings: Change maxfilesize to max_file_upload_size.
Renamed maxfilesize to max_file_upload_size for consistency.
Related to #12152.
2019-05-03 17:36:09 -07:00
vinitS101
3cb502974e compose: Change file upload error message to show correct file size.
The error message, that is displayed when a user tries to upload a file
larger than the allowed size, currently displays a hardcoded max file
size of 25MB.
Changed this to show the correct max_file_upload_size value that has
been set by the server admin.
2019-05-03 17:36:09 -07:00
Kouhei Sutou
a046a0957b docs: Fix upgrade process for Ubuntu 16.04 -> 18.04.
We need to disable "CREATE EXTENSION pgroonga" in zulip-puppet-apply
by creating /usr/share/postgresql/10/pgroonga_setup.sql.applied.
Because PostgreSQL 10 isn't running in this case. If PostgreSQL 10
isn't running, we can't run "CREATE EXTENSION pgroonga".

We can't use pg_upgrade with PGroonga. PGroonga's install SQL
https://github.com/pgroonga/pgroonga/blob/master/data/pgroonga.sql has
conditions to support multiple PostgreSQL versions. So it's not safe
to use pg_upgrade. pg_upgrade copies metadata for PostgreSQL 9.5 to
PostgreSQL 10. We need to use pg_dump and pg_restore to upgrade
PGroonga correctly for PostgreSQL 10.
2019-05-03 17:35:32 -07:00
Kouhei Sutou
407ed45ec2 docs: Use systemctl instead of service.
Because memcached package on Ubuntu 18.04 supports systemd.
2019-05-03 17:33:29 -07:00
David Wood
16e9892ab2 webhooks/jira: Include issue title in messages. 2019-05-03 20:03:31 -02:30
Vishnu Ks
123bcea518 management: Don't use sys.exit(1).
Using sys.exit in a management command makes it impossible
to unit test the code in question.  The correct approach to do the same
thing in Django management commands is to raise CommandError.

Followup of b570c0dafa
2019-05-03 14:20:39 -07:00
Tim Abbott
687f1bcdaf test_classes: Fix missing flushing of per-request caches.
We should definitely be starting each test case with an empty copy of
the per-request caches, since their intended duration is even shorter
than a request.

This was masked by the fact that these caches are automatically
flushed when one makes an actual request to the Zulip API; so the
problems were only manifesting in tests like test_events, where we
call lower-level functions that access a per-request cache without
using the Zulip API.
2019-05-03 13:52:56 -07:00
Tim Abbott
5cddf07361 test_mattermost_importer: Fix buggy use of wrong paths.
This worked for me when testing locally because it was using a
constant path, and so was accessing the product under `var/` of the
previous test run.
2019-05-03 13:30:54 -07:00
Tim Abbott
0adb93db32 test_classes: Fix data import path reuse parallelism errors.
The make_import_output_dir helper function used a path determined
primarily by the filename of the fixture being used, and expected to
have complete control over that path for the duration of the test.

This resulted in nondeterministic errors if our two test classes that
ran Mattermost import code ran at the same time.
2019-05-03 13:23:09 -07:00
Shubham Padia
884c19c3bc settings: NAME_CHANGES_DISABLED disables the name change button.
Fixes #12251.

Previously when disabling name changes in server settings, instead
of realm settings, the name edit button did not get disabled.
Changing name resulted in a message stating `no changes made`.
2019-05-03 12:58:51 -07:00
Shubham Padia
8c01f396db settings: Add AVATAR_CHANGES_DISABLED server setting.
Fixes #12132.
Realm setting to disable avatar changes is already present.
The `AVATAR_CHANGES_DISABLED` setting now follows the same
2-setting model as `NAME_CHANGES_DISABLED`.
2019-05-03 12:58:51 -07:00
Shubham Padia
4994a6c2c9 realm: Add setting to disable avatar changes.
This is useful when syncing avatars from an integrated LDAP/active
directory.

The upload avatar and delete avatar buttons are hidden if avatar
changes are disabled and the user is a non-admin.
If the user has a gravatar set, then the user will not be able to
upload an image as their avatar if avatar changes are disabled.

Part of #12132.
2019-05-03 12:52:43 -07:00
Mateusz Mandera
63c170c390 circleci: Fix redis on Bionic.
Fixes #11079.
Because of "service redis-server start" not working properly, in "do
Bionic hack" another instance of the server was being started. However,
once in a while this would fail for unknown reasons causing flakes in
tests involving redis. The cause of the service not starting was the
error:
::1:6379: bind: Cannot assign requested address
(see https://github.com/antirez/redis/issues/3241)
This is fixed by editing /etc/redis/redis.conf to not attempt binding
on IPv6. We change "do Bionic hack" to a simple sed command,
changing the appropriate line in the file.
By default, the line is "bind 127.0.0.1 ::1".
We change it to "bind 0.0.0.0".
2019-05-03 11:33:39 -07:00
Tim Abbott
b570c0dafa convert_mattermost_data: Don't sys.exit(1).
This behavior ends up being quite problematic for running unit tests;
the thing one is supposed to do in management commands is raise
CommandError.
2019-05-02 11:13:41 -07:00
Wyatt Hoodes
21c67ea1c2 test-backend: Change --parallel default to use cpu_count.
The number of processes to run the backend tests is currently a
hardcoded value, this commit transistions the default to be based on the
number of logical CPUs available.
2019-05-02 10:48:20 -07:00
neiljp (Neil Pilgrim)
4ea5fea8a1 mypy: Fully check actions.py by removing mypy.ini special case. 2019-05-01 17:52:37 -07:00
neiljp (Neil Pilgrim)
7bbc620b28 mypy: Require topics to be non-None in Addressee. 2019-05-01 17:52:37 -07:00
Puneeth Chaganti
bfc3e3c0c7 html_to_text: Add delimiters between text from different elements.
This module is used to render the HTML of pages like our user documentation 
into text for use in open graph previews of those articles.  It provided somewhat
confusing output in the case that there were paragraph breaks in the original message,
because text with multiple paragraphs and list items does't read very well. This commit
adds `|` as a delimiter between paragraphs, and prefixes list items with a `*`.

Closes #12228
2019-05-01 17:35:20 -07:00
Yashashvi Dave
22f172114d subscription: Update existing sub-row in settings on sub events.
Update stream-subscription-row in stream settings, when
subsctiption add/removal event is received. This is only
to show dynamic effects to user on sub events.
2019-05-01 17:23:44 -07:00
Yashashvi Dave
a593f73e9a static/js/subs.js: Extract update_stream_row_in_settings_tab function. 2019-05-01 17:23:44 -07:00
Yashashvi Dave
ed2dd612fb static/js/subs.js: Extract is_subscribed_stream_tab_active function. 2019-05-01 17:23:44 -07:00
okay
1694831029 bugdown: Fix double processed emoji tags inside inline tags.
When an emoji is nested inside another inline tag - like em or strong -
it was getting double processed because of the way the inlinePattern
TreeProcessor runs (it runs recursively). With this fix, we set the
inner text of the emoji span as an AtomicString, preventing us from
double processing the emoji's text.

Fixes #11621

Test Plan:

* Add test case for **😄**, verify it passes.
* Go into local dev server and send "**😄**" to self and verify the DOM
does not have double <span> tags for the emoji.
* Run zerver.tests.test_push_notifications and verify the markdown test case matches
the text_content field properly
2019-05-01 17:03:15 -07:00
Alexandra Ciobica
8aa982f7ba user status: Add "clear message (x)" button for status message input.
This adds the same "x" button as we have in "stream search" or "people
search" to the user status modal.

The button is shown if someone types something, or if the status
message was already set (meaning there was already a value in the
input field). If the input field is empty, the button is not visible.

This fixes the follow-up comments from #12179.
2019-05-01 16:36:45 -07:00
Alexandra Ciobica
61758735f3 user status: Clean up code for user status options.
- Changed the <p>s to <button>s and modified the css accordingly.
- Changed the css to use scss nesting.
- Changed the line-height from 1.0em to 1.1em, because on Safari the "g" was not fully displayed.
2019-05-01 16:34:54 -07:00
Eeshan Garg
28109e0f9e webhooks/jira: Ignore comment_created message.
comment_created payloads may not contain the required issue data
to format a useful notification, therefore, it is better to handle
issue comments through issue_updated events (which we already do).

Fixes: #11995.
2019-05-01 16:32:58 -07:00
Mateusz Mandera
c1ceba9037 rate_limiter: Move email_mirror limiter to use rate_limit_entity.
We change the rate limiting code in the email mirror to use the new,
general rate_limit_entity function.
2019-05-01 12:54:32 -07:00
Mateusz Mandera
40763070b7 rate_limiter: Generalise some rate_limit_user code.
We create rate_limit_entity as a general rate-limiting function for
RateLimitedObjects, from code that was possible to abstract away from
rate_limit_user and that will be used for other kinds of rate limiting.
We make rate_limit_user use this new general framework from now.
2019-05-01 12:54:32 -07:00
neiljp (Neil Pilgrim)
827c016b98 mypy: Enable strict-optional for messages.py.
This also fixes an issue where we were setting num_after to None,
which should have been 0, to disable fetching messages after the
anchor.
2019-05-01 11:24:47 -07:00
neiljp (Neil Pilgrim)
47de637c3d mirrors: Refactor create_mirrored_message_users to use new Exception.
This enables the function to either return a valid UserProfile or raise
InvalidMirrorInput, which is clearer and more pythonic than the previous
approach of a tuple of a bool and Optional[UserProfile].

In making the type clearer, this improves checking with mypy.

Tests updated.
2019-05-01 11:18:22 -07:00
neiljp (Neil Pilgrim)
3d43682f1b mypy: Enable strict-optional for auth.py. 2019-05-01 10:49:25 -07:00
neiljp (Neil Pilgrim)
f3ef2a186c mypy: Enable strict-optional for calculate_first_visible_message_id. 2019-05-01 10:49:24 -07:00
Tim Abbott
edb956091f export: Add a blank line in S3 upload output.
This should be more readable.
2019-04-30 16:37:23 -07:00
Shubham Padia
27ff71c96f settings: Don't check mobile notifications if they are disabled.
Fixes #12198.
2019-04-30 14:56:26 -07:00
Vishnu Ks
ed81906fc9 docs: Direct GSoD students to #documentation instead of #GSoC. 2019-04-30 14:52:53 -07:00
Yashashvi Dave
7a168216ff stream_ui_updates: Extract update_change_stream_privacy_settings. 2019-04-30 14:37:30 -07:00
Yashashvi Dave
ecc165b899 stream_ui_updates: Extract update_regular_sub_settings. 2019-04-30 14:37:24 -07:00
Yashashvi Dave
a71eb6aa15 subs: Extract change-stream-privacy block from function.
This commit removes code to update-stream-privacy-btn
in stream settings from update-sub-settings function.
Because stream-privacy-btn is not part of regular
sub-settings, it is admins only settings.
2019-04-30 14:36:52 -07:00
Yashashvi Dave
9dd9ea5721 stream settings: Update URL when opening empty settings panel. 2019-04-30 14:36:52 -07:00
Yashashvi Dave
460515a2ee stream settings: Extract setup_subscriptions_tab_hash function. 2019-04-30 14:36:52 -07:00
Yashashvi Dave
ec5ef08a19 subs: Fix URL not updating as per UI on stream unsubscription.
When user unsubscribe from stream by clicking on
subscription-checkmark, the URL changes to unsubscribed
stream but stream settings UI is not updated.
We should change URL and stream settings modal
simultaneously. This PR moves update-hash function
inside open-stream-modal function, which make sure that
URL is getting updated everytime open-stream-modal
function is called and not otherwise.
2019-04-30 14:37:19 -07:00
Yashashvi Dave
2d1b80e2b4 stream_ui_updates: Extract update_settings_button_for_sub. 2019-04-30 14:37:14 -07:00
Yashashvi Dave
859ba9e892 stream_ui_updates: Extract update_check_button_for_sub func. 2019-04-30 14:37:05 -07:00
Yashashvi Dave
3649a9f15c subs: Add stream_ui_updates.js module for managing ui elements.
This commit adds `stream_ui_updates.js` module. This module
will includes functions which will update different ui elements
(i.e. subscription button, subscriber count).
2019-04-30 14:36:52 -07:00
Tim Abbott
98a1e340ad filters: Don't include realm_counts/installation_counts in errors.
This avoids unnecessarily long error emails for these.
2019-04-30 14:10:59 -07:00
David Wood
272ed90685 settings: Create an explicit invite_to_stream_policy setting.
This commit creates a new organization setting that determines whether
a user can invite other users to streams. Previously this was linked
to the waiting period threshold, but this was both not documented and
overly limiting.

With significant tweaks by tabbott to change the database model to not
involve two threshhold fields, edit the tests, etc.

This requires follow-up work to make the create stream policy setting
work how this code implies it should.

Fixes #12042.
2019-04-29 17:11:28 -07:00
Vishnu Ks
89ada6c770 tests: Remove unecessary word from convert_data test name. 2019-04-29 11:23:17 -07:00
Vishnu Ks
ecdd3bea43 billing: Add cron job to run invoice_plans once a day.
Fixes #11960
2019-04-29 11:23:17 -07:00
vinitS101
f46b5a8ba1 message view: Decreased top margin of messages with sender info.
Decreased the top margin of first line of messages to align better with
the profile picture of the user.
2019-04-29 10:12:58 -07:00
Puneeth Chaganti
0987ef8809 Merge pull request #12221 from punchagan/safari-upload-fix
Fixes couple of problems with image pastes on Safari
2019-04-28 22:51:17 -07:00
Puneeth Chaganti
f3f172991b open graph: Use uploaded realm icon for open graph images. 2019-04-28 22:50:27 -07:00
Tim Abbott
9e8cfbea3b test_email_notifications: Fix a nondeterministic test.
This test made the assumption that the two emails would be ordered in
a query without a ordering.
2019-04-28 22:00:03 -07:00
Tim Abbott
9ece4c9f51 docs: Add documentation for the delete and reimport process.
This is a common thing folks ask how to do.
2019-04-28 21:49:13 -07:00
Anders Kaseorg
d4b060a520 dependencies: Upgrade simplebar to 4.0.0-alpha.6.
Fixes #12038.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-04-28 21:32:55 -07:00
Vishnu Ks
b4a54483ed Revert "requirements: Upgrade moto from 1.3.7 to 1.3.8."
This reverts commit 4ee65b70b4.
2019-04-28 21:18:01 -07:00
Puneeth Chaganti
a98341c79f digest: Add an organisation setting to choose the digest weekday.
Closes #549.
2019-04-28 18:40:07 -07:00
Puneeth Chaganti
f3d0ccb9f6 models: Add a digest_weekday field to the Realm model.
Allow realms to specify the day of the week when the digest should be sent out.
When enqueue-ing digests, pick only the realms that chose the current weekday as
the day to send out digests.
2019-04-27 15:20:41 -07:00
Puneeth Chaganti
b0f485e95f org settings: Allow admins to enable or disable digest emails. 2019-04-27 15:20:41 -07:00
Puneeth Chaganti
aca63f0fbe notifications: Hide digest emails user setting if globally disabled. 2019-04-27 15:20:41 -07:00
Mayank Madan
4c81474a4f webhooks: Add Buildbot integration.
With some minor changes by Eeshan Garg.

Fixes: #5639.
2019-04-27 15:19:16 -07:00
Eeshan Garg
a73e8109b7 webhooks: Remove the legacy GitHub integration.
The github-services model for how GitHub would send requests to this
legacy integration is no longer available since earlier in 2019.
Removing this integration also allows us to finally remove
authenticated_api_view, the legacy authentication model from 2013 that
had been used for this integration (and other features long since
upgraded).

A few functions that were used by the Beanstalk webhook are moved into
that webhook's implementation directly.
2019-04-27 15:13:44 -07:00
Wyatt Hoodes
820dd3a946 settings: Fix broken headers in night mode.
This bug turned out to pop up wherever a table existed in both
'settings' and 'organization settings', notably *excluding* both
'Custom Emoji' and 'Authentication Methods'.

The first thought to the solution was to simply add `thead` to the css
rule that applies the appropiate color for headers and the like.  This
was successful, however it brought attention to a sub-problem:

`emoji-settings-admin` and `auth-mehtod-settings-admin` were both
creating table headers in the body of the table. This was causing the
rows in these two tables to be colored inversely from all the others.
This is also the reason why these tables are the only ones correctly
styled. These handlebars were updated with the headers moved out of the
body.

The even and odd rows of the tables were then colored appropriately.

Fixes: #12209
2019-04-27 15:03:57 -07:00
Tim Abbott
7da28600c7 settings_org: Fix linter error with ==.
Apparently this was fixed in a later commit.
2019-04-26 22:48:03 -07:00
Pragati Agrawal
f9681c1f51 org settings: Remove redundant loading indicator from auth methods table.
Number of auth methods isn't much, so no need to have loading indicator
here.
2019-04-26 17:57:04 -07:00
Pragati Agrawal
d0ba0c7409 org settings: Add generalised function for tip-box for org settings.
This commit adds a `insert_tip_box` function and thus adds a
`organization-settings-tip` handlebars file to add a genaralised tip for
all organization settings pages. This further removes the code for tipbox
which was added in `populate_auth_methods` functions, as it wasn't making
sense there, making it more clear and readable.
2019-04-26 17:54:58 -07:00
Pragati Agrawal
2277ee0c90 org settings: Move disable attribute to admin_auth_methods_list.
This commits disables the auth-methods table using the disabled attribute
in admin_auth_methods_list handlebars instead of doing that in
settings_org.
2019-04-26 17:52:19 -07:00
Pragati Agrawal
75fc19acfd org_settings: Refactor get_subsection_property_elements function.
This commit adds a class prop-element for all the property elements, so
that later on we can directly use this to access elements.

In `get_subsection_property_elements`, we were finding these elements using
a makeshift method, where we were finding all these elements by mentioning
all input elements, textarea, select elements, which is not a desirable
method.
So now, here in `get_subsection_property_elements` function, we are finding
these properties using the newly added class `prop-element` which makes
code more clear and readable.
2019-04-26 17:52:19 -07:00
Pragati Agrawal
3dd5e1642b org_settings: Fix data collection of message retention property.
In handlebars and settings_org.js, the subsection in which
`realm_message_retention_days` property lies doesn't agree, and this wasn't
observed for a long time as it's disabled, still to make things right, in
this commit we have moved the logic which handles the collection of data
from `other_permission` to `other_settings` as it makes more sense there.
2019-04-26 17:41:01 -07:00
Pragati Agrawal
ed30f71e07 org_settings: Remove redundant success_continuation variable.
This removes all the instances of `success_continuation` from settings_org
and accordingly refactors some code.
2019-04-26 17:41:01 -07:00
Wyatt Hoodes
d4715f23d7 public_export: Add backend API endpoint for triggering export.
An endpoint was created in zerver/views.  Basic rate-limiting was
implemented using RealmAuditLog.  The idea here is to simply log each
export event as a realm_exported event.  The number of events
occurring in the time delta is checked to ensure that the weekly
limit is not exceeded.

The event is published to the 'deferred_work' queue processor to
prevent the export process from being killed after 60s.

Upon completion of the export the realm admin(s) are notified.
2019-04-26 17:24:29 -07:00
Tim Abbott
8b5d2e9631 export: Return the S3 URL we uploaded data to.
This will make it possible to access that URL from the caller for the
data export tool.
2019-04-26 17:22:02 -07:00
Vishnu Ks
07291227d5 version: Bump PROVISION_VERSION for py packages upgrade. 2019-04-26 16:22:00 -07:00
Vishnu Ks
8d2a3e58d7 requirements: Upgrade moto from 1.3.7 to 1.3.8. 2019-04-26 16:22:00 -07:00
Vishnu Ks
c99b82bae8 requirements: Upgrade setuptools from 40.8.0 to 41.0.1. 2019-04-26 16:22:00 -07:00
Vishnu Ks
07ca80a7e6 requirements: Upgrade pip from 19.0.3 to 19.1. 2019-04-26 16:22:00 -07:00
Vishnu Ks
43bc029f68 requirements: Upgrade twilio from 6.26.1 to 6.26.2. 2019-04-26 16:22:00 -07:00
Vishnu Ks
c09962bd7b requirements: Upgrade stripe from 2.26.0 to 2.27.0. 2019-04-26 16:22:00 -07:00
Vishnu Ks
b8d74ad594 requirements: Upgrade gitlint from 0.10.0 to 0.11.0. 2019-04-26 16:22:00 -07:00
Vishnu Ks
3ccd8ef26d requirements: Upgrade coverage from 4.5.2 to 4.5.3. 2019-04-26 16:22:00 -07:00
Vishnu Ks
f9f823066e requirements: Upgrade pyasn1-modules from 0.2.4 to 0.2.5. 2019-04-26 16:22:00 -07:00
Vishnu Ks
a956854df3 requirements: Upgrade indirect dependencies in thumbor.txt. 2019-04-26 16:22:00 -07:00
Vishnu Ks
4c48ff3822 requirements: Upgrade indirect dependencies in docs.txt. 2019-04-26 16:22:00 -07:00
Vishnu Ks
df47b6010e requirements: Upgrade Twisted from 18.9.0 to 19.2.0. 2019-04-26 16:22:00 -07:00
Vishnu Ks
5423188e07 requirements: Upgrade isort from 4.3.11 to 4.3.17. 2019-04-26 16:22:00 -07:00
Vishnu Ks
0e12626763 requirements: Upgrade snakeviz from 1.0.0 to 2.0.0. 2019-04-26 16:22:00 -07:00
Vishnu Ks
7e2e7ca0e5 requirements: Upgrade virtualenv-clone from 0.5.1 to 0.5.3. 2019-04-26 16:22:00 -07:00
Vishnu Ks
5970f0f277 requirements: Upgrade twilio from 6.25.0 to 6.26.1. 2019-04-26 16:22:00 -07:00
Vishnu Ks
697b4b22c2 requirements: Upgrade stripe from 2.21.0 to 2.26.0. 2019-04-26 16:22:00 -07:00
Vishnu Ks
45e6f07f63 requirements: Upgrade SQLAlchemy from 1.3.0 to 1.3.3. 2019-04-26 16:22:00 -07:00
Vishnu Ks
54ad03775e requirements: Upgrade pytz from 2018.9 to 2019.1. 2019-04-26 16:22:00 -07:00
Vishnu Ks
a34cfd4782 requirements: Upgrade psycopg2 from 2.7.7 to 2.8.2. 2019-04-26 16:22:00 -07:00
Vishnu Ks
eb00e78856 requirements: Upgrade premailer from 3.3.0 to 3.4.0. 2019-04-26 16:22:00 -07:00
Vishnu Ks
20cd564f27 requirements: Add Pillow to unupgradable.json. 2019-04-26 16:22:00 -07:00
Vishnu Ks
f0bcb061a6 requirements: Add Markdown to unupgradable.json. 2019-04-26 16:22:00 -07:00
Vishnu Ks
4158251b0b requirements: Upgrade lxml from 4.3.2 to 4.3.3. 2019-04-26 16:22:00 -07:00
Vishnu Ks
c33437d473 requirements: Upgrade Jinja2 from 2.10 to 2.10.1. 2019-04-26 16:22:00 -07:00
Vishnu Ks
9d022eb127 requirements: Upgrade httplib2 from 0.12.1 to 0.12.3. 2019-04-26 16:22:00 -07:00
Vishnu Ks
57c762d6c4 requirements: Upgrade disposable-email-domains from 0.0.46 to 0.0.49. 2019-04-26 16:22:00 -07:00
Vishnu Ks
cc7ac7241d requirements: Add defusedxml to unupgradable.json. 2019-04-26 16:22:00 -07:00
Vishnu Ks
2c5510b34a requirements: Upgrade cffi from 1.12.2 to 1.12.3. 2019-04-26 16:22:00 -07:00
Vishnu Ks
3177e981fd requirements: Upgrade certifi from 2018.11.29 to 2019.3.9. 2019-04-26 16:22:00 -07:00
Vishnu Ks
ab63f2b524 requirements: Upgrade indirect dependencies in dev.txt, prod.txt. 2019-04-26 16:22:00 -07:00
Vishnu Ks
16394e53a3 tools: Make dependency upgrader upgrade indirect dependencies separately. 2019-04-26 16:22:00 -07:00
Rishi Gupta
14428f7996 docs: Clarify you need to upgrade from git for Zulip Cloud exports. 2019-04-26 15:59:24 -07:00
Hemanth V. Alluri
34db469700 org_settings: Fix error with undefined profile_field in bot settings.
This is a small patch to fix the error message an admin would receive if
they tried to change bot info and owner from the "bots" setting of the
organization settings panel.
2019-04-25 15:56:44 -07:00
Hemanth V. Alluri
c192327a37 settings_account: Fix small typo in initialize_custom_user_type_fields. 2019-04-25 15:56:44 -07:00
Tim Abbott
c1d8b17e49 docs: Stop mentioning legacy Android app in gsoc ideas. 2019-04-25 15:40:09 -07:00
Rishi Gupta
6e2adc6a7b docs: Update gsod-ideas.md. 2019-04-25 15:38:52 -07:00
Puneeth Chaganti
dabe267d00 html_to_text: Add arg to specify html tags for generating text.
Closes #11497
2019-04-25 15:29:16 -07:00
Puneeth Chaganti
2d9c5b3575 open graph: Display realm description as open graph description. 2019-04-25 15:29:16 -07:00
Puneeth Chaganti
a653fcca93 html_to_text: Escape text when using as description. 2019-04-25 15:29:16 -07:00
Puneeth Chaganti
009beabe53 test_middleware: Use test helper in nonexistent page open graph test. 2019-04-25 15:29:16 -07:00
Puneeth Chaganti
41ff94bdba test_middleware: Parse html in tests instead of using regex.
This slows down the tests by about 5-10% -- the tests go from 0.6s to 0.630s or
so. But, this seems like a change worth making to prevent open-graph metadata
breaking HTML.
2019-04-25 15:29:16 -07:00
Puneeth Chaganti
7d7134d45d html_to_text: Extract code for html to plain text conversion. 2019-04-25 15:29:16 -07:00
Tim Abbott
cc421d4415 tests: Fix bad use of mock local variable name.
This ended up masking the mock module.
2019-04-25 15:28:10 -07:00
sameerchoubey
048ec39824 tools/test-api: Test Client.update_stream. 2019-04-25 16:24:59 -02:30
sameerchoubey
6790c22d8d tools/test-api: Test Client.update_presence. 2019-04-25 16:24:59 -02:30
sameerchoubey
598727f696 tools/test-api: Test Client.update_notification_settings. 2019-04-25 16:24:59 -02:30
sameerchoubey
cedce30d99 tools/test-api: Test Client.update_user_group_members. 2019-04-25 16:24:59 -02:30
sameerchoubey
3140aabbd7 tools/test-api: Test Client.remove_user_group. 2019-04-25 16:24:59 -02:30
sameerchoubey
49e843cd75 tools/test-api: Test Client.update_user_group. 2019-04-25 16:24:59 -02:30
sameerchoubey
2c675efbba tools/test-api: Test Client.create_user_group. 2019-04-25 16:24:59 -02:30
sameerchoubey
53b58d0c7f tools/test-api: Test Client.remove_alert_words. 2019-04-25 16:24:59 -02:30
sameerchoubey
c5c2c13880 tools/test-api: Test Client.add_alert_words. 2019-04-25 16:24:59 -02:30
sameerchoubey
b26b4ce60c tools/test-api: Test Client.get_alert_words. 2019-04-25 16:24:59 -02:30
sameerchoubey
2d9b54f0d5 tools/test-api: Test Client.delete_stream. 2019-04-25 16:24:59 -02:30
sameerchoubey
56ad6758f6 tools/test-api: Test Client.remove_reaction. 2019-04-25 16:24:59 -02:30
Vit Rozkovec
a16da1f98c emails: Add alt tags to images. 2019-04-24 17:49:56 -07:00
Tim Abbott
bf9f08a3e6 version: Update version and changelog for Zulip 2.0.3 release. 2019-04-23 16:05:12 -07:00
Anders Kaseorg
21dc34cc52 open graph: HTML-escape og:description, twitter:description.
The entire idea of doing this operation with unchecked string
replacement in a middleware class is in my opinion extremely
ill-conceived, but this fixes the most pressing problem with it
generating invalid HTML.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-04-23 15:53:59 -07:00
Rishi Gupta
088714fb8f settings: Add sectioning to Other notifications section.
There are no other <h5>'s in static/templates. Basically just copied the
styling of `#settings_page h3` above it.

The vertical spacing here isn't great, but I think will require some deeper
fixes.
2019-04-23 15:24:39 -07:00
Rishi Gupta
a501abf3a1 settings: Move pm_content_in_desktop_notifications into Other notifications.
Not as nice as the previous coupling, but needed for upcoming refactors to
this page.
2019-04-23 15:24:39 -07:00
Rishi Gupta
29d30ceab7 settings: Decouple enable_push_notifications_offline from PM setting.
Note that this setting has always applied to both streams and PMs; the test
just clarifies that that is the case.
2019-04-23 15:24:39 -07:00
Rishi Gupta
8a2772adcf settings: Update tip in Notifications tab. 2019-04-23 15:24:39 -07:00
Rishi Gupta
3e899db35b settings: Update ordering of Notification settings for consistency.
The order in the streams section is visual, audio, mobile, email, which also
seems to match other products (though didn't do a careful analysis). This
changes the PM section to match.
2019-04-23 15:24:39 -07:00
Rishi Gupta
154379c6ae settings: Update wording for PM settings on notifications tab. 2019-04-23 15:24:39 -07:00
Anders Kaseorg
122ad5be58 lint: Lint against calls to _() on computed strings.
These don't actually work from an i18n perspective.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-04-23 15:23:18 -07:00
Anders Kaseorg
9a9de156c3 lint: Fix calls to _() on computed strings.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-04-23 15:23:03 -07:00
Anders Kaseorg
44dd7c2d95 lint: Strengthen lint checks for string % non-tuple.
This is really a job for an AST parser rather than a pile of regexes;
among other issues, these will still miss violations that span
multiple lines.  But, you know, I tried.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-04-23 15:22:51 -07:00
Anders Kaseorg
643bd18b9f lint: Fix code that evaded our lint checks for string % non-tuple.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-04-23 15:21:37 -07:00
Tim Abbott
d1b8497afb settings: Fix comment explaining NOREPLY_EMAIL_ADDRESS.
This documentation comment incorrectly claimed that we don't use
NOREPLY_EMAIL_ADDRESS when ADD_TOKENS_TO_NOREPLY_ADDRESS=True.

Fixes #12169.
2019-04-23 14:46:39 -07:00
Anders Kaseorg
9937734e50 terminate-psql-sessions: Only terminate if we have permissions.
We have been semi-accidentally relying on the fact that terminate-psql-sessions 
fails silently when there are PIDs we don't have permission to terminate.

This actually happens somewhat often, generally when we're doing a series of
operations in quick succession by different users, because postgres processes
live a little longer than the `psql` shell that started them.

As part of adding ON_STOP_ERROR to all of our postgres commands, it makes
sense to enforce we don't fail here, but that means we need to actually filter
the target PIDs to only ones we can actually kill.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-04-23 14:41:42 -07:00
Eeshan Garg
c012362fde webhooks/librato: Use proper punctuation. 2019-04-23 14:32:21 -07:00
Eeshan Garg
d733cc500c webhooks/groove: Rewrite the integration and improve messages.
The initial goal was to improve message formatting and punctuation
but after a closer look, I realized that a larger refactor was
worth it for clarity and redability.
2019-04-23 14:32:21 -07:00
Tim Abbott
cb6c1e7a92 export: Fix log line about zerver_scheduledemail_users. 2019-04-23 13:52:02 -07:00
Tim Abbott
cfd5054f2d zilencer: Add indexes for remotecount models.
These new indexes improve the performance of checking whether our
Remote*Count models are up to date by a factor of ~1000.
2019-04-23 13:52:02 -07:00
Anders Kaseorg
098e5ad3de templates: Fix more low-hanging HTML validation problems.
"http://localhost:9981/help/enable-emoticon-translations":323.13-324.31: error: The “align” attribute on the “th” element is obsolete. Use CSS instead.
"http://localhost:9981/help/enable-emoticon-translations":324.45-325.31: error: The “align” attribute on the “th” element is obsolete. Use CSS instead.
"http://localhost:9981/help/enable-emoticon-translations":329.13-330.23: error: The “align” attribute on the “td” element is obsolete. Use CSS instead.
"http://localhost:9981/help/enable-emoticon-translations":330.44-331.23: error: The “align” attribute on the “td” element is obsolete. Use CSS instead.
"http://localhost:9981/help/enable-emoticon-translations":337.6-337.9: error: Stray end tag “p”.
"http://localhost:9981/help/enable-emoticon-translations":337.6-337.9: error: Cannot recover after last error. Any further errors will be ignored.
"http://localhost:9981/api/incoming-webhooks-walkthrough":381.4-381.77: error: An “img” element must have an “alt” attribute, except under certain conditions. For details, consult guidance on providing text alternatives for images.
"http://localhost:9981/apps/":192.21-192.34: error: Bad value “” for attribute “src” on element “img”: Must be non-empty.
"http://localhost:9981/apps/":192.21-192.34: error: An “img” element must have an “alt” attribute, except under certain conditions. For details, consult guidance on providing text alternatives for images.
"http://localhost:9981/features/":225.9-225.82: error: An “img” element must have an “alt” attribute, except under certain conditions. For details, consult guidance on providing text alternatives for images.
"http://localhost:9981/features/":230.72-232.8: error: Text not allowed in element “svg” in this context.
"http://localhost:9981/features/":259.9-259.91: error: An “img” element must have an “alt” attribute, except under certain conditions. For details, consult guidance on providing text alternatives for images.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-04-23 13:00:59 -07:00
Anders Kaseorg
f772b5d7d4 docs: Fix easy HTML validation errors and warnings.
"file:/srv/zulip/docs/_build/html/git/troubleshooting.html":266.5-266.12: error: Element "commit" not allowed as child of element "em" in this context. (Suppressing further errors from this subtree.)
"file:/srv/zulip/docs/_build/html/git/troubleshooting.html":266.13-266.17: error: End tag "em" violates nesting rules.
"file:/srv/zulip/docs/_build/html/overview/architecture-overview.html":211.69-211.136: error: Start tag "a" seen but an element of the same type was already open.
"file:/srv/zulip/docs/_build/html/overview/architecture-overview.html":211.171-211.174: error: Stray end tag "a".
"file:/srv/zulip/docs/_build/html/translating/hindi.html":252.36-252.48: info warning: Text run is not in Unicode Normalization Form C.
"file:/srv/zulip/docs/_build/html/tutorials/writing-views.html":469.34-469.41: error: Element "method" not allowed as child of element "p" in this context. (Suppressing further errors from this subtree.)
"file:/srv/zulip/docs/_build/html/tutorials/writing-views.html":471.122-471.125: error: End tag "p" seen, but there were open elements.
"file:/srv/zulip/docs/_build/html/tutorials/writing-views.html":469.34-469.41: error: Unclosed element "method".

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-04-23 12:56:05 -07:00
Rafid Aslam
d983611919 template_parser: Add support for jinja2 whitespace markers.
Fixes #11516.
2019-04-23 11:52:13 -07:00
Tim Abbott
d4893dfcbc docs: Make API endpoint docs link to materials on REQ.
This should help avoid bugs like the one in the previous commit.
2019-04-23 11:31:19 -07:00
Tim Abbott
fa37401e69 api docs: Fix typo in typing notifications docs.
notification_to should be just to here.

This resulted from the person doing the port into these docs not
understanding the full REQ API.
2019-04-23 11:24:07 -07:00
Abhinav Singh
8c8df52dd9 user status: Decrease user status modal width by 20%
User status modal width is decreased by 20% to make it look better
with the user status message options added in the previous commit.
2019-04-23 11:21:31 -07:00
Abhinav Singh
3f10dc92ec user status: Add user status message options to user status modal.
Several user status message options are added to user status modal so
that the users can pick from them.

Fixes part of #11629.
2019-04-23 11:21:31 -07:00
Anders Kaseorg
61982d9d47 uploads: Revert "Url encoded name of the file should be an ascii."
This reverts commit fd9dd51d16 (#1815).

The issue described does not exist in Python 3, where urllib.parse now
_only_ accepts (Unicode) str and does the right thing with it.  The
workaround was not being triggered and would have failed if it were.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-04-22 22:28:39 -07:00
Anders Kaseorg
fd2f45ce5a package.json: Realphabetize devDependencies.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-04-22 22:24:50 -07:00
Tim Abbott
74143a0801 scripts: Disable terminate-psql-sessions ON_ERROR_STOP for now.
This appears to fail nondeterministically in CI; there's likely a
better fix but this should let us get CI happy again.
2019-04-22 15:49:48 -07:00
Alexandra Ciobica
d89cf5a9ea portico: Add android and iphone phones and screenshots in svg format. 2019-04-22 14:55:30 -07:00
Alexandra Ciobica
df1ce2eac8 portico: Change android screenshot from /apps. 2019-04-22 14:55:30 -07:00
Alexandra Ciobica
26f3f71b36 portico: Change ios screenshot from /apps. 2019-04-22 14:55:30 -07:00
Anders Kaseorg
5290519a62 scripts: Always use ON_ERROR_STOP=1 when running psql.
Also use psql -e (--echo-queries) in scripts that use ‘set -x’, so
errors can be traced to a specific query from the output.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-04-22 14:54:19 -07:00
Anders Kaseorg
efd22fd2ae postgres-init-dev-db: Catch exception when recreating extant users.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-04-22 14:54:18 -07:00
Anders Kaseorg
25798c8605 linter_lib: Remove sudo exemption for terminate-psql-sessions.
terminate-psql-sessions no longer uses sudo as of #11771.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-04-22 14:54:17 -07:00
Vishwesh Jainkuniya
c007b9ea4a notifcations: Remove user from the payload.
This contains email of the user to whom notification is being
send. This has not been used in any past mobile releases, so it is
safe to remove it.

As user_id will be stable for the user, but not email. So it's better to
start consuming `user_id` instead of email on mobile.
2019-04-22 14:50:04 -07:00
Vishwesh Jainkuniya
447a517e6f notifications: Add user_id in the GCM & APNS payload.
This makes it easy to uniquely identify the user account associated
with a notification by, for example, the (realm_uri, user_id) pair.

This helps improve notifications in the mobile apps.
See https://github.com/zulip/zulip-mobile/pull/3407#discussion_r266196616

Fixes #11961.
2019-04-22 14:49:03 -07:00
Tim Abbott
435477c703 settings: Document changing LOCAL_UPLOADS_DIR.
The main point here is that you should use a symlink rather than
changing it, since it's more maintenance work to update our nginx
configuration to use an alternative path than to just create a
symbolic link.

Fixes #12157.
2019-04-22 14:33:01 -07:00
Anders Kaseorg
12e2e0d658 tools/webpack: Run webpack in the foreground.
`tools/run-dev.py` already backgrounds `tools/webpack` (and deals with
cleaning it up on exit), so there’s no need for `tools/webpack` to
also background the actual `webpack` process.  But when running
`tools/webpack` by itself, it’s annoying to clean up the backgrounded
process manually.

Run `webpack` in the foreground, using `os.execvp` so we don’t waste
memory on an intermediate wrapper process.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-04-22 13:59:11 -07:00
Anders Kaseorg
ff342050ca package.json: Realphabetize dependencies.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-04-22 13:55:24 -07:00
Anders Kaseorg
591e0a04fc yarn.lock: Add integrity hashes.
This commit was generated by

    echo 'unsafe-disable-integrity-migration false' > .yarnrc
    yarn
    rm .yarnrc

This migration was added in yarn 1.10, but disabled by default in yarn
1.12 for better interoperability with previous versions of yarn, which
cause unnecessary yarn.lock churn by removing the integrity hashes
unconditionally.  It will be reenabled by default in yarn 2.0.

With or without this change, yarn will be adding integrity hashes for
new or updated packages.  We don’t need to interoperate with previous
versions, so we might as well do this entire migration now.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-04-22 13:55:24 -07:00
Puneeth Chaganti
184c0b9870 render_markdown_path: Convert dicts to dict item tuples for caching.
Calls to `render_markdown_path` weren't getting cached since the context
argument is unhashable, and the `ignore_unhashable_lru_cache` decorator ignores
such calls. This commit adds a couple of more decorators - one which converts
dict arguments to the function to a dict items tuple, and another which converts
dict items tuple arguments back to dicts. These two decorators used along with
the `ignore_unhashable_lru_cache` decorator ensure that the calls to
`render_markdown_path` with the context dict argument are also cached.

The time to run zerver.tests.test_urls.PublicURLTest.test_public_urls drops by
about 50% from 8.4s to 4.1s with this commit. The time to run
zerver.tests.test_docs.DocPageTest.test_doc_endpoints drops by about 20% from
3.2s to 2.5s.
2019-04-22 13:53:18 -07:00
Anders Kaseorg
dd3ccbc897 webpack: Fix node_modules path resolution.
Webpack applies special logic to relative paths provided in
`resolve.modules`, and this logic is expected to be used for
`node_modules`.  One case where this is important is when
`node_modules/foo` wants to import a different version of package
`bar` than the one at `node_modules/bar`, and so yarn gives it its own
copy at `node_modules/foo/node_modules/bar`.

It would probably be better to avoid screwing with `resolve.modules`
at all, but this at least brings us one step closer to the default of
just `["node_modules"]`.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-04-22 13:49:23 -07:00
Nikhil-Vats
fba3f49a9a portico: Fix alignment of sidebar zulip logo with label.
This vertically aligns the text "Zulip" with Zulip's logo
in the Portico sidenav.  Fixes #12140.
2019-04-21 23:03:04 -07:00
Vinit Singh
7a1c3f3afb list_render: Extend test to verify that list sorting is case insensitive.
The alphabetic sorting of lists in the User/Organization settings was
changed in fa0a5ec to be case insensitive.
This commit makes changes to the list_render.js test to verify that the
sorting of these lists is indeed case insensitive.
2019-04-21 16:09:02 -07:00
Tim Abbott
edd7a1ab53 docs: Add initial project ideas page for GSoD. 2019-04-19 14:50:06 -07:00
Steve Howell
6e1a67015f minor: Remove obsolete add_child method. 2019-04-18 14:01:57 -07:00
Steve Howell
6dbff03b9b zjquery: Improve on/off handling for events.
We no longer store handlers as an array of functions,
and instead we assume that code will only ever set up
one handler per sel/event or sel/event/child.  This is
almost always a sane policy for the app itself.

We also try to improve error handling when devs write
incorrect tests.

The only tests that required changes here are the
activity tests, which were a little careless about how
data got reset between tests.
2019-04-18 12:05:51 -07:00
Eeshan Garg
d8d9695087 webhooks/newrelic: Improve message formatting and punctuation. 2019-04-17 16:22:43 -07:00
Eeshan Garg
f86e445fe6 webhooks/sentry: Improve message formatting and punctuation. 2019-04-17 16:22:43 -07:00
Eeshan Garg
424061a07a webhooks/papertrail: Improve message formatting and punctuation. 2019-04-17 16:22:43 -07:00
Eeshan Garg
1c1b440adf webhooks/pingdom: Improve message formatter and punctuation. 2019-04-17 16:22:43 -07:00
Eeshan Garg
b44d352af6 webhooks/pagerduty: Use colons before quote blocks. 2019-04-17 16:22:43 -07:00
Eeshan Garg
e682889437 webhooks/insping: Improve message formatting and punctuation. 2019-04-17 16:22:43 -07:00
Eeshan Garg
5fccf197d1 webhooks/greenhouse: Improve message formatting and punctuation. 2019-04-17 16:22:43 -07:00
Eeshan Garg
674fcfcce1 webhooks/semaphore: Improve message formatting and punctuation. 2019-04-17 16:22:43 -07:00
Eeshan Garg
9d79becc0e webhooks/splunk: Improve message formatting and punctuation. 2019-04-17 16:22:43 -07:00
Eeshan Garg
21cdb6decc webhooks/wordpress: Improve message formatting and punctuation. 2019-04-17 16:22:43 -07:00
Eeshan Garg
0a0df3bc58 webhooks/zabbix: Improve message formatting and punctuation. 2019-04-17 16:22:43 -07:00
Tim Abbott
73e7d97a35 css: Fix missing newline at end of file. 2019-04-17 16:22:24 -07:00
Lobster
9eec90b92d docs: Update Redmine plugin integration documentation.
This reflects changes merged into master of the redmine plugin
recently.
2019-04-17 15:21:34 -07:00
Abhinav Singh
01b95d38be user status: Change user status modal style to standard modal style.
Tweaked by tabbott to use SCSS nesting.

Fixes part of #11629.
2019-04-17 15:12:34 -07:00
Vaibhav
b5333b0a49 message_edit: Disable edit save on enter press when file uploading.
This disables the ability to save the message edit on pressing enter key
when the file is still being uploaded.

Closes #12126.
2019-04-17 15:08:42 -07:00
Vaibhav
c14eb92109 upload: Fix send button selector in case of message-edit.
Previously the selector returned an undefined element when trying to select
the message edit save button (since `closest` selects the closest parent in
the DOM tree). This is fixed in this commit.
2019-04-17 15:06:50 -07:00
Tim Abbott
bf52ddc33a docs: Make sure that postgresql is running in OS upgrade instructions.
At least in the Trusty->Xenial upgrade flow, it can end up not running.
2019-04-17 12:58:42 -07:00
Tim Abbott
e566cad1da docs: Add OS upgrade step to remove upstart.
It's not required on Ubuntu Xenial (having been replaced by systemd)
and causes problems when installing/upgrading other packages; this
change matches a similar block of code in our installer.
2019-04-17 12:58:42 -07:00
Tim Abbott
18146ed947 script: Add static asset pipeline option to support OS upgrades.
The comment explains this in more detail, but basically one previously
needed the `--from-git` option to `upgrade-zulip-stage-2` if one had
last installed/upgraded from Git, and not that option otherwise, which
would have forced us to make the OS upgrade documentation much more
complicated than it needed to be.
2019-04-17 12:58:42 -07:00
Tim Abbott
6828cea76a docs: Clarify some key parts of OS upgrade documentation.
Thanks to Vishnu Ks for testing to figure these out.
2019-04-17 12:58:42 -07:00
Shubham Padia
7743fa5297 auth: Redirect deactivated user to /login when attempting social login. (#12130) 2019-04-17 12:28:57 -07:00
Anders Kaseorg
ed100d694f restore-backup: Open backup tarball as root.
Fixes permission errors when running restore-backup on a tarball
inaccessible to the zulip user.

Fixes #12125.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-04-17 12:26:03 -07:00
Anders Kaseorg
206741117c restore-backup: Reset cwd when switching to postgres user.
Fixes permission errors when running restore-backup from a cwd
inaccessible to the postgres user.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-04-17 12:26:03 -07:00
Shubham Padia
31cedbc9b8 backup: Make --output an optional argument instead of a positional one.
Fixes #12150.
Previously the `output` argument was positional, while the docs described
the arguments as optional in the form of `--output=...`.
2019-04-17 12:14:11 -07:00
Shubham Padia
32cf192b9b backup: Add option --skip-uploads to skip uploads backup. 2019-04-17 12:14:11 -07:00
Shubham Padia
984d3f2f0e backup: Add option --skip-db to skip database backup.
This may be relevant for organizations that use a corporate remote
postgres server and just want to backup their configuration.
2019-04-17 12:14:11 -07:00
Yash Rathore
bcfc22d94e navbar: Fix bugs caused by zulip.scss refactor.
A few bugs were caused by 7d4cebbc1e.
In night mode:
- home icon was hidden by grey box on "All messages" narrow.
- inactive tabs (eg "mentions" and "stars") were hidden behind grey box.
- topic tab was hidden behind grey box in topic narrow.

In both night mode and normal mode:
- "private messages" tab in individual/group pm narrows was illegible.

These were all results of unexpected differences in precedence rules
caused by the refactor.
2019-04-17 12:10:01 -07:00
Sameer Choubey
bde8b40473 api_docs: Add explicit '-X GET' to curl examples.
When passing arguments with the `-d` syntax, which is convenient for 
command-line examples, one needs to specify `-X GET` for curl to work
properly.

Fixes #12116
2019-04-17 12:08:35 -07:00
neiljp (Neil Pilgrim)
1348c8fd05 requirements: Upgrade mypy to 0.670.
Requires minor adjustment for accented 'i' in variable name.
2019-04-16 17:50:12 -07:00
neiljp (Neil Pilgrim)
2160ece8e2 requirements: Upgrade mypy to 0.660. 2019-04-16 17:50:12 -07:00
Rishi Gupta
1e5df34a4c help: Make minor updates to import-from-mattermost. 2019-04-16 17:49:42 -07:00
Rishi Gupta
f903feb6b7 help: Update stream-notifications to reflect new default notif behavior.
Just updating this to no longer be incorrect; I expect we'll update this and
the rest of the Notifications section once we're done with the larger
notifications refactoring project.
2019-04-16 17:49:42 -07:00
Rishi Gupta
88903adb39 help: Rename join-zulip-chat-badge to linking-to-zulip. 2019-04-16 17:49:42 -07:00
Rishi Gupta
e2ff91f507 help: Remove indentation from markdown ordered lists.
The indentation doesn't look good with the green circles.
2019-04-16 17:49:42 -07:00
Rishi Gupta
bc4b7acc29 help: Use numbered options in HipChat import.
The styling for this is not great, but we need numbers here so that people
can tell us which numbered option they prefer.
2019-04-16 17:49:42 -07:00
Anders Kaseorg
9fc0aa7ffa scripts: Fix exec invocation for in-process virtualenv activation.
activate_this.py has always documented that it should be exec()ed with
locals = globals, and in virtualenv 16.0.0 it raises a NameError
otherwise.

As a simplified demonstration of the weird things that can go wrong
when locals ≠ globals:

    >>> exec('a = 1; print([a])', {}, {})
    [1]
    >>> exec('a = 1; print([a for b in [1]])', {}, {})
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "<string>", line 1, in <module>
      File "<string>", line 1, in <listcomp>
    NameError: name 'a' is not defined
    >>> exec('a = 1; print([a for b in [1]])', {})
    [1]

Top-level assignments go into locals, but from inside a new scope like
a list comprehension, they’re read out of globals, which doesn’t work.

Fixes #12030.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-04-16 17:42:44 -07:00
Wyatt Hoodes
d67dc2eb94 install-node: Upgrade yarn to 1.15.2.
In addition to upgrading dependencies being generally useful, this may
fix situations where yarn fails but returns a success status code in the 
presence of an HTTP proxy.
2019-04-14 22:36:14 -07:00
Eeshan Garg
f7fd9bd17d webhooks/statuspage: Improve message formatting and punctuation. 2019-04-14 22:20:02 -07:00
Eeshan Garg
f6a601f09f webhooks/heroku: Improve message formatting and punctuation. 2019-04-14 22:20:02 -07:00
Eeshan Garg
8cf18fe4d2 webhooks/delighted: Improve message formatting and punctuation. 2019-04-14 22:20:02 -07:00
Eeshan Garg
33b0bf3cb4 webhooks/beeminder: Improve message formatting and punctuation. 2019-04-14 22:20:02 -07:00
Eeshan Garg
b7ea727087 webhooks/basecamp: Improve message formatting and punctuation. 2019-04-14 22:20:02 -07:00
Eeshan Garg
e7fee92463 webhooks/appveyor: Improve message formatting and punctuation. 2019-04-14 22:20:02 -07:00
Eeshan Garg
92509a0cac webhooks/ansibletower: Improve message formatting and punctuation. 2019-04-14 22:20:02 -07:00
Tim Abbott
5d2984fb46 docs: Document upgrading the version of Ubuntu.
One longstanding gap in our production documentation is how to
properly do an upgrade to the operating system on which Zulip is
installed.

This adds that documentation.

Ideally, we'd get a few folks to test this procedure over the next few
days to make sure it's bulletproof.

Fixes #1705.
Fixes #10796.
2019-04-14 21:59:40 -07:00
Wyatt Hoodes
0986216e2c compose.scss: Fix alignment of "markdown preview" icons.
Removed the preview tag from the css rule, reduced the undo preview tag
to a font-size of 15px.

The preview tag being attached to the rule proved unnecessary. The icon
for reverting back to an editing state also dipped below the horizontal
level of the icon row.
2019-04-14 16:37:36 -07:00
YashRE42
6f5184bf01 docs: Explain stubbing for node tests. 2019-04-13 22:45:22 -07:00
Tim Abbott
31f6ace084 lint: Fix typo in eslint command line. 2019-04-13 22:45:07 -07:00
Tim Abbott
ad81f700a1 scripts: Remove nagios overrides for missedmessage_emails.
Since 5cec566cb9, the
missedmessage_emails queue no longer is expected to grow a backlog
over time.
2019-04-13 20:43:07 -07:00
Puneeth Chaganti
9876f1b14e check_rabbitmq_queue: Fix the time period when we ignore long queues.
The commit 87d1809657 changed the time when
digests are sent by 3 hours to account for moving from the US East Coast to the
West Coast, but didn't change the time period exception in the
`check-rabbitmq-queue` script.

Closes #5415
2019-04-13 20:43:07 -07:00
matkaczmarek
b081e6c728 stream-edit: Fix stream name span
This commit fixes broken span for stream-name edit on Firefox by adding
vertical-align to css.

Fixes #11923
2019-04-13 20:35:31 -07:00
Tim Abbott
5ad41b087c docs: Do an edit pass on the Mattermost data import documentation. 2019-04-13 20:33:07 -07:00
Vishnu Ks
877d2bb68f docs: Add docs for exporting from gitlab omnibus mattermost. 2019-04-13 20:27:12 -07:00
Vishnu Ks
7718c00a36 docs: Add docs for exporting from non docker mattermost. 2019-04-13 20:27:12 -07:00
Vishnu Ks
0863870e85 docs: Improve mattermost docker export docs. 2019-04-13 20:27:12 -07:00
Puneeth Chaganti
ca8e9fb800 bugdown: Make the youtube URL regex slightly easier to read. 2019-04-13 20:25:37 -07:00
Puneeth Chaganti
8afda1c1bb bugdown: Show preview for urls copied from the Youtube share widget. 2019-04-13 20:25:37 -07:00
Shubham Padia
3c09f226a4 auth: Redirect deactivated users with error for social auth backend.
Fixes #11937.

Also extracts the error message for a deactivated account to
`DEACTIVATED_ACCOUNT_ERROR`.
2019-04-13 19:58:15 -07:00
ruchit2801
f71d8a7ed5 docs: remove repeated 'etc.' word from sending-messages.md.
There are two 'etc' words in the same line. This removes one of them.

Note from Tim: The old text was arguably correct, but removing it is definitely clearer.
2019-04-13 19:39:47 -07:00
overide
b263671c9e markdown: Fix unordered list not rendering in blockquote.
This fixes an issue where the hanging unordered list was not
rendering in blockquote; the problem was that we were not
adding an empty line(to satisfy the markdown) for hanging
unordered list if it is in blockquote. Both blockquote
and code block is fenced but we want to avoid rendering
the list if it's in the code block but not in blockquote.

Fixes: #11916.
2019-04-13 19:23:59 -07:00
vinitS101
5bf8917597 css: Add css rules to display ordered lists like bulleted lists.
This change adds rules for ordered lists that makes them visually similar
to bulleted lists.

Note that is has no effect because our markdown implementation doesn't
currently generate ol tags.
2019-04-13 18:58:26 -07:00
vinitS101
39f40c3f1a css: Changes to top and bottom margins for bulleted lists and blockquotes.
This change decreases the spacing at the top and bottom of bulleted lists
and blockquotes.
Specific rules for p and p:last-of-type have been added for both uls and
blockquotes to maintain visually consistent spacing in all cases.
2019-04-13 18:57:41 -07:00
vinitS101
d6fb15616d hotkeys: Add e for edit selected message.
Adds 'e' as a hotkey for editing the selected message.
Changes to the Keyboard Shortcuts menu to reflect this change.

Fixes #11866.
2019-04-13 18:52:27 -07:00
YashRE42
7d4cebbc1e navbar: Refactor tab_bar to nested selectors.
This refactors tab_list styles to be under tab_bar and to use nesting.
2019-04-13 13:24:20 -07:00
Tim Abbott
75215f0014 left sidebar: Simplify filter icon CSS logic. 2019-04-13 13:21:51 -07:00
Alexandra Ciobica
d9edcbfd46 css: Center vertically the global-filters and streams arrows.
Decreased the top with 1px because it was not vertically aligned with respect to the text.
2019-04-13 13:21:51 -07:00
Alexandra Ciobica
97b9755484 left sidebar: Cleanup duplicate icon padding css. 2019-04-13 13:21:42 -07:00
Alexandra Ciobica
4eeb33275e css: Align left sidebar global-filters icons with text.
Removed the top pixel from all messages and added top: -1px to private
messages to align the envelope properly.
2019-04-13 13:12:16 -07:00
Tim Abbott
a44de17f9b docs: Add initial documentation for TypeScript.
This is a draft/preliminary document on how we're doing our TypeScript
migration; I'm sure we'll add a lot more over the coming weeks.
2019-04-13 12:20:40 -07:00
Tim Abbott
858ac3cf3f docs: Clarify we're now fully on the Python 3 type syntax. 2019-04-13 11:55:33 -07:00
Thomas Ip
9c6964aa19 ESLint: Modify recommended typescript rules to fit our use case. 2019-04-13 11:42:48 -07:00
Thomas Ip
8b6ff8b016 ESLint: Set typescript recommended rules.
ESLint currently forbids using extends in the override block, ie
```
{
    "extends": ["plugin:@typescript-eslint/recommended"]
}
```
so we just have to add them manually for now.

See https://github.com/eslint/eslint/issues/8813 .
2019-04-13 11:42:48 -07:00
Thomas Ip
90478fc4b2 typescript: Fix violations of new typescript rules. 2019-04-13 11:42:48 -07:00
Thomas Ip
02cb85a8a9 typescript: Use ESLint instead of TSLint. 2019-04-13 11:42:47 -07:00
Thomas Ip
ea9a74fe24 typescript: Fix violations of existing eslint rules. 2019-04-13 11:38:19 -07:00
vinitS101
fa0a5ecb33 list_render: Change alphabetic sorting to be case insensitive.
The current behavior treats uppercase and lowercase characters
differently resulting in incorrect sorting of lists.
This change fixes that and makes the alphabetic sorting of columns
case insensitive.
2019-04-13 11:36:28 -07:00
vinitS101
5be38f03db css: Change rtl ul rule to only set left and right margins.
This change has been made so that the top and bottom margins for
bulleted lists is completely handled by the other ul rule.
2019-04-13 11:28:05 -07:00
Tim Abbott
cef784b101 compose: Fix buggy escaping of LaTeX in quote-and-reply.
Apparently, our use of JavaScript string `.replace()` here was buggy,
because replace() has several special escape sequences starting with
`$` if they appear in the replacement content string.  We can work
around this through something of a hack, which is to pass a function
as the second argument to replace, which seems cleaner than replacing
all $s with $$s.

Thanks to Shreya for the report.
2019-04-13 10:52:44 -07:00
Anders Kaseorg
9f7c0b7e65 postgres_master.pp: Fix wacky su command line.
The construction `su postgres -c -- bash -c 'psql …'` didn’t behave the
way it reads, and only worked by accident:

1. `-c --` sets the command to `--`.
2. `bash` sets the first argument to `bash`.
3. `-c 'psql …'` replaces the command with `psql …`.

Thus, `su` ended up executing `<shell> -c 'psql …' bash`, where
`<shell>` is the `postgres` user’s login shell, usually also `bash`,
which then executed 'psql …' and ignored the extra `bash`.

Unconfuse this construction.

Note from tabbott: The old code didn't even work by accident, it was
just broken.  The right fix is to move the quoting around properly.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-04-12 17:27:23 -07:00
Anders Kaseorg
460abe82df terminate-psql-sessions: Allow running as postgres user.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-04-12 17:27:23 -07:00
Anders Kaseorg
53879c4673 scripts: Rename DEFAULT_USER to POSTGRES_USER.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-04-12 17:27:23 -07:00
Priyank Patel
8a15b9ee87 Revert "user-profiles: Lazy load profile pictures when in view."
This reverts commit 6441ad0677 since it
causes two bugs: (1) when rendering new message there is glitch where
the profile picture flashes (2) when someone sends a new message their
profile picture flickers.
2019-04-12 16:50:37 -07:00
Anders Kaseorg
d03b8308a5 backup: Use tar --transform to arrange the tarball instead of symlinks.
This allows tar to print the real paths in error messages if something
goes wrong.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-04-12 16:48:34 -07:00
Rhythm
85cf97b113 click_handlers: Disable draggability for left-sidebar components. 2019-04-12 16:39:36 -07:00
Tim Abbott
d14a1fd1b1 css: Properly nest rules for message embeds and widgets. 2019-04-12 12:52:13 -07:00
Tim Abbott
d7aa186dab css: Rewrite styling for markdown paragraph spacing.
Historically, we had a large bottom-margin on p tags designed to
produce correct spacing between consecutive paragraphs (10px, similar
to the spacing between consecutive paragraphs in different messages by
the same sender).  And then we tried to fix the end-of-message spacing
with a p:last-of-type rule, which fixed that problem, but created lots
of unnecessary extra space just before a bulleted list, block quote, etc.

We recently added some p+ul and p+blockquote negative margin rules in
62f2396ee2 to try to fix this, but those
created some secondary issues in interaction with the p:last-pf-type
rule.  This rabbit hole is likely somewhat deep.

The right fix for this overall formatting is to implement the
inter-paragraph spacing as a p+p rule, rather than a bottom-margin on
the p rule; then, we get all the properties we're interested in for
how paragraphs interact.

We may need to do some follow-up work to add small p+ul and
p+blockquote rules to get the pixel-perfect spacing we want (or maybe
just adjust the ul/blockquote spacing CSS), but this is clearly a
better architecture for doing this work.

Fixes #12101 through solving the same problem it does.
2019-04-12 12:52:01 -07:00
Tim Abbott
74a87ecff0 css: Consolidate rendered_markdown CSS blocks.
This has no functional changes.
2019-04-12 12:30:05 -07:00
Tim Abbott
00eaf3a8e6 css: Clean up CSS for blockquotes and markdown tables.
This has no functional changes, just making the implementation more
standard.

We don't have any blockquotes outside markdown rendering, which is why
it's correct to collapse the blockquote rules.
2019-04-12 12:22:40 -07:00
Tim Abbott
d6404b978a css: Reorder zulip.scss so rendering markup is in one place. 2019-04-12 12:19:11 -07:00
Tim Abbott
ee764e67ad css: Use SCSS nesting for message_embed rules block. 2019-04-12 12:13:30 -07:00
Tim Abbott
be965e3b16 css: Fix rules incorrectly attached to messagebox.
These rules should have been on message_content/rendered_markdown, and
as a result did not properly apply to drafts (etc.).
2019-04-12 12:10:44 -07:00
Tim Abbott
27b5168395 css: Move markdown rendering to rendered_markdown class.
This eliminates unnecessary use of the message_content CSS class in
favor of rendered_markdown, which makes more sense for places outside
messages where we display rendered Zulip markdown.
2019-04-12 12:08:34 -07:00
Marco Burstein
ae5496020b docs: Add ".ts" support in docs and configuration.
Add references to TypeScript in documentation where appropriate, such
as in example bash commands and discussions of the file structure.
Add a new section to the Reading List with TypeScript resources.
Also update `.editorconfig` to support ".ts" files.

Fix part of #12000.
2019-04-12 11:26:17 -07:00
Marco Burstein
ce7d2fde70 tools: Add TypeScript to the dependency visualizer.
The dependency visualizer currently only supports JavaScript files,
such as in the `get_js_edges` function, where only the ".js" extension
is supported. Update the visualizer to support ".ts" files as well and
to output modules without their extensions.
2019-04-12 11:14:42 -07:00
Marco Burstein
57ffc3fe74 tests: Update JS Node tests to support TypeScript.
Currently, the `test-js-with-node` tests append ".js" to filenames
without an extension. Since Typescript is now also supported, it can
produce results such as "dict.ts.js". To remedy this, check for ".ts"
files as well.
2019-04-12 11:14:42 -07:00
Wyatt Hoodes
bafcf3c664 export.py: Add 'delete after upload' option for removing tarball.
This allows removal of the local tarball upon a succesful s3 upload.

A part of the public-only-realm-export webapp feature.
2019-04-12 10:50:06 -07:00
Wyatt Hoodes
0db7d6c31b export.py: Refactor './manage.py export' core logic.
This commit serves as the first step in supporting "public export" as a
webapp feature.  The refactoring was done as a means to allow calling
the export logic from elsewhere in the codebase.
2019-04-12 10:50:06 -07:00
Tim Abbott
701cc524b0 settings: Set a default for SSO_APPEND_DOMAIN.
This means that if a user comments out the field in
/etc/zulip/settings.py, they won't get an error.
2019-04-12 10:48:05 -07:00
Rishi Gupta
1a7a449572 billing: Add backend support for downgrading. 2019-04-11 23:27:42 -07:00
Rishi Gupta
babaaf82fe billing: Update json endpoints test to allow more flexibility.
Slight loss in functionality, but doing the mocks correctly for every view
will be more work than the test is worth.
2019-04-11 23:20:29 -07:00
Rishi Gupta
a529080f01 billing: Rename add_plan_renewal_to_license_ledger_if_needed. 2019-04-11 23:20:29 -07:00
Rishi Gupta
03d21c6317 billing: Refactor renewal_amount to return 0 instead of None. 2019-04-11 23:20:29 -07:00
Rishi Gupta
447ae77b24 billing: Add another live CustomerPlan.status.
Only CustomerPlan.ACTIVE is being used in the code / in production, so don't
need a db migration to move the other CustomerPlan.status constants around.
2019-04-11 23:20:29 -07:00
Rishi Gupta
4430f78aa3 billing: Rename next_renewal_date to start_of_next_billing_cycle. 2019-04-11 23:20:29 -07:00
Steve Howell
3cfc3ca24b pm list: Remove "(more conversations)" feature.
Now that we have a scroll container for the PM list,
it doesn't make much sense to limit the number to
five.

We may resurrect this feature if "more conversations"
actually fetches more conversations, but it doesn't
currently.

We also may soon make it easy to limit PMs to just
unread messages, which will make the max-5 feature
perhaps less necessary, and we don't want to make
the UI overly complicated.
2019-04-11 16:26:54 -07:00
Anders Kaseorg
ec87544840 pm_list: Add missing scrollbar update.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-04-11 16:26:54 -07:00
Tim Abbott
0a656bec8a docs: Fix incorrect path to remote development nginx file. 2019-04-11 16:24:57 -07:00
Wyatt Hoodes
aac09b22ac vagrant: Add option to specify system settings.
Two variables were declared and assigned the respective values of the
default settings for the system. If the keyword is used in the
~/.zulip-vagrant-config file, the value is assigned to the variable.

There is no straightforward way to customize the virtual machine's
number of cpus or memory, this commit addresses that fact.
2019-04-11 12:28:12 -07:00
Steve Howell
9295cc477a left sidebar: Fix hover title for "STREAMS".
If you click on STREAMS, it opens the
streams filter, so now the hover reflects
that.

The wording here is consistent with what
you see when you hover over USERS.

Maybe we want to say "Search ..." instead
of "Filter ..." for these two headings.

Maybe this is just a bit of a misfeature,
though, since we already have search icons,
and we don't have consistent behavior for
the GROUP PMs header.
2019-04-11 10:59:53 -07:00
Steve Howell
29055c16ae pm list: Simplify logic to find "active" filters.
We now just calculate two vars:

    pm_list - which individual PM conversation to highlight
    is_pm_filter - highlight "Private messages"

The logic is structured so that we err on the side of **not**
spuriously selecting list items:

    * be defensive about `filter` not existing for some reason
    * don't select anything if we have multiple pm-with
      operands in the search (which is sort of undefined
      behavior)

Tweaked by tabbott to add a comment explaining the multiple pm-with case.
2019-04-11 10:59:53 -07:00
Steve Howell
6b144003c2 pm list: Avoid duplicate resize calls.
We are basically just inlining remove_expanded_private_messages,
skipping the resize call that happens at the end of rebuild_recent.

This change makes sense even if we keep the
current UI for Private Messages.
2019-04-11 10:59:33 -07:00
Steve Howell
bfdce11c8f refactor: Initialize stream list code in stream_list.js.
This code was in subs.js for historical reasons.
2019-04-11 10:50:55 -07:00
Alexandra Ciobica
d8e9975b9d css: Align left sidebar icons horizontally and fix the spaces.
Center aligned the icons from streams and decreased the font-size of
the icons from the global filters.

This dramatically improves the visual appearance of the left sidebar.

Fixes: #11917.
2019-04-11 10:47:30 -07:00
vinitS101
62f2396ee2 message view: Reduce extra white space above quotes and unordered lists.
Blockquotes and unordered lists had a large amount of space above them
when preceded by a paragraph tag, which looks ugly.  This is a common
issue with the CSS rendering of essentially all markdown
implementations (e.g. GitHub has this bug).

We resolve the issue by reducing that whitespace with negative
margins.  Hopefully, this won't create other weird glitches in the
process.

Fixes #11631.
2019-04-10 17:51:04 -07:00
Tim Abbott
93b2fa9b7c docs: Improve documentation on node test suite.
The most important part of this is encouraging folks to read the
zjquery documentation.
2019-04-10 16:35:35 -07:00
Mohit Maroliya
e16d721921 docs: Fix a few typos in documentation. 2019-04-10 10:44:35 -07:00
Vishnu Ks
e3b4883386 circleci: Downgrade to 2.0.
We initially upgraded to 2.1 under the assumption that 2.1 was necessary
to enable pipelines. This turns out to be not true. Pipelines can be enabled
from 2.0 as well. On the other hand upgrading to 2.1 requires enabling
pipelines. This resulted in broken builds across many forks that has enabled
CircleCI and not pipelines. We are also not making use of any 2.1 features
like reusable orbs, commands, and executors currently. Downgrading to 2.0 will
also allow us to use "." in the job names which makes them more readable.
2019-04-10 10:22:54 -07:00
Sebastian Morr
cc226d107e Correctly label the shortcut for starting a PM as "(x)" instead of "(c)" 2019-04-10 09:34:44 -07:00
Tim Abbott
ddf26a6ced test_events: Post-process state before comparisons in do_test.
This is important because upcoming features will include slightly more
complex logic in post_process_state that we'd ideally like to be
included in what this suite tests.

This requires a few related changes:

* A small change to post_process_state to sort the realm_users objects
  by user_id to ensure those data structures are stable.

* Improvements to the logic for checking if the initial state has
  changed to use match_states for better output.
2019-04-08 19:42:34 -07:00
sumanthvrao
c5de6d0e18 spiders: Set error status for exceptions generated by spider.
Spider raises exceptions when errors like FileNotFound
are detected. However, these did not set error state
before exiting causing spider to fail silently.

This patch sets the status causing exceptions to exit with
non-zero exit status.
2019-04-08 17:04:29 -07:00
Vaibhav
f852868673 docs: Add message box to manual testing docs.
This adds numerous manual testing methods and checks to the
`manual-testing.md` to verify the functioning of various hotkeys,
click handlers and appearance of the message box.
2019-04-07 13:01:24 -07:00
Sahil Batra
c2fa8765a7 docs: Fix typo in gsoc-ideas.md. 2019-04-06 13:23:08 -07:00
Vaibhav
c2e938f758 minor: Export function copy_handler.
This makes it potentially possible to call this function from other
code paths such as hotkeys.
2019-04-06 12:56:04 -07:00
Vaibhav
1e456eb84c copy_and_paste: Extract analyze_selection function.
This is the part where the whole selection is analyzed to get the
`start_id` and `end_id` of the messages that are selected (the
loop part of the copy handler).

This is extracted and exported as well.
2019-04-06 12:55:42 -07:00
Mohit Maroliya
8c0cd1b6d4 docs: Add clarifying comma in CODE_OF_CONDUCT.md. 2019-04-05 18:01:37 -07:00
Tim Abbott
abc7a00d35 Revert "docs: Update .html links to .md."
This doesn't work without the CommonMark upgrade.

This reverts commit c87893feea.
2019-04-05 17:58:54 -07:00
Vishnu Ks
02c92e55a2 import: Add tool for importing teams from mattermost. 2019-04-05 17:53:03 -07:00
Abhinav Singh
c27d927663 refactor: Remove inline javascript code in email_log.html.
All the inline javascript code present in email_log.html(which is
rendered when the user visits "/emails" in development mode) is
transferred to a new file: email_log.js in portico/ directory.

Fixes #11608.
2019-04-05 17:28:23 -07:00
Vaibhav
69660da0e1 message_list_view: Remove check specific to undefined for "is stream".
Private messages too have non-`undefined` stream name. It is usually
an empty string. The check has been changed to not check specifically
for stream name to be undefined.
2019-04-05 17:26:05 -07:00
Samuel Searles-Bryant
c87893feea docs: Update .html links to .md.
Sphinx/ReadTheDocs supports automatically translating links written as
to `.md` files to point to the corresponding `.html` files, so this
migration does not change the resulting HTML output in ReadTheDocs.
But it does fix apparent broken links on GitHub.

This doesn't prevent people from reading the documentation on GitHub
(so doesn't mitigate the fact that some rtd-specific syntax does not
render properly on GH), but it will prevent us from getting erroneous
issues reported about the hyperlinks not working.

Fixes: #11087.
2019-04-05 17:16:25 -07:00
Vaibhav
6191b4d93a copy_and_paste: Change copy div css to match "day mode".
Color and background is made according to "day mode"
exclusively here because when copying the content
into, say, Gmail compose box, the styles come along.
This is done to avoid copying the content with dark
background when using the app in night mode.

We can avoid other custom styles since they are wrapped
inside another parent such as `.message_content`.
2019-04-05 17:13:20 -07:00
Vaibhav
7f27c09704 markdown: Add rendered_content selector to night-mode syntax highlight.
This adds a parent selector, `rendered_content`, to night mode syntax
lighlight selector. This helps us in getting the "day mode" syntax
highlight styles in night mode.
2019-04-05 17:13:20 -07:00
Vaibhav
5c36918c17 markdown: Add .rendered_markdown for all elements with rendered MD content.
This adds a class `rendered_markdown` for all the elements which have
rendered markdown content; This is done to add different styles for
rendered content in day mode and night mode.

Also replace the element selectors from CSS to use the class.
2019-04-05 17:13:20 -07:00
clarammdantas
85ddd73d8c message_edits: Notify subscribers when a message is changed.
Extend the list of users that have to be notified when a message is
changed, so that in addition to users who have a UserMessage row, any
users who subscribed later to a stream with history public to
subscribers will also get the update.

Fixes: #8750.
2019-04-05 17:06:24 -07:00
Priyank Patel
6441ad0677 user-profiles: Lazy load profile pictures when in view.
Using lazysizes we only load images if they are in view.
This decreases load time and save more bandwidth since images are loaded
after html is loaded and if they are on screen.

Fixes #3564.
2019-04-05 15:51:02 -07:00
Priyank Patel
9c4ef94726 dependencies: Add lazysizes npm package. 2019-04-05 15:51:02 -07:00
Anders Kaseorg
11f18042fe run-dev-queue-processors: Remove
As of #367, `tools/run-dev-queue-processors` has evolved into nothing
more than an unnecessarily elaborate wrapper around `manage.py
process_queue --all`.  Remove it (mostly to make it marginally easier
to Tab-complete `tools/run-dev.py`, if I’m being honest).

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-04-05 15:18:38 -07:00
Eeshan Garg
bc430909af webhooks/intercom: Implement support for all events. 2019-04-05 15:15:52 -07:00
Rishi Gupta
2270d4d192 billing: Try paying invoices when user puts a new card on file.
Previously, when users got a "payment failed" email from Stripe (e.g. if
their card failed on renewal), they would enter in a new card on
/billing#payment-method, and wouldn't find out if the card worked till
Stripe retried the payment 4 days later.
2019-04-05 13:36:03 -07:00
Rishi Gupta
5d970cc09b billing: Upgrade to Stripe API version 2019-03-14.
No breaking changes.
2019-04-05 11:24:45 -07:00
Rishi Gupta
28a586e502 billing: Add default value for event_time in invoice_plans_as_needed. 2019-04-05 11:24:45 -07:00
Rohitt Vashishtha
22a3b4230c Revert "install: Ensure that sudo is installed."
Now that we have the run_as_root helper function, we don't need to
install sudo to run Zulip in production

This reverts commit a7d7d181ea.

Fixes #10036.
2019-04-04 16:52:20 -07:00
Rohitt Vashishtha
327b70cb19 terminate-psql-sessions: Allow running without sudo. 2019-04-04 16:52:20 -07:00
Tim Abbott
042893a448 configure-rabbitmq: Allow running as root.
This makes it possible to run this in production without access to
sudo.
2019-04-04 16:52:20 -07:00
Tim Abbott
4c3c669b41 mobile: Add support for recent_private_conversations API.
This adds experimental support in /register for sending key
statistical data on the last 1000 private messages that the user is a
participant in.  Because it's experimental, we require developers to
request it explicitly in production (we don't use these data yet in
the webapp, and it likely carries some perf cost).

We expect this to be extremely helpful in initializing the mobile app
user experience for showing recent private message conversations.

See the code comments, but this has been heavily optimized to be very
efficient and do all the filtering work at the database layer so that
we minimize network transit with the database.

Fixes #11944.
2019-04-04 16:47:43 -07:00
Eeshan Garg
0076b71411 webhooks/stripe: Ignore account updates with insufficient data.
Certain payloads for account updates do not include the
previous_attributes that allow us to figure out what was actually
updated. So, we just ignore just payloads.
2019-04-04 15:21:47 -07:00
Vishnu Ks
d64f5e9ccd test_classes: Move make_output_dir to test_classes. 2019-04-04 13:51:52 -07:00
Vishnu Ks
719abbd352 test_classes: Move rm_tree to test_classes. 2019-04-04 13:51:52 -07:00
Vishnu Ks
f517f72dd2 import: Make use of is_mirror_dummy in build_user_profile. 2019-04-04 13:51:52 -07:00
Vishnu Ks
ac2de3024d test_classes: Create fixture_file_name helper. 2019-04-04 13:51:52 -07:00
Vishnu Ks
bd4c3b3ebb import: Move make_user_messages to import_util.py. 2019-04-04 13:51:52 -07:00
Harshit Bansal
b630a6456d commands: Fix handling of keyword arguments in query_ldap command.
This bug seems to be introduced by me while doing the refactoring
in `94649f58f2fe0ed78d84e597ad6676522cfef9be`.

Fixes: #12006.
2019-04-04 13:42:33 -07:00
aswanthkoleri
b12f494031 documentation: Update the API documentation for Get all users. 2019-04-04 13:29:16 -07:00
aswanthkoleri
b1a7d5a81d users: Add timezone field to Get all users API endpoint. 2019-04-04 13:29:14 -07:00
Tim Abbott
0831156614 auth: Use delivery_email in routes to fetch an API key + email.
This enables the mobile apps working correctly when delivery_email !=
email.
2019-04-04 13:24:29 -07:00
Tim Abbott
32c50a99fd events: Pass a Realm to get_raw_user_data.
This will be helpful for checking realm settings in upcoming commits.
2019-04-04 13:05:35 -07:00
Vishnu Ks
713999556d circleci: Move to CircleCI 2.1 format.
This contains the minimum changes required to move to the CircleCI 2.1
configuration file format. In 2.1 job names should not contain "." in
them.

Moving to 2.1 will allow us to enable enable pipelines from CircleCI
project settings UI. Once pipeline is enabled auto-cancellation of
redundant workflows can be also enabled from the CircleCI UI.

See https://circleci.com/docs/2.0/build-processing/
2019-04-04 13:02:28 -07:00
Anders Kaseorg
f78970c679 restore-backup: Set the recreated database owner to zulip.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-04-04 11:50:13 -07:00
Alexandra Ciobica
0c328d9617 css: Add spacing between info and image on /apps.
Fixes: #11811.
2019-04-04 11:32:58 -07:00
Hemanth V. Alluri
636dad7809 webhooks/bitbucket3: Use strikethrough formatting for deleted comments. 2019-04-03 19:43:04 -02:30
Hemanth V. Alluri
dffb536920 webhooks/bitbucket3: Link actor name with their profile. 2019-04-03 19:43:04 -02:30
Hemanth V. Alluri
eecf95d2fd webhooks/bitbucket3: Add support for all pull-request events.
closes #11992.
2019-04-03 19:43:04 -02:30
Rishi Gupta
17528e4ee9 help: Add create-a-poll.md. 2019-04-02 23:09:36 -07:00
Rishi Gupta
36fecaef94 help: Add configure-notification-bot.md. 2019-04-02 22:22:46 -07:00
Rishi Gupta
3c65fda41e help: Add disable-welcome-emails. 2019-04-02 22:05:19 -07:00
Rishi Gupta
dc98359fcf help: Add switching-between-organizations.
This is in response to a support ticket where the user had a closed left
sidebar, had added an organization, and then couldn't figure out how to
switch organizations. They had googled and found "The desktop app makes it
easy to switch between different organizations" in our help docs, which was
not sufficiently helpful.
2019-04-02 20:54:07 -07:00
Rishi Gupta
78b2b5e053 help: Move add-custom-profile-fields to Users & bots. 2019-04-02 19:57:43 -07:00
Rishi Gupta
23856fb0ab help: Update Stream management section to conform to style guide. 2019-04-02 17:05:59 -07:00
Rishi Gupta
89056fcdaa help: Update Users & Bots articles to conform to style guide. 2019-04-02 17:05:59 -07:00
Rishi Gupta
1b215410a7 help: Update text and style of Organization settings articles. 2019-04-02 17:05:59 -07:00
Rishi Gupta
3871a44422 help: Update Organization basics section to conform to style guide. 2019-04-02 17:05:59 -07:00
Rishi Gupta
c65b82832e help: Update wording of Caveats in import-from-hipchat. 2019-04-02 17:05:59 -07:00
Rishi Gupta
4924f7ad92 help: Update Tools & customization section to conform to style guide. 2019-04-02 17:05:59 -07:00
Rishi Gupta
ce33b4a270 help: Update styling on desktop-app-install-guide. 2019-04-02 17:05:59 -07:00
Rishi Gupta
fcd0e8c809 help: Update Notifications articles to conform to style guide. 2019-04-02 16:45:25 -07:00
Rishi Gupta
37ec3e1eb0 help: Remove organize-the-streams-sidebar.
This article will have more of a role once we add the option for (not)
pushing inactive streams to the bottom.
2019-04-02 16:45:25 -07:00
Rishi Gupta
6f1a754d70 help: Update Streams & topics articles to conform to style guide. 2019-04-02 16:45:25 -07:00
Thomas Ip
b8e1b8d6ff coverage: Bring dict.ts line coverage back to 100%.
The delete operator could throw a TypeError when attempting to
remove a non-configurable property, which is rare in practice since
they can only be created using `Object.defineProperty()` and
`Object.freeze()`. We also never uses the output of `del()` anyway.
2019-03-30 17:12:50 -07:00
Thomas Ip
bec31c6791 coverage: Get Istanbul to recognise typescript modules. 2019-03-30 17:12:50 -07:00
sameerchoubey
19b96b4e0b api_docs/send-message: Specify request command in curl example.
This commit is related to #11927.
2019-03-27 20:58:44 -02:30
Marco Burstein
feadc8bf46 portico: Fix trapsarent gradient styling inconsistencies.
Instead of using the `trapsarent` keyword, which is interpreted
as Safari as black with an opacity of 0%, re-use the gradient colors
themselves in order to lead to a single color gradient. This allows
for the homepage to look the same regardless of browser.

Fix #11985.
2019-03-25 16:25:58 -07:00
Abhinav Singh
62d9241c03 refactor: Remove inline javascript code from accounts_send_confirm.html.
This commit removes inline javascript code present in
accounts_send_confirm.html and moves it to signup.js. This page is
rendered when the "/accounts/send_confirm" endpoint is visited. An
empty div element is added in accounts_send_confirm.html with
unique data-page-id attribute to make it more easy to find in which
page we are, while working with the javascript code.
2019-03-25 15:14:24 -07:00
Abhinav Singh
4b8f6b55be refactor: Remove inline javascript code from reset_confirm.html.
This commit removes inline javascript code present in reset_confirm.html
and moves it to signup.js. The reset_confirm.html page is rendered when
the user visits "/accounts/password/reset" confirmation page. An empty
div element is added in reset_confirm.html with unique data-page-id
attribute to make it more easy to find in which page we are, while
working with the javascript code.
2019-03-25 15:14:24 -07:00
Abhinav Singh
17d9c24094 refactor: Remove inline javascript code from reset.html.
This commit removes inline javascript code present in reset.html and
moves it to signup.js. The reset.html page is rendered when the user
visits "/accounts/password/reset". An empty div element is added in
reset.html with unique data-page-id attribute to make it more easy
to find in which page we are, while working with the javascript code.
2019-03-25 15:14:24 -07:00
Abhinav Singh
d52e3b0d70 refactor: Remove inline javascript code in dev_login.html.
A new javascript file "dev-login.js" is created in static/js/portico/
and the inline javascipt code present in dev_login.html is transferred
to that file. An empty div element is added in dev_login.html with
unique data-page-id attribute to make it more easy to find in which
page we are, while working with the javascript code.
2019-03-25 15:14:24 -07:00
Abhinav Singh
65d9d017c3 refactor: Remove inline javascript code from create_realm.html.
This commit removes inline javascript code present in create_realm.html
and moves it to signup.js. The create_realm.html page is rendered when
the user visits "/new". An empty div element is added in
create_realm.html with unique data-page-id attribute to make it more easy
to find in which page we are, while working with the javascript code.
2019-03-25 15:14:24 -07:00
Abhinav Singh
2a14fcf3e9 refactor: Remove inline javascript code from accounts_home.html.
This commit removes inline javascript code present in
accounts_home.html and moves it to signup.js. The accounts_home.html
page is rendered when the user visits "/register". An empty div
element is added in accounts_home.html with unique data-page-id
attribute to make it more easy to find in which page we are, while
working with the javascript code.
2019-03-25 15:14:24 -07:00
Abhinav Singh
4efef4f1a5 refactor: Remove inline javascript code from login.html.
This commit removes inline javascript code present in login.html and
moves it to signup.js. An empty div element is added in login.html
with unique data-page-id attribute to make it more easy to find in
which page we are, while working with the javascript code.
2019-03-25 15:14:24 -07:00
Nikhil-Vats
38be5ea743 message_edit_history: Add UI for seeing topic edits.
Users can previously see only message content edits, this will enable
them to see topic edits too in the same section, fixes #3731.

Fixes #3731.
2019-03-25 15:10:47 -07:00
Tim Abbott
54915b76c7 urls: Clarify comment explaining /accounts/login URLs. 2019-03-25 14:12:51 -07:00
Hemanth V. Alluri
8239a3514a context_processors: Extract keys from zulip_default_context.
Previously, we had some expensive-to-calculate keys in
zulip_default_context, especially around enabled authentication
backends, which in total were a significant contributor to the
performance of various logged-out pages.  Now, these keys are only
computed for the login/registration pages where they are needed.

This is a moderate performance optimization for the loading time of
many logged-out pages.

Closes #11929.
2019-03-25 14:05:36 -07:00
Thomas Ip
a2872c107e typescript: Move TS files into JS directory.
This is just a code reorganization to avoid making it difficult to
find things as we migrate more file to TypeScript.
2019-03-25 12:11:37 -07:00
Hemanth V. Alluri
9ed1dcc4b6 webhooks: Add Bitbucket Server integration.
This commit adds support for all "repo" events.
2019-03-24 22:06:29 -02:30
ruchit2801
33b064aa29 documentation: Add missing link to upgrade-zulip-from-git. 2019-03-22 09:22:18 -07:00
Anders Kaseorg
324b1d52cb modals: Replace modal dialog scale transition with short slide.
This works better with SimpleBar (see
https://github.com/Grsmto/simplebar/issues/274).

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-03-21 17:27:45 -07:00
Tim Abbott
ca04b4f243 settings: Move production noreply templates.
These previously lived in Optional settings, which generally caused
users to not read it.

(Also do a bit of reorganization of the "optional settings" area).
2019-03-21 17:10:11 -07:00
Vishnu Ks
34b8626959 help: Increase the width of sidebar scrollbar. 2019-03-21 16:57:25 -07:00
Vaibhav
e2115ad0ba refactor: Nest night-mode syntax highlighting rules into body.night-mode.
Rather than using the parent selector multiple times, all the rules
are nested inside one selector.
2019-03-21 16:51:40 -07:00
Vaibhav
46b2d9d328 markdown_docs: Fix styling for in-app docs for inline code.
This adds a selector `#message-formatting` which is basically the
modal id to apply night mode style to inline code in the modal.
2019-03-21 16:51:40 -07:00
Vaibhav
10651d74c1 markdown_docs: Fix styling for in-app docs for code-blocks.
This wraps the `pre` with a `div.codehilite` so as to apply the
night mode styles.
2019-03-21 16:51:40 -07:00
Tim Abbott
0d04724da6 docs: Clarify push notification service privacy model.
This just makes what was already said there a lot more explicit.
2019-03-21 16:49:10 -07:00
Tim Abbott
3da06fecd5 invite: Fix validation of referred_by field.
Previously, we could 500 if an organization administrator scanned
possible PreregistrationUser IDs looking for a valid invitation they
can interact with.

They couldn't do anything, so no security issue, but this fixes that
case to just be a 400 error as it should be.
2019-03-21 16:31:18 -07:00
Tim Abbott
1599625328 mypy: Add an explicit assert to check_message. 2019-03-21 16:31:18 -07:00
neiljp (Neil Pilgrim)
584bec70c7 i18n: Log error & return "Unknown" if invalid code in get_language_name.
Previously this could return None.
2019-03-21 15:32:13 -07:00
Mateusz Mandera
c7c1dbec60 email_mirror: Raise ZulipEmailForwardError if email pattern not recognised.
With the previous commit, fixes #1836.

As specified in the issue above, we make
get_email_gateway_message_string_from_address raise an exception if
it doesn't recognise the email gateway address pattern. Then, we make
appropriate adjustments in the codepaths which call this function.
2019-03-21 15:25:57 -07:00
Mateusz Mandera
e32c444ecf email_mirror: Move some helper functions out of actions.py.
These functions don't really belong in actions.py, so we move them out,
into email_mirror_helpers.py. They can't go directly into
email_mirror.py or we'd get circular imports resulting in ImportError.
2019-03-21 15:25:57 -07:00
Pragati Agrawal
2e67cf38b3 composebox_typeahead: Remove unnecessary string operation.
slice always returns a new string, so this could have been motivated
by ensuring we always duplicate the string, but reading the code, it's
already sliced by the caller.
2019-03-21 13:33:27 -07:00
Pragati Agrawal
f617008924 typeahead_helper: Add sorter function for slash commands.
This adds a `sort_slash_commands` function in typeahead_helper to sort
slash commands.
2019-03-21 13:33:27 -07:00
Pragati Agrawal
76a35bf1d9 typeahead: Add typeahead for slash commands.
This is the follow-up of PR #10267.
Here, we add typeahead for slash commands `/me` and `/poll` in compose box.

The slash typeahead will open only when `/` is the first character and all
slash commands will be displayed when one types `/`, as this helps a lot in
discoverability. This also adds a description of what the slash command
does in the typeahead.
2019-03-21 13:33:27 -07:00
Eeshan Garg
68877dba50 webhooks/bitbucket: Support empty push payloads with no user info. 2019-03-21 17:43:35 -02:30
Rishi Gupta
b47e6d0d94 help: Add status-and-availability. 2019-03-21 12:56:38 -07:00
Rishi Gupta
ab6aac60a8 help: Make minor updates to People section. 2019-03-21 12:56:38 -07:00
Rishi Gupta
998d0b70ed help: Update Reading Messages section to conform to style guide. 2019-03-21 12:56:38 -07:00
Rishi Gupta
d40da5269d help: Update view-and-browse-images. 2019-03-21 12:56:38 -07:00
Rishi Gupta
1ae36975e4 help: Update stream recommendations for new org admins. 2019-03-21 12:39:46 -07:00
Rishi Gupta
6c2c351894 onboarding: Update initial messages and stream descriptions. 2019-03-21 12:34:24 -07:00
Rishi Gupta
52fb22277b onboarding: Remove get_newbie_stream from stream_data.js.
A relic of a past system removed in
9fbd990d1a. It is not being called
anywhere in the code.
2019-03-21 12:34:16 -07:00
Rishi Gupta
a914b86694 onboarding: Simplify get_turtle_message. 2019-03-21 12:33:32 -07:00
Rishi Gupta
e8741c448d refactoring: Move set_default_streams into do_create_realm.
After the commits leading up to this, the only meaningful use of this
function was in the realm creation process.
2019-03-21 12:33:19 -07:00
Rishi Gupta
e527de3937 management: Remove set_default_streams.py.
We now support this directly in the realm admin UI.
2019-03-21 12:31:03 -07:00
Rishi Gupta
e71a1a2b4e onboarding: Remove initial streams other than general and core team.
The hope is that by having a shorter list of initial streams, it'll
avoid some potential confusion confusion about the value of topics.
At the very least, having 5 streams each with 1 topic was not a good
way to introduce Zulip.

This commit minimizes changes to the message content in
`send_initial_realm_messages` to keep the diff readable. Future commits will
reshape the content.
2019-03-21 12:30:14 -07:00
Rishi Gupta
d46b125bf2 onboarding: Change default notifications stream to #general. 2019-03-21 12:29:51 -07:00
Thomas Ip
7d050ab0cf typescript: Migrate dict.js to typescript. 2019-03-21 10:48:44 -07:00
Thomas Ip
a290333325 typescript: Register ts-node to run TS modules in frontend tests. 2019-03-21 10:47:27 -07:00
Thomas Ip
676eafae7e typescript: Declare untyped JS modules. 2019-03-21 10:44:34 -07:00
Thomas Ip
42a666c22b dependencies: Downgrade ts-node to v7.0.1.
The current v8.0.0^ has a slow startup time due to some module
resolution issue.
2019-03-21 10:44:34 -07:00
Shubham Dhama
238885ca86 settings_users: Remove meta.current_deactivate_user_modal_row workaround.
The removes meta.current_deactivate_user_modal_row workaround by a more
readable and clear way.
2019-03-20 22:34:57 -07:00
Shubham Dhama
7ab0c26bda settings_users: Refactor some code for deactivate button. 2019-03-20 22:34:57 -07:00
Shubham Dhama
41140f2e46 settings_users: Use update_view_on_deactivate to update deactivate view.
This removes the function update_button_on_success as the action performed
by it can be done by update_view_on_deactivate.
2019-03-20 22:34:57 -07:00
Shubham Dhama
f0c069a316 settings_users: Make update_view_on_reactivate function generic.
This also remove:
- meta.current_bot_element: As usage of meta has been wrongly exploited, we
  should refrain us from using meta this way i.e. to share variable between
  function using the global variable, as they reduce code readability.

- update_view_on_deactivate_reactivate_failure: Again to deduplicate the the
  code we're compromising with readability which isn't worth it here, also
  we need to this because we have removed above meta key.
2019-03-20 22:34:57 -07:00
Shubham Dhama
53abbd9408 settings_users: Remove redundant usage of .user-admin-settings.
No class with this name exist in codebase.
2019-03-20 22:34:57 -07:00
Shubham Dhama
42d19ababe settings_users: Fix update_view_on_deactivate to take row as an argument.
We should pass row as an argument to update_view_on_deactivate because we
update deactivate view of a row when the user get activated/deactivated by
the event system.

This also removes a redundant data variable.
2019-03-20 22:34:57 -07:00
Shubham Dhama
96aac91119 settings_users: Fix misleading comment.
This fixes a misleading comment as we want to change the view for both bots
    and users, whose active state is changed.
2019-03-20 22:34:57 -07:00
Shubham Dhama
060eacc980 settings_users: Move update_view_on_reactivate up.
This is done just to make code more readable.
2019-03-20 22:34:57 -07:00
Rishi Gupta
c64b909556 analytics: Add autofocus to /support input box. 2019-03-20 22:28:03 -07:00
Raymond Akornor
d8a2bb2b7c deliver_email: Refactor to extract email delivery.
This is a follow up on #11181. We extract email delivery into
`zerver/lib/send-email.py` to make it cleaner and easy to test.
2019-03-20 14:52:05 -07:00
Tim Abbott
8e92b36cf3 models: Add more documentation for PreregistrationUser. 2019-03-20 14:23:36 -07:00
Tim Abbott
e7cc246d27 actions: Add docstring for do_update_message.
This should help with its readability.
2019-03-20 12:48:47 -07:00
neiljp (Neil Pilgrim)
7b3a9f34b7 mypy: Assert if we do_update_message then we have rendered_content. 2019-03-20 12:48:47 -07:00
neiljp (Neil Pilgrim)
a80617bc70 mypy: Fix color_map default parameter for Optional. 2019-03-20 12:48:43 -07:00
neiljp (Neil Pilgrim)
a40a0312f1 mypy: Correct default=None parameter typing in actions.py. 2019-03-20 12:41:34 -07:00
neiljp (Neil Pilgrim)
3d9c4494f5 mypy: Extract addressee.stream_name() check to satisfy mypy. 2019-03-20 12:41:34 -07:00
Vishnu Ks
d921fd25e4 import: Move SubscriberHandler to import_util. 2019-03-20 11:29:51 -07:00
Vishnu Ks
6e3720e0b7 gitter: Fix minor comment typo in build_userprofile. 2019-03-20 10:12:18 -07:00
Tim Abbott
4f2c9f46bd actions: Improve format for delete events.
There were several problems with the old format:

* The sender was not necessarily the sender; it was the person who did
  the deletion (which could be an organization administrator)
* It didn't include the ID of the sender, just the email address.
* It didn't include the recipient ID, instead having a semi-malformed
  recipient_type_id under the weird name recipient_user_ids.

Since nothing was relying on the old behavior, we can just fix the
event structure.
2019-03-19 23:16:03 -07:00
Eeshan Garg
a6abafa54b python-zulip-api: Upgrade to release 0.6.0. 2019-03-19 20:07:53 -02:30
Tim Abbott
0320355f09 echo: Add a minimum time for sending error spinner.
This at least makes clear that the button did something.
2019-03-19 13:30:46 -07:00
Tim Abbott
a6c0ac44be css: Make message_failed icons always visible.
This fixes the confusing behavior that errors sending messages were
not immediately user-visible.

Based on work by Dominik Gryboś in #11479.

Fixes #10537.
2019-03-19 13:30:28 -07:00
Tim Abbott
9e85478010 css: Fix sizing and height of message_failed error icons.
Inspired by work by Dominik Gryboś in #11479.
2019-03-19 13:30:27 -07:00
Tim Abbott
4ae325ce6c css: Fix alignment of message_controls.
They were 1px too high.
2019-03-19 13:30:27 -07:00
Tim Abbott
f9eeddc78c css: Limit message_failed class to inside message_controls.
This is mostly for readability.
2019-03-19 13:30:27 -07:00
Tim Abbott
8700d14c15 css: Remove unused message_local CSS class.
This is likely a very old legacy feature.
2019-03-19 13:30:27 -07:00
Tim Abbott
36b18cd183 css: Use SCSS nesting for message_controls region. 2019-03-19 13:30:27 -07:00
Tim Wissel
ab6c39c94b bugfix: Hide tooltips when switching a narrow.
Fixes #4639.
2019-03-19 12:28:39 -07:00
Tim Abbott
38de5740fa integrations: Reduce excessive margin below sidebar headings.
This just didn't look good.
2019-03-19 11:08:51 -07:00
sameerchoubey
2efe1963a5 portico: Add /api links to /integrations.
This PR creates a custom section on the /integrations page and adds
links to /api for common requests.

Fixes #11803.
2019-03-19 11:08:38 -07:00
Zach Wener-Fligner
ab15cd13a6 docs: Modify dev SSL/certbot setup docs to match script.
The docs specify passing hostname with the --hostname flag, which
doesn't match the actual usage in scripts/setup/setup-certbot. This
change fixes the docs to match the actual usage.
2019-03-19 10:45:53 -07:00
Tim Abbott
b1da797955 puppet: Make uwsgi buffer size configurable. 2019-03-18 22:43:59 -07:00
Pragati Agrawal
9037ef56dc org_settings: Disable Deactivate button for yourself in Users tab.
This disables the Deactivate button for the current user in the Users tab,
so that it becomes hard to deactivae yourself accidently from Users tab.

Fixes #10427.
2019-03-18 22:41:09 -07:00
Anders Kaseorg
8b76a55b16 dependencies: Upgrade simplebar to 3.1.3.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-03-18 22:24:29 -07:00
Hemanth V. Alluri
261166f96d context_processors: Cache the realm description in default context. 2019-03-18 22:19:18 -07:00
Tim Abbott
6e8e7feffc settings: Fix webapp password change UI.
Apparently, this has been broken since
dee4e3fb89, due to the beforeSend code
here overriding the default beforeSend function that sets the CSRF
token.  The correct fix was actually to just run the relevant code
directly before the channel.patch call.

Fixes #11938.
2019-03-18 22:14:04 -07:00
vipul chhabra
958126733b message view: Fix The unexpected behavior of Youtube Thumbnail.
It is observed in Mozilla margin was considered from other side of thumbnail
due to some special padding issues observed in mozilla.

To fix this top and left value are assigned to 0 so that it automatically
takes its correct position in all browsers

Fixes #11867.
2019-03-18 13:19:59 -07:00
Thomas Ip
da6fb98d21 typescript: Set appropriate compiler options.
* Make type-checking stricter.
* Use more modern features.
2019-03-18 12:49:47 -07:00
Tim Abbott
4f628fd945 docs: Discuss replacing memcached with redis more clearly.
This is a common question we get in architecture discussions.
2019-03-18 12:40:53 -07:00
Tim Abbott
58ca1ba5a4 models: Disable caching of supported_auth_backends for now.
This seems to be causing hard-to-debug test failures.
2019-03-18 11:29:05 -07:00
Mateusz Mandera
5f88406133 rate_limit tests: Cover RateLimiterLockingException case in rate_limit_user. 2019-03-18 11:16:58 -07:00
Mateusz Mandera
1a3297d122 email_mirror: Make send_to_email_mirror.py use mirror_email_message.
We change the send_to_email_mirror management command, to send messages
to the email mirror through the mirror_email_message function instead of
process_message - this makes the message follow a similar codepath as
emails sent into the mirror with the postfix configuration, which means
going through the MirrorWorker queue. The reason for this is to make
this command useful for testing the new email mirror rate limiter.
2019-03-18 11:16:58 -07:00
Mateusz Mandera
1901775383 email_mirror: Add realm-based rate limiting.
Closes #2420

We add rate limiting (max X emails withing Y seconds per realm) to the
email mirror. By creating RateLimitedRealmMirror class, inheriting from
RateLimitedObject, and rate_limit_mirror_by_realm function, following a
mechanism used by rate_limit_user, we're able to have this
implementation mostly rely on the already existing, and proven over
time, rate_limiter.py code. The rules are configurable in settings.py in
RATE_LIMITING_MIRROR_REALM_RULES, analogically to RATE_LIMITING_RULES.

Rate limit verification happens in the MirrorWorker in
queue_processors.py. We don't rate limit missed message emails, as due
to using one time addresses, they're not a spam threat.

test_mirror_worker is adapted to the altered MirrorWorker code and a new
test - test_mirror_worker_rate_limiting is added in test_queue_worker.py
to provide coverage for these changes.
2019-03-18 11:16:58 -07:00
Mateusz Mandera
386813f42b test_queue_worker: Clean up test_mirror_worker.
We clean up test_mirror_worker for more readability, as well as make it
verify that mirror_email gets called the correct amount of times and use
a correct rcpt_to address, so that the test doesn't fail when some
verification of the address is added in the following commits
implementing rate limiting in the email mirror.
2019-03-18 11:16:58 -07:00
Mateusz Mandera
5b86734178 email_mirror: Change stream name encoding in mirror addresses.
Fixes #9840.

Old addresses caused bugs in some cases with non-latin characters in
stream names (see issue number above). We switch to using django's
slugify helper function to convert stream names to full ascii, while
also getting rid of problematic non-alphanumeric characters, in a
reasonable way. See Django's documentation for slugify to see more about
how this function works.

Tests extended by tabbott to cover cases where we do end up with ascii.
2019-03-18 11:14:22 -07:00
Mateusz Mandera
a64a075ff1 email_mirror: Ignore stream_name part of receiving address.
To prepare for changing how the stream name gets encoded into mirror
email addresses while making sure old addresses keep working, we ignore
the stream_name part when receiving emails into the mirror and we only
look at the email_token to identify into which stream to mirror the
email.
2019-03-18 11:06:51 -07:00
Tim Abbott
898798a352 email_log: Fix buggy use of get_realm_stream.
I'm surprised that this wasn't a mypy error; we were passing a Realm
object as an integer, and predictably, this resulted in us
constructing a cache key that looked like this:

stream_by_realm_and_name:<Realm: zulip 1>:dd5...
2019-03-18 10:59:30 -07:00
Tim Abbott
51eeb0a3ee cache: Add missing : in test-backend key prefixes.
Previously, these cache keys looked like:
:1:9c26164d3a393e316e0f8210efe270e08710d45astream_by_realm_and_name:...

Now, they look like this:
:1:9c26164d3a393e316e0f8210efe270e08710d45a:stream_by_realm_and_name:...
2019-03-18 10:56:50 -07:00
Tim Abbott
5d20138d72 context_processors: Optimize calculation of social_backends.
This avoids a bunch of duplicated calls to auth_enabled_helper for our
social auth backends, which added up because auth_enabled_helper can
take 100us to run.
2019-03-17 15:20:36 -07:00
Tim Abbott
a9350caee2 context_processors: Optimize calculation of no_auth_enabled.
This saves an unnecessary call to auth_enabled_helper.
2019-03-17 15:19:06 -07:00
Tim Abbott
b4d47b129d backends: Further optimize auth_enabled_helper.
This avoids repeatedly calling a Django auth function that takes a few
hundred microseconds to run in auth_enabled_helper, which itself is
currently called 14 times in every request to pages using
common_context.
2019-03-17 15:14:06 -07:00
Tim Abbott
cb78ddc491 models: Fix performance of supported_auth_backends with caching.
See the comment, but this is a significant performance optimization
for all of our pages using common_context, because this code path is
called more than a dozen times (recursively) by common_context.
2019-03-17 15:14:05 -07:00
Tim Abbott
79ae9175bb context_processors: Avoid useless duplicate queries for realm object.
We have a few code paths that call get_realm_from_request multiple
times on the same request (e.g. the login page), once inside the view
function and once inside the common context processor code.  This
change saves a useless duplicate database query in those code paths.
2019-03-17 14:08:53 -07:00
Tim Abbott
f270e354b1 login: Fix unnecessary queries on /login/ in development.
This block of code with 2 database queries is solely for the /devlogin
endpoint.  Removing that block from the /login code path makes it
easier to test /login perf in development.
2019-03-17 14:03:57 -07:00
Tim Abbott
0a7b6909b9 login: Fix a useless query with DevAuthBackend.
This block was setting `realm` to a value that it already was if you
read a bit further up in the function.
2019-03-17 14:03:27 -07:00
Hemanth V. Alluri
1269b72f47 context_processors: Do not render inline previews for realm description.
We never intended to render them for this use case as the result would
not look good, and now we have a convenient bugdown option for
controlling this behavior.

Since we're not storing the markdown rendering anywhere, there's
conveniently no data migration required.

Fixes #11889.
2019-03-17 13:55:10 -07:00
Rhythm Sharma
e1212c04d1 emoji: Add a few useful aliases. 2019-03-17 13:38:31 -07:00
Mateusz Mandera
a269c4bdd4 email_mirror: Make email_token a unique column of Stream. 2019-03-17 12:55:35 -07:00
Eeshan Garg
623ee15bee webhooks/bitbucket: Account for missing user info.
According to our logs, some BitBucket enterprise payloads may
not contain the name of the user who pushed all the commits.
2019-03-16 15:09:03 -02:30
sameerchoubey
a47edd4fc8 webhooks/jira: Use dictionary to map events to functions. 2019-03-16 14:27:00 -02:30
Rishi Gupta
ee2af16dc9 help: Fix wording in set-your-profile-picture. 2019-03-15 14:13:50 -07:00
Steve Howell
0c029fa3df left sidebar: Remove broken animation for new PMs.
When new PMs came in, we would do a little
animation to show you the incoming message.
Unfortunately, it was broken and would animate
too many things.  (The code looks at a single
var to see if PM counts changed, but there are
actually mulitple PM counts.  We could fix that,
but we decided that this feature just isn't
worth the complexity.)

We still animate incoming mentions.

Fixes #11868.
2019-03-15 13:33:11 -07:00
Ben Muschol
243be91a9b settings: use i18n.t on profile picture upload message.
This fixes a small bug where the text previously was not being looked
up for translation.
2019-03-15 13:30:18 -07:00
Ben Muschol
d526ff00f2 settings: Rename "user avatar" to "profile picture"
This renames references to user avatars, bot avatars, or organization
icons to profile pictures. The string in the UI are updated,
in addition to the help files, comments, and documentation. Actual
variable/function names, changelog entries, routes, and s3 buckets are
left as-is in order to avoid introducing bugs.

Fixes #11824.
2019-03-15 13:29:56 -07:00
Tim Abbott
cfbe316215 version: Update version and changelog for Zulip 2.0.2 release. 2019-03-15 12:25:50 -07:00
vsvipul
a41ada3398 image-action: Fix open and download hover highlight in night mode.
When we try to hover over Open or Download they were not highlighted
in night mode, because of incorrect specificity. This commit adds
highlighting in night mode (possibly fixing a regression when we made
night mode less aggressive about hover).

Fixes #11887.
2019-03-15 11:27:01 -07:00
Tim Abbott
0a145f2203 test_email_notifications: Fix a potentially flaky test.
The previous code assumed the `zulip` realm had ID 1.
2019-03-15 11:02:17 -07:00
Tim Abbott
c7ebfdc978 notifications: Rename test_notifications to test_email_notifications.
Similar to the last commit, this makes the scope of this test suite
clearer.
2019-03-15 11:02:17 -07:00
Tim Abbott
50dc317466 notifications: Rename notifications.py to email_notifications.py.
This library is entirely about email notifications specifically, and
this rename should help make the codebase more readable.
2019-03-15 11:02:17 -07:00
Tim Abbott
28a4c143c8 emails: Move clear_scheduled_*emails to send_email.py.
It more properly belongs as part of our outgoing email library, not
notifications.py (which is really about email notifications).
2019-03-15 11:02:17 -07:00
Raymond Akornor
89351cdd19 send_email: Add ScheduledEmail support for multiple recipients.
Follow up on 92dc363. This modifies the ScheduledEmail model
and send_future_email to properly support multiple recipients.

Tweaked by tabbott to add some useful explanatory comments and fix
issues with the migration.
2019-03-15 11:02:12 -07:00
Tim Abbott
8e1dff708e apps: Simplify rendering logic using $.toggle. 2019-03-15 10:11:39 -07:00
theredcap
3aa16dcd73 templates: Add "Download APK" button in apps.html.
This allows user to download the latest version of android apk from
the apps/android.

This will help the users who use Android without Google Play to
download the app and install it with ease.

To implement this I added a Download APK link on the apps.html page
which always points to the latest released version.

Fixes part of #11647.
2019-03-15 10:11:39 -07:00
Anders Kaseorg
bd50c6a152 resize: Don’t hide popovers on mobile resize.
Or on the scroll triggered by that resize.

Then we don’t need a kludge that skips the resize handler in
situations where it might hide popovers.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-03-15 09:52:08 -07:00
AsociTon
87f7a578e6 docs: Document a Windows GitHub Desktop bug.
Add the recommendation in docs for not using GitHub Desktop client for
zulip code as it has a bug of keeping the symlinks disabled and ignoring
any configuration done to re-enable it resulting into failure to identify
the received symlinks leading to failing test cases in the zulip development
environment.
2019-03-15 09:48:28 -07:00
Tim Abbott
b58d3a37a7 stream_data: Add a comment explaining more topics logic. 2019-03-15 09:34:18 -07:00
Steve Howell
ba0418c989 stream_data: Remove untested useless code.
This code was actually dead, due to the .empty() check above.  Fixing
this lets us restore 100% coverage.
2019-03-15 09:27:41 -07:00
Raymond Akornor
ea112828dc mypy: Use python3 type syntax in test-backend. 2019-03-15 09:22:30 -07:00
Raymond Akornor
193de819b8 test-backend: Refactor test-backend to be more pythonic. 2019-03-15 09:22:30 -07:00
Tim Abbott
76891f6a02 node: Disable a failing coverage check. 2019-03-14 22:22:06 -07:00
Challa Venkata Raghava Reddy
8623a02d98 streams: Avoid showing more topics option when it's useless.
This makes the "more topics" option which appears below the list of
known topics in the left sidebar appear only when it's possible there
are actually more topics to be displayed.  Two specific cases it
resolves completely include:

* Newly created realms; this widget was a common source of confusion
  for new organization administrators.
* Newly created streams.

There are still some corner cases this doesn't handle, e.g. if you
just joined a private stream with protected history, but there isn't
as easy a fix for those.

Essentially rewritten by tabbott to fix code duplication and comment
extensively.

Fixes #10265.
2019-03-14 21:51:24 -07:00
Pragati Agrawal
2ccf5655da realm_logo: Refactor build_realm_logo_widget function.
As a follow up of commit (bf1c9420df), this
commit removes the `build_realm_day_mode_logo_widget` and
`build_realm_night_mode_logo_widget` function , and changes
`build_realm_logo_widget` to take single argument `is_night` and depending
on this argument, corresponding `day mode` or `night_mode` widget is
handled.
2019-03-14 17:05:22 -07:00
Abhishek Kumar Singh
32853a565f portico: Fix the partial visibility of zulip-octopus on landing page.
The image zulip-octopus.png was not fully visible on the
landing-page due to lesser width thus resulting into an incomplete
image.
2019-03-14 15:31:10 -07:00
vinitS101
ead9598fbe user status: Change Active now to Online now in full user profile.
Change "Active now" to "Online now" in Last seen field of
full user profile.
2019-03-14 15:19:09 -07:00
vinitS101
e90ed827bb user status: Change Last seen to Last online.
Change "Last seen" to "Last online" in the full user profile.
2019-03-14 15:19:09 -07:00
Steve Howell
64de28eb68 refactor: Make build_stream_popover more generic.
We now let the click handler find the stream id.
2019-03-14 15:06:41 -07:00
Tim Abbott
4f02795830 home: Fix parsing bug for initial narrows.
There's more we'll want to do here, but this at least avoids error
emails when users attempt to misuse this interface.
2019-03-14 14:53:03 -07:00
Abhinav Singh
8fbba64377 emoji: Allow users to add emoji or react in mobile browsers.
It was impossible to add emoji to the message or to react on other's
message in mobile browsers because emoji popover used to get closed
due to the resize event being fired by the virtual keyboard. This
commit solves this issue by ignoring the resize event when the user
is trying to use emoji popover.

Fixes #11448.
2019-03-14 14:50:26 -07:00
Steve Howell
695399322b css: Don't underline topics when we hover them.
We generally don't combine underline effects and
hover backgrounds.

We also remove some CSS related to underlines that
was overridden.
2019-03-14 13:54:38 -07:00
Steve Howell
ee9612c927 css: Hover individual topic rows.
Hovering the entire block was confusing.
2019-03-14 13:54:35 -07:00
Steve Howell
c2858f1c64 css: Fix hover for "Private messages".
It's ugly to hover the entire block--just hover the individual
rows.
2019-03-14 13:52:50 -07:00
Steve Howell
aae3f8a04a css: Fix blue highlights for Private Messages.
We have this strange business requirement that the
blue-ish highlights for the current PM go into the
left gutter and all the way to the right edge.

We also have markup that treats the list of PMs
as a list inside the list item for the "Private
messages", which makes sense logically.

Before this change, the padding was done for the
outer top-left `ul`, but that caused the inner PM
rows not to have that padding when you hovered them.

Now we pad each individual list item and/or inner
list item or div.

Fixes #11879.
2019-03-14 13:52:39 -07:00
Steve Howell
837801ed21 css: Tweak hover color in day mode.
(The new color here shows up better against the
background.  Rishi Gupta provided the new color.)

This only affects day mode.
2019-03-14 13:52:27 -07:00
Steve Howell
10f9b9c616 minor: Change markup for icon fonts.
I am trying to phase out the confusing global-filter
name.
2019-03-14 13:50:09 -07:00
Steve Howell
8efd5a72ec minor: Remove unused padding.
This is overridden in all cases.
2019-03-14 13:50:09 -07:00
Steve Howell
36fb6cd2b2 minor: Remove unused CSS for global-filter. 2019-03-14 13:50:09 -07:00
Tim Abbott
983e24a7f5 auth: Use HTTP status 404 for invalid realms.
Apparently, our invalid realm error page had HTTP status 200, which
could be confusing and in particular broken our mobile app's error
handling for this case.
2019-03-14 13:50:09 -07:00
Puneeth Chaganti
d75d2c9974 soft-deactivation: Run catch-up when "auto" deactivate is run.
When soft deactivation is run for in "auto" mode (no emails are
specified and all users inactive for specified number of days are
deactivated), catch-up is also run in the "auto" mode if
AUTO_CATCH_UP_SOFT_DEACTIVATED_USERS is True.

Automatically catching up soft-deactivated users periodically would
ensure a good user experience for returning users, but on some servers
we may want to turn off this option to save on some disk space.

Fixes #8858, at least for the default configuration, by eliminating
the situation where there are a very large number of messages to recover.
2019-03-14 11:53:15 -07:00
Puneeth Chaganti
c61d3420e8 soft-deactivation: Extract getting users from emails to a function. 2019-03-14 20:57:00 +05:30
Puneeth Chaganti
f5c61e7d31 soft-deactivation: Patch logging.info to clean up test output. 2019-03-14 09:26:25 +05:30
Puneeth Chaganti
ff07ca7417 soft-deactivation: Slightly improve the test for catching up users. 2019-03-14 09:26:06 +05:30
Vaibhav
d285f67afe copy_and_paste: Fix copy/paste behaviour on Firefox.
Firefox and Chrome handle selection of multiple messages differently. FF
creates multiple Ranges and Chrome creates one. Code written previously
terminated when we got an empty Range or Range with same starting and ending
message. This behaviour was incorrect since the selection was valid.

* Check for same message is done after looping through all the ranges now.
* `construct_copy_div` is called once since it is much easier to determine
  start_id and end_id with confidence and this avoids any overlap between
  same message ids.

Extended by tabbott to include a ton of comments on how this works.

Fixes #11805.
2019-03-13 17:37:26 -07:00
Puneeth Chaganti
cf65136002 soft-deactivation: Add code to catch up soft deactivated users. 2019-03-13 17:23:14 -07:00
Puneeth Chaganti
52afbe5e8d soft-deactivation: Rename maybe_catch_up_soft_deactivated_user.
Rename `maybe_catch_up_soft_deactivated_user` to
`reactivate_user_if_soft_deactivated`.
2019-03-13 17:16:22 -07:00
Puneeth Chaganti
7f06f6bd73 soft-deactivation: Raise exception with all missing emails at once. 2019-03-13 17:16:22 -07:00
Puneeth Chaganti
82d9789d93 soft-deactivation: Paginate bulk creation of UserMessage rows.
A user who has been soft deactivated for a long time might have 10Ks of message
history that was "soft deactivated". It might take a minute or more to add
UserMessage rows for all of these messages, causing timeouts. So, we paginate
the creation of these UserMessage rows.
2019-03-13 17:16:22 -07:00
Puneeth Chaganti
8c5a0f585b soft-deactivation: Clarify that value being fetched is recipient_id. 2019-03-13 17:16:22 -07:00
Puneeth Chaganti
4d77ffe2cb soft-deactivation: Refactor fetching list of existing UserMessages. 2019-03-13 17:16:22 -07:00
Puneeth Chaganti
8c5425e33a soft-deactivation: Remove unnecessary select_related calls.
It will become more clear in the upcoming commits, but these calls
aren't actually useful as we're only extracting a few IDs.
2019-03-13 17:15:50 -07:00
Harshit Bansal
262eb42b77 auth: Reverse the sort_order parameter's semantics.
This will make sure that if a backend doesn't specify a values for
`sort_order` parameter then it will sorted to the bottom not at the
top.
2019-03-13 14:44:57 -07:00
Tim Abbott
412d35900f slack import: Fix handling of tombstone files.
Apparently, the mode attribute is not always present.
2019-03-13 14:39:20 -07:00
Tim Abbott
76a06c8e54 send_test_email: Clean up output and provide advice.
Previously, while we sent emails using both noreply addresses, we
didn't make clear what was going on, leading to some potential
confusion.
2019-03-13 14:27:52 -07:00
Tim Abbott
662fa037f2 events: Don't assume that streams/subscriptions were requested.
This fixes a bug in our race condition handling in the case that
streams and/or subscriptions register content was not requested by the
client.
2019-03-13 14:12:59 -07:00
Tim Abbott
cdf987fb14 push-translations: Run manage.py makemessages first.
This saves an extra step in pushing translations to transifex, with no
real negative side effects.
2019-03-13 14:11:27 -07:00
Tim Abbott
c5a2bb2c8b i18n: Update translation data from Transifex. 2019-03-13 14:10:09 -07:00
Tim Abbott
4694de31c5 tests: Fix linter error in test_management_commands. 2019-03-13 14:06:46 -07:00
Tim Abbott
49680a4503 slack import: Skip processing tombstone files.
The tombstone files undocumented feature of Slack's export format
appears sometimes and has no real data, so we just need to skip these.

Fixes #11619.
2019-03-13 12:43:11 -07:00
Hemanth V. Alluri
99c3e2ecdc management: Support sending custom headers when testing a webhook.
this commit adds an option to specify custom headers when using the
`./manage.py send_webhook_fixture_message` tool.
2019-03-13 12:40:47 -07:00
vsvipul
e859ab7545 portico: Fix broken electron check condition for password reset.
This logic for passing through whether the user was logged in never
worked, because we were trying to read the client.

Fix this, and add tests to ensure it never breaks again.

Restructured by tabbott to have completely different code with the
same intent.

Fixes #11802.
2019-03-12 11:25:29 -07:00
Harshit Bansal
a6e523f9e4 ldap: Ensure email is valid for realm before registering.
Previously, the LDAP authentication model ignored the realm-level
settings for who can join a realm.  This was sort of reasonable at the
time, because the original LDAP auth was an SSO solution that didn't
allow multiple realms, and so one could fully configure authentication
settings on the LDAP side.  But now that we allow multiple realms with
the LDAP backend, one could easily imagine wanting different
restrictions on them, and so it makes sense to add this enforcement.
2019-03-12 11:09:18 -07:00
Anders Kaseorg
fd6f18f7cf nginx: Improve TLS settings based on Mozilla config generator.
Lengthen the session timeout and enlarge the session cache.  Upgrade
Diffie-Hellman parameters from fixed 1024-bit to custom 2048-bit.
Enable OCSP stapling.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-03-11 23:40:34 -07:00
Siddharth Varshney
0d25baedfa compose: Fix narrow button text when switching to PM.
This changes the "new private message" button to be instead "new
conversation" when looking at PMs, to avoid confusion that the button
was the right thing to do to reply to the current private message
conversation.

Fixes #11679.
2019-03-11 21:58:05 -07:00
Anders Kaseorg
aad61c42a3 css: Replace generated U+202A LEFT-TO-RIGHT EMBEDDING with CSS properties.
These generated characters (added in #9889) were causing poor wrapping
behavior, at least in Firefox.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-03-11 17:12:53 -07:00
Steve Howell
597c812300 refactor: Use a Dict to track active topic widgets.
Even though there are only ever zero or one active
topic widgets in our current sidebar, it's almost the
same amount of code to just manage them with a Dict.

Also, we can more easily do possible future features
like setting streams to be always-open.
2019-03-11 15:49:44 -07:00
Challa Venkata Raghava Reddy
b69aec2dbc streams: Add first_message_id tracking first message in stream.
This field is primarily intended to support avoiding displaying the
"more topics" feature in new organizations and streams, where we might
know that all messages in the stream are already available in the
browser.

Based on original work by Roman Godov, and significantly modified by
tabbott.

The second migration involved here could be expensive on Zulip Cloud,
but is unlikely to be an issue on other servers.
2019-03-11 13:30:49 -07:00
Vishnu Ks
8eeb8280b4 activity: Create interface for doing support operations.
This should grow into a tool that makes it much easier to do common
organization management tasks without using a manage.py shell.
2019-03-11 12:01:11 -07:00
Vishnu Ks
42de9a0c71 analytics: Extract out the function for getting plan name. 2019-03-11 12:01:11 -07:00
Vishnu Ks
ca1276961d billing: Create get_discount_for_realm function. 2019-03-11 12:01:11 -07:00
Vishnu Ks
9671ed7bab subdomains: Extract get_subdomain_from_hostname function. 2019-03-11 12:01:11 -07:00
Vishnu Ks
51dcc5fdde templates: Add django timesince filter to jinja2 filters. 2019-03-11 12:01:11 -07:00
Rohitt Vashishtha
51986c27a5 markdown: Use common testcases for realmfilters in topics and messages.
The actual bug in #11791 was caused by code reverted in
3ed85f4cd7, so technically #11791 is
already fixed.  However, it makes sense to add tests to ensure that it
doesn't regress in the future as part of closing out the issue.

Fixes #11791.
2019-03-11 11:48:47 -07:00
Tim Abbott
c05fb01cbf stream: Fix validator for stream colors.
Apparently, our new validator for stream color having a valid format
incorrectly handled colors that had duplicate characters in them.

(This is caused in part by the spectrum.js logic automatically
converting #ffff00 to #ff0, which our validator rejected).  Given that
we had old stream colors in the #ff0 format in our database anyway for
legacy, there's no benefit to banning these colors.

In the future, we could imagine standardizing the format, but doing so
will require also changing the frontend to submit colors only in the
6-character format.

Fixes an issue reported in
https://github.com/zulip/zulip/issues/11845#issuecomment-471417073
2019-03-11 11:43:39 -07:00
Pragati Agrawal
e630dde240 settings_org: Improve robustness of organization settings.
This moves the configuration of widget type from settings_org to instead
live in respective HTML templates, via `data-widget-setting-type` and we
also remove `get_subsection_property_types` and refactor function
`populate_data_for_request` accordingly.

Fixes: #11708.
2019-03-11 10:58:15 -07:00
Eeshan Garg
222966b6ba webhooks/zapier: Support authentication for the Zapier Zulip app.
If the user sets up a Zap using an incoming webhook bot's API
key, the authentication goes through our webhook.
2019-03-11 10:54:55 -07:00
Eeshan Garg
7b6a37780a webhooks/github: Ignore organization and milestone events.
These events are not super useful and were cluttering up our
webhook logs.
2019-03-10 14:13:17 -07:00
Eeshan Garg
6afd02bef5 webhooks/github: Restrict membership event scope to teams.
According to GitHub's webhook docs, the scope of a membership
event can only be limited to 'teams', which holds true when a
new member is added to a team. However, we just found a payload
in our logs that indicates that when a user is removed from a
team, the scope of the membership is erroneously set to
'organization', not 'team'. This is most likely a bug on
GitHub's end because such behaviour is a direct violation of
their webhook API event specifications. We account for this
by restricting membership events to teams explicitly, at least
till GitHub's docs suggest otherwise.
2019-03-10 14:13:17 -07:00
Tim Abbott
0a17a2acaa docs: Recommend using an SSD for the Zulip database.
This is sorta common knowledge for folks who have managed databases,
but not everyone has.
2019-03-10 13:51:52 -07:00
Pragati Agrawal
9eed78433e node_tests: Refactor test_change_save_button_state in settings_org.
This refactors `test_change_save_button_state` function using ES6 syntax,
to make it more clean and readable.
2019-03-10 13:09:36 -07:00
Pragati Agrawal
36fcb67812 settings_org: Fix visibility time of Saved state.
This fixes the bug where the `Saved` state button faded out almost
instantly (that is actually 300 ms) and `Discard` button fades out
along with `Saved` state button; the key problem here was that the
setTimeout intended to fade was actually delaying the transition from
"saving" to "saved".

Now, first of all, we use `setTimeOut` function to fadeout elements giving
fadeout_delay time as `800 ms` and we hide discard button during `saving`
state. Also, when `Discard` button is selected, `Save changes` and `Dicard`
fade out simultaneously.

Fixes: #11737.
2019-03-10 13:08:57 -07:00
Pragati Agrawal
6a159b5743 settings_org: Refactor change_save_button_state function.
This makes the `change_save_button_state` funtion more clear and readable
by removing too many occurences of `.find()` and `.attr()` function.
2019-03-10 13:07:48 -07:00
Puneeth Chaganti
abc9a7a4f9 digest: Use a list of Message objects to gather_hot_conversations.
Instead of a queryset of UserMessage objects, `gather_hot_conversations` now
accepts a list of Message objects.
2019-03-09 23:25:26 -08:00
Puneeth Chaganti
cb5e9107f4 digest: Directly fetch recipient ids from the DB.
Instead of iterating over Subscriptions and creating the list of home view
recipients, the query now only fetches recipient IDs from the DB.
2019-03-09 23:25:26 -08:00
Harshit Bansal
94649f58f2 tests: Refactor query_ldap() and add complete test coverage. 2019-03-09 22:12:51 -08:00
Harshit Bansal
b519e6594e management: Move query_ldap function to zproject/backends.py.
This will make it simpler to organize and unit-test all of our
authentication backend code.
2019-03-09 22:12:36 -08:00
Tim Abbott
873aca4a82 auth: Add detailed comments for auth subsystem.
Now that we've more or less stabilized our authentication/registration
subsystem how we want it, it seems worth adding proper documentation
for this.

Fixes #7619.
2019-03-09 22:08:13 -08:00
Dominik Grybos
0b02ea4e54 docs: Add troublshooting note for macOS Mojave NFS issues.
Fixes #11546.
2019-03-09 16:49:34 -08:00
Tim Abbott
fac875a922 docs: Eliminate most development manual install docs.
This documentation had a tendency to bitrot, and in any case now that
we have tooling for doing Fedora (etc.) from provision, it's likely
the case that adding other Linux/UNIX distros we care about to
provision would not be difficult and is a better path than maintaining
this manually-curated duplicate of `tools/provision`.

Further, even if this documentation was maintained, one would still
end up wanting to run `provision` after rebasing a branch, so it was
never particularly practical for extended development.
2019-03-09 16:39:06 -08:00
Mayank Madan
264c2e9803 provision: Add provision support for Ubuntu 18.10.
Note that this is only support for Ubuntu 18.10 in the development
environment.
2019-03-09 16:01:46 -08:00
vinitS101
4523c8d7ee typo: Change "generage" to "generate". 2019-03-09 15:49:38 -08:00
Mateusz Mandera
edcb6d57fc email_mirror: Don't remove quotations from forwarded messages.
Addresses point 2 of #10612. We use a regex to detect if a form
of FWD indicator is present at the beginning of the subject, which
means the message has been forwarded.
remove_quotations argument is added to a couple of functions where
it's necessary.
In filter_footer, the criteria for a line to be a possible beginning
of a footer is changed to line.strip() == "--", instead of
line.strip().startswith("--"), because the former would remove
quotations from plaintext emails. This change makes sense, because
RFC 3676 specifies ""-- " as the separator line between the body
and the signature of a message":
https://tools.ietf.org/html/rfc3676
2019-03-09 15:36:17 -08:00
Mateusz Mandera
0633f268fb email_mirror: Move subject processing into process_stream_message.
We remove the 'subject' argument of process_stream_message and make
subject processing happen inside the function, as it's a more
appropriate place than the general process_message function and is
needed to have a good way of disabling removing quotations in forwarded
emails sent into the mirror.
2019-03-09 15:36:17 -08:00
Mateusz Mandera
518ccec235 test_email_mirror: Improve performance of subject stripping tests.
This used to have a single function test_email_subject_stripping which
would run through a sizeable list of example subjects from subjects.json
fixture, form an email with each subject, send it to the email mirror
and check if the resulting stream message has a correctly stripped
topic. That took too much time, because we run through the entire
process_message and most_recent_message codepaths a lot of times.
We change the way of testing to:
1. Ensure process_message applies subject stripping (only need to run
process_message twice here)
2. Test the strip_from_subject function separately, on all the example
from the subjects.json fixtures. This is very fast.
2019-03-09 23:15:41 +01:00
Mateusz Mandera
0d84be8e4b test_email_mirror: Clean up unnecessary use of "type: Any" on MIMEText.
The explanation on those type declarations referenced issue
https://github.com/python/typeshed/issues/275,
which has now been resolved.
2019-03-09 23:15:16 +01:00
Tim Abbott
625c4aaca8 docs: Update recommendations on Vagrant version.
The history of this was that there was a period where half of Vagrant
releases were broken (for everyone, e.g. downloading a base container
didn't work).  It seems Vagrant has cleaned up their act at this point.

We really just want 2.0.x, not a specific version, and the direct
links we had are now quite old.

Thanks to Jonathon Hinchley for reporting this.

Fixes #11836.
2019-03-08 17:34:11 -08:00
Tim Abbott
399aa43c75 night mode: Fix initial state of night mode. 2019-03-08 15:45:11 -08:00
Boris Yankov
3df4990781 cleanup: Remove unnecessary 'magic' style for night mode.
This was introduced in e0236646

For 1.5 years we did not find a case that needed it (besides the
`a` tag hover state, that is not obvious if it was needed or it was
used as an example)

It is not obvious if this solution was a good idea. The concern was
that `body.night-mode` is more specific than `body` and some styles
might override others less specific in cases we might not want that.

Of course, we want that in the majority of cases, and css-specificity
rules are not simple to comprehend.

Good further reading:
http://cssspecificity.com/
https://specificity.keegan.st/

The added complexity of the resulting styles and the added code that
might not serve any practical purpose seem to not be worth it.
2019-03-08 15:27:32 -08:00
Steve Howell
725bdcc384 user popover: Pop user menu closer to avatar.
If you click on the avatar, we now show the menu
right next to the avatar.  The current behavior
is particularly funny for long names.  (I confirmed
this with Rishi.)
2019-03-08 15:24:01 -08:00
Steve Howell
fb750a2656 bug fix: Fix hovers for /me messages.
This fixes several bugs with /me messages:

    * We no longer hover name if you're over
      the message.

    * We now launch the user popup if you
      click on the name.

    * Even if you click on the avatar, we
      launch the user popup to the right
      of the name.  (I think this is odd,
      but it's consistent with how we
      do it for normal messages.)

The underlying problem here is that you have
two possible organizations.

From a logical standpoint, the image and
name go together (and both launch the user menu):

    img Alice | says hi

From a physical perspective, the main message
is "Alice says hi" and it's aligned differently
from the image:

    img | Alice says hi

Our HTML reflects the latter.

HTML doesn't allow overlapping diffs, of course,
so you have to pick your poison.
2019-03-08 15:24:01 -08:00
Steve Howell
45ba971d6d refactor: Move /me complexity out of body template.
One goal of this commit is to just make the "happy
path" code a lot easier to read.  It should be
pretty easy to verify that in this diff.

And then more stuff is now in me_message.

This is a pure code move, and it doesn't fix these
structural issues yet:

    * the "say hi" part of "/me says hi" is
      inside ".message_sender" (due to legacy
      positioning issues)

    * the avatar is outside of .sender-status
      (again due to legacy positioning issue)

    * we don't have sender_info_hover on
      the sender name (which causes it not
      to launch the user menu)
2019-03-08 15:24:01 -08:00
Steve Howell
b00c54ff1c popovers: Remove broken code with 'u" key.
The code that was removed here wasn't doing what it
was intending to do, and we really just want to pop
up the user menu above the currently selected message.
2019-03-08 15:24:01 -08:00
Tim Abbott
0ab8cd9ca3 provision: Refactor handling of dependencies for building pgroonga.
This lets us leave build-pgroonga platform-agnostic.
2019-03-08 15:12:56 -08:00
Tim Abbott
5c20ee998c build-tsearch-extras: Add support for Debian/Ubuntu. 2019-03-08 15:12:56 -08:00
Tim Abbott
32d26c8aad provision: Clean up building search extensions from source.
This generalizes the provision logic for deciding whether to build our
tsearch_extras and pgroonga search extensions from source to support
Ubuntu cosmic as well (and evenutally, other future platforms).
2019-03-08 15:12:56 -08:00
Ben Muschol
bb8bdf9960 linkifiers: Add no-select to trash icon.
This fixes some annoying copy-paste issues we've seen with users
accidentally getting a weird invisible unicode character in their URL
format string when trying to copy-paste an existing linkifier to
use for a new linkifier.

Fixes #10828.
2019-03-08 15:05:05 -08:00
YashRE42
a724a38c03 markdown: Improve handling of broken img urls.
Some urls which end with image file extensions (eg .jpg) may link to
html pages. This adds handling for linx.li, wikipedia.org and
pasteboard.co. If it is possible, we redirect to the actual image url
otherwise we do not attempt to render it as an image.

Fixes #10438.
2019-03-08 13:39:34 -08:00
Tim Abbott
4986f11c67 popovers: Fix clicking on user popover avatar image.
Previously, because our check for whether to close compose for clicks
on the page body was looking at popover-content, not popover, parts of
larger popover-title areas (e.g. the big avatar at the top of the user
popover) did not have the proper click handler behavior.

Also, rearrange the comments to be a bit clearer.
2019-03-08 13:31:29 -08:00
Wyatt Hoodes
98d489a0d5 popovers: Maintain compose box on profile modal close.
The modal-backdrop and user-profile-modal had their on-click behavior
overridden to simply hide the modal, thus preserving the compose box.

Keeping the compose box open after viewing a user's profile feels
like a more natural UX.

Tweaked by tabbott to move the fix into the central click handler.

Fixes: #11585.
2019-03-08 13:31:29 -08:00
Tim Abbott
d63ac71adf node: Fix a node test broken by recent narrowing fix.
The changes in 3baf1f3dbd required some
additions to our test setup code.
2019-03-08 13:31:29 -08:00
Tim Abbott
3baf1f3dbd narrow: Remove "subscribe" button for guests for emptry streams.
This button didn't work, because the backend blocks subscribing, so it
was just confusing.

Fixes an issue reported in #11743.
2019-03-08 13:12:47 -08:00
Casper
f3a4d2df58 search_users: Add | as OR-operator.
Adds possibility for users to use | as an OR-operator (besides ,)
when searching for other users.

This is a thing reasonable folks might try, and | in the thing to
search for isn't a realisitic possibility, so there's no real downside
to adding this.

Fixes #4109.
2019-03-08 12:09:49 -08:00
Steve Howell
504759f432 css: Consolidate some widths in left sidebar.
We now use 10px to the left of major elements in
left sidebar.

And we then explicitly use 19px for the following:

    icons in top left
    indent for (more conversations)
    stream hashtag icons
    stream lock icons

We also kill off 2px of gutter that was caused
by whitespace in the HTML (and was slightly messing
up alignment of names beneath "Private messages").

Finally, we make the topic indent a bit more explicit.
2019-03-08 12:04:20 -08:00
Abhinav Singh
99df926ef3 sidebar: Allow users to use sidebar search in mobile browser.
It was impossible to search people in mobile browsers because virtual
keyboard used to fire resize event and the function call that we used
to handle this event caused the input field to loose focus and this
made it impossible to type in the people search bar.

The code in this commit fixes this by simply ignoring the resize
events when the user wants to search.

Fixes #11795.
2019-03-08 11:37:02 -08:00
Rishi Gupta
4e504e46a1 portico: Fix styling of dropdown menu in nav bar.
The previous gradient must have been from a previous design; it looked kind
of crazy against our current homepage. This widget also appears on /help,
/integrations, and other pages with a variety of different backgrounds, so a
neutral, muted style is probably safest.

The icon change is just because fa-off seems to be broken/missing. Maybe it
was in Font Awesome 3?

The extra padding line is to supercede padding (I assume) unintentionally
added by `.top-links a` to this widget on /help.
2019-03-07 21:28:54 -08:00
Rishi Gupta
aa5770f824 portico: Update screenshots on /apps.
The border radius is a compromise between:
* Windows: no border radius on windows
* Mac: border radius top and bottom
* Ubuntu: border radius only on top

Ideally the image itself would just have border radius matching the OS, but
that's a bit tricky to do in the image editing software I'm using.
2019-03-07 21:03:49 -08:00
Anders Kaseorg
674abdef43 drafts: Fix CSS transition when opening drafts.
The code was all there, but we weren't triggering a style calculation.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-03-07 20:55:02 -08:00
ruchit2801
9f7e90f68b left sidebar: Add an "unstar all messages" option.
In this commit, I've added a feature to unstar all the starred
messages.  This is useful, e.g., for folks who are using starred
messages to keep track of things they should come back when next at
their desktop.

The event flow is the standard one for a feature with a confirmation modal:

(1) User clicks on unstar all messages.

(2) We display a confirmation modal; if the user confirms, we send a
request to the backend to clear all starred messages.

(3) The events system sends that UI update back to us, removing the
stars from the UI.

Fixes #11401.
2019-03-07 20:52:00 -08:00
Tim Abbott
dbf7f8e193 zephyr: Fix handling of account deactivation.
When a Zephyr user deactivates their account, they should be
automatically turned into a mirror dummy user (so that other users can
continue to interact with them as normal for a Zephyr user who isn't
using Zulip).
2019-03-07 20:41:39 -08:00
Vishnu Ks
a288cfc43a uploads: Show used upload space in attachments UI. 2019-03-07 20:18:00 -08:00
Tim Abbott
cc4774f371 docs: Update our language on finding a first issue.
We might want to do another pass on this, but I at least want to
de-emphasize "good first issue" since we're not maintaining that
label.
2019-03-07 20:04:04 -08:00
Tim Abbott
051bbf9f35 docs: Add some more links to new soft deactivation documentation. 2019-03-07 17:48:54 -08:00
Tim Abbott
010c02af09 docs: Add detailed documentation for soft deactivation. 2019-03-07 17:47:04 -08:00
Puneeth Chaganti
8ca4ca1400 digest: Don't update context with data already in common context. 2019-03-07 15:29:51 -08:00
Mateusz Mandera
dbff533e09 email_mirror: Add the sender at the start of stream message.
Fixes part 3 of #10612. When sending an email to the email mirror to a
stream address, if "+show-sender" is added in the address, the stream
message will now include "From: <sender>" at the top.
2019-03-07 14:28:33 -08:00
Pragati Agrawal
60c7467464 test_events: Add test for do_change_logo_source event.
This adds tests for `do_change_logo_source` event in both day as well as
night mode in `test_event.py`.
2019-03-07 12:32:30 -08:00
Tim Abbott
99a2c21ff3 test_events: Fix incorrect usage of get_realm.
The test_events system was in several tests using get_realm to fetch a
realm object, rather than accessing self.user_profile.realm.  This
created subtle problems where we were neither directly editing nor
refreshing the `realm` object associated with our UserProfile object
from the database after our the `do_*` methods.

The payoff for this is we can update the previously confused
`do_change_icon_source` test to actually change the state and have the
correct result.
2019-03-07 12:29:16 -08:00
Pragati Agrawal
095e24c515 realm_logo: Update upload_logo views to return nothing. 2019-03-07 12:12:00 -08:00
Pragati Agrawal
276020445d realm_logo: Make delete_logo_backend views return nothing. 2019-03-07 12:12:00 -08:00
Pragati Agrawal
78e9ad3128 test_upload: Use actions.py do-change functions to change property. 2019-03-07 12:12:00 -08:00
Pragati Agrawal
0192f80d2e org_settings: Remove print statements.
This commit deletes the redundant `print` statement from the
`test_upload.py` file.
2019-03-07 12:12:00 -08:00
Pragati Agrawal
bf1c9420df org_settings: Refactor build_realm_logo_widget function.
This commit deduplicates the code for `build_realm_logo_widget` and
`build_realm_night_logo_widget`. It deduplicates the common code for
`build_realm_day_mode_logo_widget` & `build_realm_night_mode_logo_widget`
into tthe function `build_realm_logo_widget`.
2019-03-07 12:12:00 -08:00
Steve Howell
1b065d811a me messages: Avoid empty "message_content" div.
We no longer have an empty message_content div for
messages like this:

    /me gets some coffee

This requires a minor change in how we compute the
position of the message for editing.
2019-03-07 11:39:38 -08:00
Steve Howell
9aa7ebadd7 me messages: Turn off collapse feature.
This is totally broken on master.  If you "collapse" a /me
message, it adds the "More..." link without actually
hiding any content.

I have another branch related to collapse/condense that
will make this easier to resurrect.
2019-03-07 11:32:09 -08:00
Rohitt Vashishtha
3ed85f4cd7 Revert "bugdown: Process word boundaries properly in realm_filters."
This reverts commit ff90c0101c but keeps
the test cases added for reference.

This was reverted because it was both not a clean solution and created
other realm filters bugs involving dashes (etc.).
2019-03-07 11:03:35 -08:00
Tim Abbott
00903a19c0 Revert "templates: Avoid empty message_content div for /me messages."
This reverts commit 3a73d03e8e.

This was making casper test 08 fail.
2019-03-06 18:28:27 -08:00
Rishi Gupta
99ea5f4e32 popovers: Remove a few entries from stream popover.
These options are pretty low-value, since clicking the stream does the
narrow, and it's likely that almost nobody sends messages via these
buttons.
2019-03-06 17:36:06 -08:00
Hemanth V. Alluri
ae126c452b stream-descriptions: Create wrapper for rendering stream descriptions.
In commit de65a04 we can see that if the need ever arises to modify
how stream descriptions are rendered, we would need to make changes
at 5 different call points which can be quite cumbersome. So this
functionality has been extracted to a new method called
'render_stream_descriptions'.
2019-03-06 17:16:14 -08:00
Tim Abbott
e0c6136ce1 puppet: Fix nginx configuration logic for S3 backend.
Apparently, our testing environment for this configuration was broken
and didn't test the code we thought it did; as a result, a variable
redefinition bug slipped through.

Fixes #11786.
2019-03-06 13:17:11 -08:00
Steve Howell
3a73d03e8e templates: Avoid empty message_content div for /me messages.
This also makes the template a bit more readable.

(As an aside, copy/paste is broken for /me messages,
but that precedes this commit.)
2019-03-06 12:55:02 -08:00
Anders Kaseorg
d7c8d11586 templates: Remove dead <div class="messagebox-border">.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-03-06 12:47:42 -08:00
Tim Abbott
dee2de91a9 Revert "docs: Update dependencies for docs."
This reverts commit 4303b42abd.

This appears to have broken various documentation links to
e.g. README.md on GitHub.
2019-03-06 09:55:51 -08:00
Vishnu Ks
3ac2be6c5f version: Bump PROVISION_VERSION to facilitate dependency upgrade. 2019-03-06 09:31:24 -08:00
Vishnu Ks
65d0b5d501 requirements: Upgrade sphinx from 1.8.3 to 1.8.4. 2019-03-06 09:31:24 -08:00
Vishnu Ks
2c62e7cf6b requirements: Upgrade isort from 4.3.10 to 4.3.11. 2019-03-06 09:31:24 -08:00
Vishnu Ks
d448034f17 requirements: Upgrade wheel from 0.32.3 to 0.33.1. 2019-03-06 09:31:24 -08:00
Vishnu Ks
1a2380fff4 requirements: Upgrade setuptools from 40.7.1 to 40.8.0. 2019-03-06 09:31:24 -08:00
Vishnu Ks
bf0ae7a132 requirements: Upgrade pip from 19.0.1 to 19.0.3. 2019-03-06 09:31:24 -08:00
Vishnu Ks
c20b73154c requirements: Upgrade twilio from 6.23.1 to 6.25.0. 2019-03-06 09:31:24 -08:00
Vishnu Ks
837d6c99c6 requirements: Upgrade stripe from 2.20.0 to 2.21.0. 2019-03-06 09:31:24 -08:00
Vishnu Ks
737d054571 requirements: Upgrade SQLAlchemy from 1.2.17 to 1.3.0. 2019-03-06 09:31:24 -08:00
Vishnu Ks
089b31e88a requirements: Upgrade sphinx-rtd-theme from 0.4.2 to 0.4.3. 2019-03-06 09:31:24 -08:00
Vishnu Ks
ee53411f55 requirements: Upgrade Scrapy from 1.5.2 to 1.6.0. 2019-03-06 09:31:24 -08:00
Vishnu Ks
d53b750acc requirements: Upgrade python-dateutil from 2.7.5 to 2.8.0. 2019-03-06 09:31:24 -08:00
Vishnu Ks
02f20c91d5 requirements: Upgrade pyflakes from 2.1.0 to 2.1.1. 2019-03-06 09:31:24 -08:00
Vishnu Ks
8d56976a0c requirements: Upgrade premailer from 3.2.0 to 3.3.0. 2019-03-06 09:31:24 -08:00
Vishnu Ks
2e69f50ced requirements: Upgrade MarkupSafe from 1.1.0 to 1.1.1. 2019-03-06 09:31:24 -08:00
Vishnu Ks
980293c63c requirements: Upgrade lxml from 4.3.0 to 4.3.2. 2019-03-06 09:31:24 -08:00
Vishnu Ks
b9dc7859d5 requirements: Upgrade isort from 4.3.4 to 4.3.10. 2019-03-06 09:31:24 -08:00
Vishnu Ks
d90192deb4 requirements: Upgrade httplib2 from 0.12.0 to 0.12.1. 2019-03-06 09:31:24 -08:00
Vishnu Ks
2c547f4855 requirements: Upgrade disposable-email-domains from 0.0.43 to 0.0.46. 2019-03-06 09:31:24 -08:00
Vishnu Ks
b0039827fb requirements: Upgrade cryptography from 2.5 to 2.6.1. 2019-03-06 09:31:24 -08:00
Vishnu Ks
7709e6c420 requirements: Upgrade cffi from 1.11.5 to 1.12.2. 2019-03-06 09:31:24 -08:00
Vishnu Ks
21f61140f8 requirements: Upgrade indirect dependencies. 2019-03-06 09:31:24 -08:00
Samuel Searles-Bryant
4303b42abd docs: Update dependencies for docs.
This updates recommonmark so that relative links to .md files will
correctly be converted to links to html pages by Sphinx/ReadTheDocs.
This was repoprted in https://github.com/rtfd/recommonmark/issues/89

This will allow us to in a future commit use relative links to .md
files so all of the hyperlinks work both on ReadTheDocs and on GitHub.
2019-03-06 09:29:21 -08:00
Harshit Bansal
4a9bd89f47 ldap: Continue syncing other fields even if a field is missing.
Earlier the behavior was to raise an exception thereby stopping the
whole sync. Now we log an error message and skip the field. Also
fixes the `query_ldap` command to report missing fields without
error.

Fixes: #11780.
2019-03-05 16:19:27 -08:00
overide
58d28eed5d markdown: Fix emojis not rendering with :bogus: in the line.
This fixes an issue where invalid emoji name prevents following
emojis from rendering.

This reverts the code change in
8842349629, while still passing the
tests added in that commit (it seems the original commit had
misdiagnosed an ordering bug and thus introduced this issue).

Fixes: #11770.
2019-03-05 16:05:25 -08:00
Harshit Bansal
0be410d3fe refactor: De-duplicate code in accounts_home.html for social auth. 2019-03-05 14:02:12 -08:00
Harshit Bansal
3610aaece3 refactor: De-duplicate login button code in portico templates. 2019-03-05 14:02:12 -08:00
Harshit Bansal
0e401c4f18 minor: Fix an artifact of delivery email migration in populate_analytics_db. 2019-03-05 13:52:59 -08:00
Vishnu Ks
8356804bf1 api: Add endpoint for fetching used upload space info. 2019-03-04 18:46:13 -08:00
Vishnu Ks
ef3fbfeb98 events: Include realm_plan_type in initial state data. 2019-03-04 18:46:13 -08:00
Vishnu Ks
69627c9ee4 attachements: Send delete attachment event after deletion.
Also fix the mypy type of attachment_id.
2019-03-04 18:46:13 -08:00
Vishnu Ks
6af885bd5c attachments: Export bytes_to_size function. 2019-03-04 18:46:13 -08:00
Vishnu Ks
4eb5b9ad80 realm: Restrict upload quota according to plan. 2019-03-04 18:46:13 -08:00
Vishnu Ks
94ae2dc24e models: Cache currently_used_upload_space_bytes function. 2019-03-04 18:46:13 -08:00
Vishnu Ks
cc9f00f53e events: Include realm_upload_quota in initial state data. 2019-03-04 18:46:13 -08:00
Vishnu Ks
e522308507 models: Move currently_used_upload_space function to Realm model. 2019-03-04 18:46:13 -08:00
Tim Abbott
36345fd02a settings: Fix definition of DEPLOY_ROOT in dev_settings too. 2019-03-04 18:46:13 -08:00
Anders Kaseorg
4813d070b0 settings: Strip a useless zproject/.. from DEPLOY_ROOT.
And while we're at it, remove a useless duplicate definition.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-03-04 18:43:30 -08:00
Tim Abbott
25f6eccc65 css: Deduplicate some blocks for stream-privacy. 2019-03-04 16:05:16 -08:00
Steve Howell
aaf92a8977 css: Tweak the gutter below the top-left corner.
I think 16px is still enough to offset STREAMS,
and putting STREAMS slightly higher gives it more
emphasis.
2019-03-04 15:59:35 -08:00
Steve Howell
ed30b45afd css: Clean up top-left icons and margins.
Making the icons slightly smaller helps us align the
icons and text in the top-left corner to the icons
and text in the streams section.
2019-03-04 15:59:35 -08:00
Steve Howell
c3a5a1d3d7 css: Simplify hash/lock icon geometry in left sidebar.
Instead of lining these up with margin tweaks, we just
set the min-width on their common parent.
2019-03-04 15:58:33 -08:00
Steve Howell
38e3e22606 css: Make right sidebar fonts be 14px.
They were slightly taller before.  Now they match other
elements on the page.
2019-03-04 15:58:33 -08:00
Steve Howell
c57d6b22ec css: Simplify font sizes for left sidebar elements.
Most elements, apart from chevrons, now have explicit
font sizes.

In some cases I chose integer values that were close
to the calculated values you would get with all the
ratio calculations.

And then I tweaked how the hashtag/lock icons get
aligned.

The alignment for those icons if off in this version; it'll be fixed
in an upcoming commit.
2019-03-04 15:58:33 -08:00
Steve Howell
c40597b5f5 fonts: Make STREAMS and USERS be 14px.
Before this they were 14.2px due to a complex set of
calculations.
2019-03-04 15:58:33 -08:00
Steve Howell
6be5129056 fonts: Use 14px for top left corner.
The fonts there used to be 14.2px due to an arcane
calculation.  Now we explicity set a value.

If you expand Private Messages, the font inside now
is explicitly set to 13px.  It used to be 12.8px due
to a complex calculation.
2019-03-04 15:58:32 -08:00
Steve Howell
028715099e minor: Remove unneeded "arrow" class.
The previous commits made the "arrow" class no longer
necessary for these left sidebar elements.

The "arrow" class was always a bit dangerous, as bootstrap
has a class by the same name for a different concept.

We weren't really using consistent styling for "arrow"
across all our chevrons, so even without bootstrap in
play, it was just creating complexity.
2019-03-04 15:35:40 -08:00
Steve Howell
9b616e2411 css: Use more specific selectors for sidebar icons.
This paves the way to tweak chevron geometry on an
individual basis without accidentally breaking other
stuff.  It's also more self-documenting CSS.
2019-03-04 15:35:40 -08:00
Steve Howell
2cf898a0a5 css: Make "All messages" chevron normal size.
14px was too big. (I confirmed on chat that this
was no longer wanted.)
2019-03-04 15:35:40 -08:00
Steve Howell
194619c667 css: Clean up left sidebar chevrons.
This is a fairly big commit, but at the end
it simplifies a lot of things.

It's difficult to fix highly coupled code in
incremental steps because, well, it's highly
coupled code.

The main thing this does is give each type of
chevron in the left sidebar its own class

    * all-messages-arrow (NEW)
    * stream-sidebar-arrow
    * topic-sidebar-arrow

Before this change, the "All messages" chevron
was using stream-sidebar-arrow, which was a
strange name for something that's not actually
in the stream sidebar. Obviously this was
cargo culted.

There was not much JS to change here--we just
fix the click handler for "All messsages".

And then there's a one-line change to the template,
and the rest is re-organizing the CSS.
2019-03-04 15:35:40 -08:00
Steve Howell
0a848e412f buddy list: Use user-list-arrow class.
Using a more specific class avoids confusion related
to the .arrow class, which is not only a popover concept,
but also a Zulip concept in the left sidebar.
2019-03-04 15:35:40 -08:00
Steve Howell
0551b36053 css: Add comment explaining chevron markup.
The way we build chevrons is super messy and highly
coupled.  This comment reflects an audit I did on the
code in its current state.

Subsequent commits will make things a bit easier to
understand.
2019-03-04 15:35:40 -08:00
Steve Howell
3222f170c9 minor: Remove dead code in PM template.
The topic-sidebar-arrow chevron never shows
here--it was just cargo-culted code from
the topic lists.

It's also a landmine--we don't want to
accidentally build a topic-related sidebar
menu for PMs.
2019-03-04 15:35:40 -08:00
Steve Howell
9820b07616 minor: Introduce zero-pm-unreads.
We could arguably just use zero-unreads everywhere,
but we definitely don't want zero-topic-unreads
inside our PM list.

I prefer to just have these two concepts:

    zero-pm-unreads
    zero-topic-unreads

And it's super easy to share CSS properties for both.
2019-03-04 15:35:40 -08:00
Tim Abbott
8469c7774f scripts: Remove create-zulip-admin.
This was used only by ancient versions of the Docker project.
2019-03-04 15:33:51 -08:00
Tim Abbott
0e7a5d82b4 setup_venv: Remove virtualenv-clone legacy upgrade code.
Few folks will be upgrading from versions of Zulip old enough to not
have virtualenv-clone, and those who are won't be able to use it due
to older dependencies having been removed.
2019-03-04 15:32:15 -08:00
Tim Abbott
4157d15ff1 setup_venv: Fix check for whether virtualenv-clone is unavailable.
We don't need a bare except here.
2019-03-04 15:32:15 -08:00
Tim Abbott
478e215acd setup_venv: Use run_as_root helper.
Also, don't use split() to break up strings to pass into run().
2019-03-04 15:32:15 -08:00
Anders Kaseorg
d9adc9d7bc get_dev_uuid_var_path: Fix theoretical shell quoting problem.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-03-04 15:20:07 -08:00
Tim Abbott
ddb965110f CSS: Remove manual antialiasing configuration.
The antialiasing decisions we made for the webapp should be constant
over the entire page, not limited to particular subsections or themes.

If we wanted antialiasing, we should do it on the entire page, not
individual random widgets.  But it's not clear we actually want to do
it on the entire page.  The `-moz-osx-font-smoothing: grayscale`
setting now happens by default in OSX Mojave (40% world market share
right now and growing), so there's no reason to override it.  And
without retina displays, generally, subpixel rendering provides better
results than antialiasing (which overrides subpixel rendering).

Thanks to Anders Kaseorg for advice on this issue.
2019-03-04 15:12:48 -08:00
Tim Abbott
b3444354aa su_to_zulip: Fix detection of zulip user ID.
Apparently, while upgrade-zulip-from-git always ensures that zulip
deployment directories are owned by the Zulip user, unpack-zulip (aka
the tarball code path) has them owned by root.

The user ID detection logic in su_to_zulip's helper get_zulip_uid was
intended to support both development environments (where the user ID
might vary) and production environments.  For development
environments, the existing code is fine, but given this unpack-zulip
permissions issue, we need to have code to fallback to 'zulip' if the
detection logic detects the "zulip" user has having UID 0.
2019-03-04 14:27:39 -08:00
Tim Abbott
73655a6176 test_auth_backends: Disable Internet for httpretty.
This makes debugging issues when using httpretty a lot more
convenient.
2019-03-04 12:13:49 -08:00
Tim Abbott
6b796a1e8c test_auth_backends: Refactor some GitHub tests to be generic social.
This is preparation to being able to run these tests automatically
for the Google auth backend as well.
2019-03-04 12:13:11 -08:00
Harshit Bansal
216b7b0a19 auth: Remove invalid_subdomain restriction from LDAP backend.
Fixes: #11692.
2019-03-04 11:53:53 -08:00
Tim Abbott
0e2dc873ba docs: Explain options for preventing changes during export.
This makes it a bit clearer that one doesn't need to deactivate a
realm just to export data.
2019-03-04 11:38:02 -08:00
Harshit Bansal
05c54bd477 portico: Refresh deactivated realm notice page every 60 seconds.
This helps avoid users being confused if a realm was temporarily
deactivated as part of getting a clean backup.

Fixes: #11757.
2019-03-04 11:27:15 -08:00
okmanl
ec869f51b9 admin: Display email addresses in user-edit widget.
When the user logs in as an admin, and clicks on the 'edit user'
button under the url path #organization/user-list-admin, the modal
that was displayed didn't contain the user's email address under the
list of information. This commit adds the email input as a readonly
element, which at the very least provides helpful confirmation that
you have the right user.

Fixes part of #11453.
2019-03-04 09:17:05 -08:00
Tim Abbott
500b5cdaf1 tools: Fix missing comma in collectstatic configuration.
It appears that this code did the right thing despite being written
wrong, probably due to whatever `manage.py collectstatic` does in its
argument parsing.  But in any case, we should make the code read how
it's intended.
2019-03-04 08:31:12 -08:00
Alexandra Ciobica
dc24efde24 css: Set padding for the testimonials section directly.
This fixes a visual issue with looking at the testimonials in the
mobile /for/open-source page.
2019-03-03 19:52:52 -08:00
Alexandra Ciobica
18fa4aaa8c css: Remove hello class from /for/open-source.
This class controls a bunch of things, including the mobile responsive
layout, that we don't want on this page.

Fixes #11742.
2019-03-03 19:52:46 -08:00
Alexandra Ciobica
f260a5fea8 css: Remove class hello from testimonials section scss.
This allows us to use this CSS on other pages.
2019-03-03 19:50:47 -08:00
Hemanth V. Alluri
4da6846e27 docs: Add a small note in mypy.md about adding files to git. 2019-03-03 19:49:00 -08:00
Aaron Raimist
5a60353bc7 docs: Fix Learn more about mentions link.
It seems like 1871d00bb2 renamed `/help/at-mention-a-user` to `/help/mention-a-user-or-group` but missed this link that shows up on the "You haven't been mentioned yet!" screen. Right now it leads to a "no such article page".
2019-03-03 19:44:37 -08:00
Rishi Gupta
22381f9ce6 docs: Remove documentation project from gsoc-ideas. 2019-03-02 15:00:44 -08:00
Tim Abbott
066ca0353d docs: Fix export/import manage.py instructions typos.
Fixes #11755.
2019-03-02 13:04:22 -08:00
Tim Abbott
5614d51afc nginx: Restructure how we manage uploaded file routes.
The overall goal of this change is to fix an issue where on Ubuntu
Trusty, we were accidentally overriding the configuration to serve
uploads from disk with the regular expressions for adding access
control headers.

However, while investigating this, it became clear that we could
considerably simplify the mental energy required to understand this
system by making the uploads-route file be unconditionally available
and included from `zulip-include/app` (which means the zulip_ops code
can share behavior here).

We also move the Access-Control-Allow-* headers to a separate include
file, to avoid duplicating it in 5 places.  Fixing this duplication
discovered a potential bug in the settings used for Tornado, where
DELETE was not allowed on a route that definitely expects DELETE.

Fixes #11758.
2019-03-02 12:14:28 -08:00
Tim Abbott
16123c9a58 realm_logo: Fix synchronization of realm night logo.
The night logo synchronization on the settings page was perfect, but
the actual display logic had a few problems:

* We were including the realm_logo in context_processors, even though
  it is only used in home.py.
* We used different variable names for the templating in navbar.html
  than anywhere else the codebase.

* The behavior that the night logo would default to the day logo if
  only one was uploaded was not correctly implemented for the navbar
  position, either in the synchronization for updates code or the
  logic in the navbar.html templates.
2019-03-02 09:45:50 -08:00
Rishi Gupta
2e53aafeae help: Reorganize stream-permissions table. 2019-03-02 08:56:49 -08:00
Puneeth Chaganti
1a436f6c10 digest: Link to PMs narrow only when all PMs are not in digest. 2019-03-02 08:48:00 -08:00
Puneeth Chaganti
8d927eee2f digest: Fix incorrect remaining_unread_pms_count calculation. 2019-03-02 08:48:00 -08:00
Priyanshu Singh
61c0796025 docs: Document how to handle Hyper-V provisioning errors.
Specifically, the problem here is that Vagrant is mis-detecting what
provider to use.
2019-03-02 08:47:04 -08:00
Mateusz Mandera
6a540d5773 docs: Fix a couple typos. 2019-03-01 17:06:34 -08:00
varunvaruns9
b4f35bd54e poll_widget: Add highlight for vote count if current user votes.
Add a background highlight to vote count button if currently
logged in user votes on that option.

Tweaked by tabbott to use better variable names and Rishi for better
styling.
2019-03-01 16:35:18 -08:00
Tim Abbott
63815c2916 message_list_view: Use self in render more consistently.
This just puts the style more clearly that one shouldn't be using
`this` to refer to the outer MessageListview object, because that
breaks unexpectedly when inside a loop.
2019-03-01 16:26:28 -08:00
Tim Abbott
64717d8a45 copy: Fix extra space before > in copy-paste styling. 2019-03-01 16:26:28 -08:00
Steve Howell
b5b9c82f81 refactor: Extract _render_group in MessageListView.
Tweaked by tabbott to use self._render_group for correctness.

This will make sense in an upcoming commit.
2019-03-01 16:26:15 -08:00
Steve Howell
b38ab9a142 Remove redundant sender_info_hover class.
This class exist on the parent element, and the popover
code that relies on it can use the parent div.
2019-03-01 15:53:47 -08:00
Steve Howell
bb5880bf19 refactor: Extract message_avatar partial. 2019-03-01 15:53:47 -08:00
Steve Howell
3ae4d305de minor: Remove noisy comment.
I don't think anybody is actually going to follow that link.
We know avatars are used in multiple places.
2019-03-01 15:53:47 -08:00
Steve Howell
153d65c01f refactor: Extract message_body.handlebars.
This is the real guts of how we render messages.
It only excludes the border effects, which we
leave in single_message.handlebars.

This is a pure code move, and should remove a lot of nesting that
would otherwise clutter one's view.
2019-03-01 15:53:32 -08:00
Steve Howell
3b30ddc4e4 refactor: Remove unnecessary check for include_sender.
The bool `include_sender` will always be `true`
for status messages.  Here is the relevant
excerpt from MLV:

        message_container.status_message = // ...
        message_container.include_sender = true;

We don't need the `include_sender` check in the template.

We could probably also fix the above code, but it's
semantically correct.  I mostly care about simplifying
the template.
2019-03-01 15:42:12 -08:00
Steve Howell
d743d56f1c refactor: Extract me_message template.
This is for:

    /me goes to lunch

Which renders to something like:

    <b>Steve Howell</b> goes to lunch [EDITED]
2019-03-01 15:42:12 -08:00
Steve Howell
7412a097b5 refactor: Extract edited_notice template.
This is a pure code move.  All three places where we use
this partial had the exact same markup, except one place
where I think `auto-select` was inadvertently left off.
2019-03-01 15:42:12 -08:00
Steve Howell
76e379bd4f refactor: Extract message_controls template.
This is a pretty coherent chunk of template code
related to these icons:

    - edit pencil
    - reactions
    - chevron
    - star

Moving it to a partial will simplify future diffs
where we re-work the message HTML.

This is a pure code move.
2019-03-01 15:42:12 -08:00
Steve Howell
386dde2923 refactor: Clean up single_message template.
Some changes here:

    * more whitespace
    * avoid else, and just re-state the condition
    * avoid long if blocks, just re-state the condition
    * use standard `{{#if foo}}` construct

The refactoring of conditionals here will make more
sense in subsequent commits.
2019-03-01 15:42:12 -08:00
Bennet Sunder
7c5f316cb8 alert_words: Performance improvements in looking for alert_words.
This commit leverages the ahocorasick algorithm to build a set of user_ids
that have their alert_words present in the message. It runs in linear time
of the order of length of the input message as opposed to number of
alert_words. This is after building a ahocorasick Automaton which runs
in O(number of alert_words in entire realm) which is usually cached.
2019-03-01 15:36:39 -08:00
vinitS101
2dddf8d8b9 refactor: Move user_last_seen_time_status() to buddy_data.
This is a pure data function, so it shouldn't be in popovers.js file

(Steve Howell added test coverage here, and tabbott removed an
accidental functional change.)
2019-03-01 15:32:14 -08:00
overide
0dcfc22406 markdown: Fix numbered list handling of blank lines between blocks.
This fixes an issue where blank lines between blocks were causing
auto-numbering of list to stop before the blank line resulting
in two separate numbered list instead of one.

Edited significantly by tabbott to explain the tricky details in the
comments.

Fixes: #11651.
2019-03-01 15:29:07 -08:00
Boris Yankov
9edc39c8be user status: Make "unavailable" status circle grey.
After discussion, we decided that the red color is too distinct
and does not convey the idea of "almost offline".

This changes the new "unavailable" status circle's color from dark
red to grey, the same color used by the "offline" status circle.
2019-03-01 22:51:07 +02:00
Rohitt Vashishtha
3d427d02cc scripts/zulip_tools: Use run_as_root instead of subprocess.check_call. 2019-03-01 11:21:16 -08:00
Rohitt Vashishtha
ac48925977 scripts: Use run_as_root instead of run([sudo, ...]). 2019-03-01 11:21:16 -08:00
Rafid Aslam
9038230de8 decorator.py: Add max_int_size param to to_non_negative_int().
Add `max_int_size` parameter to `to_non_negative_int()` in
decorator.py so it will be able to validate that the integer doesn't
exceed the integer maximum limit.

Fixes #11451
2019-03-01 11:16:46 -08:00
Tim Abbott
34460173f4 version: Update version strings following 2.0 release. 2019-03-01 10:38:40 -08:00
2209 changed files with 154440 additions and 81210 deletions

6
.browserslistrc Normal file
View File

@@ -0,0 +1,6 @@
> 0.2%
> 0.2% in US
last 2 versions
Firefox ESR
not dead
Chrome 26 # similar to PhantomJS

View File

@@ -3,7 +3,7 @@
# See CircleCI upstream's docs on this config format:
# https://circleci.com/docs/2.0/language-python/
#
version: 2
version: 2.0
aliases:
- &create_cache_directories
run:
@@ -82,10 +82,11 @@ aliases:
|| echo "Error in uploading coverage reports to codecov.io."
jobs:
"trusty-python-3.4":
"xenial-backend-frontend-python3.5":
docker:
# This is built from tools/circleci/images/trusty/Dockerfile .
- image: gregprice/circleci:trusty-python-5.test
# This is built from tools/circleci/images/xenial/Dockerfile .
# Xenial ships with Python 3.5.
- image: gregprice/circleci:xenial-python-4.test
working_directory: ~/zulip
@@ -100,34 +101,25 @@ jobs:
- *save_cache_requirements
- *run_backend_tests
- *run_frontend_tests
# We only need to upload coverage reports on whichever platform
# runs the frontend tests.
- *upload_coverage_report
# - store_artifacts: # TODO
# path: var/casper/
# # also /tmp/zulip-test-event-log/
# destination: test-reports
- store_artifacts:
path: ./var/casper/
destination: casper
"xenial-python-3.5":
docker:
# This is built from tools/circleci/images/xenial/Dockerfile .
- image: gregprice/circleci:xenial-python-4.test
- store_artifacts:
path: ../../../tmp/zulip-test-event-log/
destination: test-reports
working_directory: ~/zulip
- store_test_results:
path: ./var/xunit-test-results/casper/
steps:
- checkout
- *create_cache_directories
- *restore_cache_package_json
- *restore_cache_requirements
- *install_dependencies
- *save_cache_package_json
- *save_cache_requirements
- *run_backend_tests
- *upload_coverage_report
"bionic-python-3.6":
"bionic-backend-python3.6":
docker:
# This is built from tools/circleci/images/bionic/Dockerfile .
# Bionic ships with Python 3.6.
- image: gregprice/circleci:bionic-python-1.test
working_directory: ~/zulip
@@ -142,7 +134,7 @@ jobs:
command: |
# Temporary hack till `sudo service redis-server start` gets fixes in Bionic. See
# https://chat.zulip.org/#narrow/stream/3-backend/topic/Ubuntu.20bionic.20CircleCI
redis-server --daemonize yes
sudo sed -i '/^bind/s/bind.*/bind 0.0.0.0/' /etc/redis/redis.conf
- *restore_cache_package_json
- *restore_cache_requirements
@@ -150,12 +142,10 @@ jobs:
- *save_cache_package_json
- *save_cache_requirements
- *run_backend_tests
- *upload_coverage_report
workflows:
version: 2
build:
jobs:
- "trusty-python-3.4"
- "xenial-python-3.5"
- "bionic-python-3.6"
- "xenial-backend-frontend-python3.5"
- "bionic-backend-python3.6"

View File

@@ -5,6 +5,8 @@ coverage:
project:
default:
target: auto
threshold: 0.50
# Codecov has the tendency to report a lot of false negatives,
# so we basically suppress comments completely.
threshold: 50%
base: auto
patch: off

View File

@@ -6,20 +6,20 @@ charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.{sh,py,pyi,js,json,yml,xml,css,md,markdown,handlebars,html}]
[*.{sh,py,pyi,js,ts,json,yml,xml,css,md,markdown,handlebars,html}]
indent_style = space
indent_size = 4
[*.{py}]
[*.py]
max_line_length = 110
[*.{js}]
max_line_length = 120
[*.{js,ts}]
max_line_length = 100
[*.{svg,rb,pp,pl}]
indent_style = space
indent_size = 2
[*.{cfg}]
[*.cfg]
indent_style = space
indent_size = 8

View File

@@ -1,2 +1,10 @@
static/js/blueslip.js
static/webpack-bundles
# This is intended for generated files and vendored third-party files.
# For our source code, instead of adding files here, consider using
# specific eslint-disable comments in the files themselves.
/docs/_build
/static/generated
/static/third
/static/webpack-bundles
/var
/zulip-py3-venv

View File

@@ -4,6 +4,7 @@
"es6": true
},
"parserOptions": {
"warnOnUnsupportedTypeScriptVersion": false,
"sourceType": "module"
},
"globals": {
@@ -16,7 +17,6 @@
"LightboxCanvas": false,
"MessageListData": false,
"MessageListView": false,
"PerfectScrollbar": false,
"Plotly": false,
"SockJS": false,
"Socket": false,
@@ -69,6 +69,7 @@
"hash_util": false,
"hashchange": false,
"helpers": false,
"history": false,
"home_msg_list": false,
"hotspots": false,
"i18n": false,
@@ -86,6 +87,7 @@
"localStorage": false,
"local_message": false,
"localstorage": false,
"location": false,
"markdown": false,
"marked": false,
"md5": false,
@@ -146,6 +148,7 @@
"settings_bots": false,
"settings_display": false,
"settings_emoji": false,
"settings_exports": false,
"settings_linkifiers": false,
"settings_invites": false,
"settings_muting": false,
@@ -169,6 +172,7 @@
"stream_muting": false,
"stream_popover": false,
"stream_sort": false,
"stream_ui_updates": false,
"StripeCheckout": false,
"submessage": false,
"subs": false,
@@ -176,7 +180,6 @@
"templates": false,
"tictactoe_widget": false,
"timerender": false,
"toMarkdown": false,
"todo_widget": false,
"top_left_corner": false,
"topic_data": false,
@@ -189,7 +192,6 @@
"typing": false,
"typing_data": false,
"typing_events": false,
"typing_status": false,
"ui": false,
"ui_init": false,
"ui_report": false,
@@ -220,9 +222,9 @@
"array-callback-return": "error",
"array-bracket-spacing": "error",
"arrow-spacing": [ "error", { "before": true, "after": true } ],
"block-scoped-var": 2,
"block-scoped-var": "error",
"brace-style": [ "error", "1tbs", { "allowSingleLine": true } ],
"camelcase": 0,
"camelcase": "off",
"comma-dangle": [ "error",
{
"arrays": "always-multiline",
@@ -238,17 +240,16 @@
"after": true
}
],
"complexity": [ 0, 4 ],
"curly": 2,
"complexity": [ "off", 4 ],
"curly": "error",
"dot-notation": [ "error", { "allowKeywords": true } ],
"empty-returns/main": "error",
"eol-last": [ "error", "always" ],
"eqeqeq": 2,
"eqeqeq": "error",
"func-style": [ "off", "expression" ],
"guard-for-in": 2,
"guard-for-in": "error",
"indent": ["error", 4, {
"ArrayExpression": "first",
"outerIIFEBody": 0,
"ObjectExpression": "first",
"SwitchCase": 0,
"CallExpression": {"arguments": "first"},
@@ -272,7 +273,7 @@
}
}
],
"max-depth": [ 0, 4 ],
"max-depth": [ "off", 4 ],
"max-len": [ "error", 100, 2,
{
"ignoreUrls": true,
@@ -282,76 +283,76 @@
"ignoreTemplateLiterals": true
}
],
"max-params": [ 0, 3 ],
"max-statements": [ 0, 10 ],
"max-params": [ "off", 3 ],
"max-statements": [ "off", 10 ],
"new-cap": [ "error",
{
"newIsCap": true,
"capIsNew": false
}
],
"new-parens": 2,
"newline-per-chained-call": 0,
"no-alert": 2,
"new-parens": "error",
"newline-per-chained-call": "off",
"no-alert": "error",
"no-array-constructor": "error",
"no-bitwise": 2,
"no-caller": 2,
"no-bitwise": "error",
"no-caller": "error",
"no-case-declarations": "error",
"no-catch-shadow": 2,
"no-console": 0,
"no-catch-shadow": "error",
"no-console": "off",
"no-const-assign": "error",
"no-control-regex": 2,
"no-debugger": 2,
"no-delete-var": 2,
"no-div-regex": 2,
"no-control-regex": "error",
"no-debugger": "error",
"no-delete-var": "error",
"no-div-regex": "error",
"no-dupe-class-members": "error",
"no-dupe-keys": 2,
"no-dupe-keys": "error",
"no-duplicate-imports": "error",
"no-else-return": 2,
"no-empty": 2,
"no-empty-character-class": 2,
"no-eq-null": 2,
"no-eval": 2,
"no-ex-assign": 2,
"no-else-return": "error",
"no-empty": "error",
"no-empty-character-class": "error",
"no-eq-null": "error",
"no-eval": "error",
"no-ex-assign": "error",
"no-extra-parens": ["error", "all"],
"no-extra-semi": 2,
"no-fallthrough": 2,
"no-floating-decimal": 2,
"no-func-assign": 2,
"no-implied-eval": 2,
"no-extra-semi": "error",
"no-fallthrough": "error",
"no-floating-decimal": "error",
"no-func-assign": "error",
"no-implied-eval": "error",
"no-iterator": "error",
"no-label-var": 2,
"no-labels": 2,
"no-loop-func": 2,
"no-mixed-requires": [ 0, false ],
"no-multi-str": 2,
"no-native-reassign": 2,
"no-nested-ternary": 0,
"no-label-var": "error",
"no-labels": "error",
"no-loop-func": "error",
"no-mixed-requires": [ "off", false ],
"no-multi-str": "error",
"no-native-reassign": "error",
"no-nested-ternary": "off",
"no-new-func": "error",
"no-new-object": 2,
"no-new-wrappers": 2,
"no-obj-calls": 2,
"no-octal": 2,
"no-octal-escape": 2,
"no-param-reassign": 0,
"no-plusplus": 2,
"no-proto": 2,
"no-redeclare": 2,
"no-regex-spaces": 2,
"no-restricted-syntax": 0,
"no-return-assign": 2,
"no-script-url": 2,
"no-self-compare": 2,
"no-shadow": 0,
"no-sync": 2,
"no-ternary": 0,
"no-trailing-spaces": 2,
"no-new-object": "error",
"no-new-wrappers": "error",
"no-obj-calls": "error",
"no-octal": "error",
"no-octal-escape": "error",
"no-param-reassign": "off",
"no-plusplus": "error",
"no-proto": "error",
"no-redeclare": "error",
"no-regex-spaces": "error",
"no-restricted-syntax": "off",
"no-return-assign": "error",
"no-script-url": "error",
"no-self-compare": "error",
"no-shadow": "off",
"no-sync": "error",
"no-ternary": "off",
"no-trailing-spaces": "error",
"no-undef": "error",
"no-undef-init": 2,
"no-underscore-dangle": 0,
"no-undef-init": "error",
"no-underscore-dangle": "off",
"no-unneeded-ternary": [ "error", { "defaultAssignment": false } ],
"no-unreachable": 2,
"no-unused-expressions": 2,
"no-unreachable": "error",
"no-unused-expressions": "error",
"no-unused-vars": [ "error",
{
"vars": "local",
@@ -359,18 +360,19 @@
"varsIgnorePattern": "print_elapsed_time|check_duplicate_ids"
}
],
"no-use-before-define": 2,
"no-use-before-define": "error",
"no-useless-constructor": "error",
// The Zulip codebase complies partially with the "no-useless-escape"
// rule; only regex expressions haven't been updated yet.
// Updated regex expressions are currently being tested in casper
// files and will decide about a potential future enforcement of this rule.
"no-useless-escape": 0,
"space-unary-ops": 2,
"no-whitespace-before-property": 2,
"no-with": 2,
"no-useless-escape": "off",
"no-var": "error",
"space-unary-ops": "error",
"no-whitespace-before-property": "error",
"no-with": "error",
"one-var": [ "error", "never" ],
"padded-blocks": 0,
"padded-blocks": "off",
"prefer-const": [ "error",
{
"destructuring": "any",
@@ -384,11 +386,12 @@
"numbers": false
}
],
"quotes": [ 0, "single" ],
"radix": 2,
"semi": 2,
"semi-spacing": [2, {"before": false, "after": true}],
"space-before-blocks": 2,
"quotes": [ "off", "single" ],
"radix": "error",
"semi": "error",
"semi-spacing": ["error", {"before": false, "after": true}],
"sort-imports": "error",
"space-before-blocks": "error",
"space-before-function-paren": [ "error",
{
"anonymous": "always",
@@ -396,16 +399,97 @@
"asyncArrow": "always"
}
],
"space-in-parens": 2,
"space-infix-ops": 2,
"spaced-comment": 0,
"strict": 0,
"space-in-parens": "error",
"space-infix-ops": "error",
"spaced-comment": "off",
"strict": "off",
"template-curly-spacing": "error",
"unnecessary-strict": 0,
"use-isnan": 2,
"unnecessary-strict": "off",
"use-isnan": "error",
"valid-typeof": [ "error", { "requireStringLiterals": true } ],
"wrap-iife": [ "error", "outside", { "functionPrototypeMethods": false } ],
"wrap-regex": 0,
"yoda": 2
}
"wrap-regex": "off",
"yoda": "error"
},
"overrides": [
{
"files": [
"frontend_tests/casper_tests/*.js",
"frontend_tests/casper_lib/*.js"
],
"rules": {
"no-var": "off" // PhantomJS doesnt support let, const
}
},
{
"files": ["**/*.ts"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "tsconfig.json"
},
"plugins": ["@typescript-eslint"],
"rules": {
// Disable base rule to avoid conflict
"empty-returns/main": "off",
"indent": "off",
"func-call-spacing": "off",
"no-magic-numbers": "off",
"semi": "off",
"no-unused-vars": "off",
"no-useless-constructor": "off",
"@typescript-eslint/adjacent-overload-signatures": "error",
"@typescript-eslint/array-type": "error",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/ban-types": "error",
"@typescript-eslint/ban-ts-ignore": "off",
"@typescript-eslint/camelcase": "off",
"@typescript-eslint/class-name-casing": "error",
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/explicit-function-return-type": ["error", { "allowExpressions": true }],
"@typescript-eslint/explicit-member-accessibility": "off",
"@typescript-eslint/func-call-spacing": "error",
"@typescript-eslint/generic-type-naming": "off",
"@typescript-eslint/indent": "error",
"@typescript-eslint/interface-name-prefix": "off",
"@typescript-eslint/member-delimiter-style": "error",
"@typescript-eslint/member-naming": ["error", { "private": "^_" } ],
"@typescript-eslint/member-ordering": "error",
"@typescript-eslint/no-array-constructor": "error",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-extraneous-class": "error",
"@typescript-eslint/no-for-in-array": "off",
"@typescript-eslint/no-inferrable-types": "error",
"@typescript-eslint/no-magic-numbers": "off",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-parameter-properties": "error",
"@typescript-eslint/no-require-imports": "off",
"@typescript-eslint/no-this-alias": "off",
"@typescript-eslint/no-type-alias": "off",
"@typescript-eslint/no-unnecessary-qualifier": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-unused-vars": ["error", { "varsIgnorePattern": "^_" } ],
"@typescript-eslint/no-use-before-define": "error",
"@typescript-eslint/no-useless-constructor": "error",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/prefer-for-of": "off",
"@typescript-eslint/prefer-function-type": "off",
"@typescript-eslint/prefer-includes": "error",
"@typescript-eslint/prefer-interface": "off",
"@typescript-eslint/prefer-namespace-keyword": "error",
"@typescript-eslint/prefer-regexp-exec": "error",
"@typescript-eslint/prefer-string-starts-ends-with": "error",
"@typescript-eslint/promise-function-async": "error",
"@typescript-eslint/restrict-plus-operands": "off",
"@typescript-eslint/semi": "error",
"@typescript-eslint/triple-slash-reference": "error",
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/unbound-method": "off",
"@typescript-eslint/unified-signatures": "error"
}
}
]
}

1
.gitattributes vendored
View File

@@ -11,4 +11,3 @@
*.otf binary
*.tif binary
*.ogg binary
yarn.lock binary

7
.gitignore vendored
View File

@@ -34,6 +34,12 @@ package-lock.json
# Dockerfiles generated for CircleCI
/tools/circleci/images
# Generated i18n data
/locale/en
/locale/language_options.json
/locale/language_name_map.json
/locale/*/mobile.json
# Static build
*.mo
npm-debug.log
@@ -42,6 +48,7 @@ npm-debug.log
/staticfiles.json
/webpack-stats-production.json
/yarn-error.log
zulip-git-version
# Test / analysis tools
.coverage

View File

@@ -1,7 +1,6 @@
# See https://zulip.readthedocs.io/en/latest/testing/continuous-integration.html for
# high-level documentation on our Travis CI setup.
dist: trusty
group: deprecated-2017Q4
dist: xenial
install:
# Disable sometimes-broken sources.list in Travis base images
- sudo rm -vf /etc/apt/sources.list.d/*
@@ -40,15 +39,15 @@ env:
global:
- BOTO_CONFIG=/nonexistent
language: python
# Our test suites generally run on Python 3.4, the version in
# Ubuntu 14.04 trusty, which is the oldest OS release we support.
# Our test suites generally run on Python 3.5, the version in
# Ubuntu 16.04 xenial, which is the oldest OS release we support.
matrix:
include:
# Travis will actually run the jobs in the order they're listed here;
# that doesn't seem to be documented, but it's what we see empirically.
# We only get 4 jobs running at a time, so we try to make the first few
# the most likely to break.
- python: "3.4"
- python: "3.5"
env: TEST_SUITE=production
# Other suites moved to CircleCI -- see .circleci/.
sudo: required
@@ -59,7 +58,7 @@ addons:
# debugging test flakes.
- $(ls var/casper/* | tr "\n" ":")
- $(ls /tmp/zulip-test-event-log/* | tr "\n" ":")
postgresql: "9.3"
postgresql: "9.5"
apt:
packages:
- moreutils

View File

@@ -3,31 +3,31 @@ host = https://www.transifex.com
lang_map = zh-Hans: zh_Hans, zh-Hant: zh_Hant
[zulip.djangopo]
source_file = static/locale/en/LC_MESSAGES/django.po
file_filter = locale/<lang>/LC_MESSAGES/django.po
source_file = locale/en/LC_MESSAGES/django.po
source_lang = en
type = PO
file_filter = static/locale/<lang>/LC_MESSAGES/django.po
[zulip.translationsjson]
source_file = static/locale/en/translations.json
file_filter = locale/<lang>/translations.json
source_file = locale/en/translations.json
source_lang = en
type = KEYVALUEJSON
file_filter = static/locale/<lang>/translations.json
[zulip.mobile]
source_file = static/locale/en/mobile.json
file_filter = locale/<lang>/mobile.json
source_file = locale/en/mobile.json
source_lang = en
type = KEYVALUEJSON
file_filter = static/locale/<lang>/mobile.json
[zulip-test.djangopo]
source_file = static/locale/en/LC_MESSAGES/django.po
file_filter = locale/<lang>/LC_MESSAGES/django.po
source_file = locale/en/LC_MESSAGES/django.po
source_lang = en
type = PO
file_filter = static/locale/<lang>/LC_MESSAGES/django.po
[zulip-test.translationsjson]
source_file = static/locale/en/translations.json
file_filter = locale/<lang>/translations.json
source_file = locale/en/translations.json
source_lang = en
type = KEYVALUEJSON
file_filter = static/locale/<lang>/translations.json

1
.yarnrc Normal file
View File

@@ -0,0 +1 @@
ignore-scripts true

View File

@@ -78,7 +78,7 @@ something you can do while a violation is happening, do it. A lot of the
harms of harassment and other violations can be mitigated by the victim
knowing that the other people present are on their side.
All reports will be kept confidential. In some cases we may determine that a
All reports will be kept confidential. In some cases, we may determine that a
public statement will need to be made. In such cases, the identities of all
victims and reporters will remain confidential unless those individuals
instruct us otherwise.

View File

@@ -13,7 +13,8 @@ user, or anything else. Make sure to read the
before posting. The Zulip community is also governed by a
[code of conduct](https://zulip.readthedocs.io/en/latest/code-of-conduct.html).
You can subscribe to zulip-devel@googlegroups.com for a lower traffic (~1
You can subscribe to zulip-devel-announce@googlegroups.com or our
[Twitter](https://twitter.com/zulip) account for a lower traffic (~1
email/month) way to hear about things like mentorship opportunities with Google
Code-in, in-person sprints at conferences, and other opportunities to
contribute.
@@ -28,7 +29,7 @@ needs doing:
[backend](https://github.com/zulip/zulip), web
[frontend](https://github.com/zulip/zulip), React Native
[mobile app](https://github.com/zulip/zulip-mobile), or Electron
[desktop app](https://github.com/zulip/zulip-electron).
[desktop app](https://github.com/zulip/zulip-desktop).
* Building out our
[Python API and bots](https://github.com/zulip/python-zulip-api) framework.
* [Writing an integration](https://zulipchat.com/api/integrations-overview).
@@ -85,17 +86,19 @@ on.
* If you're interested in
[mobile](https://github.com/zulip/zulip-mobile/issues?q=is%3Aopen+is%3Aissue),
[desktop](https://github.com/zulip/zulip-electron/issues?q=is%3Aopen+is%3Aissue),
[desktop](https://github.com/zulip/zulip-desktop/issues?q=is%3Aopen+is%3Aissue),
or
[bots](https://github.com/zulip/python-zulip-api/issues?q=is%3Aopen+is%3Aissue)
development, check the respective links for open issues, or post in
[#mobile](https://chat.zulip.org/#narrow/stream/48-mobile),
[#desktop](https://chat.zulip.org/#narrow/stream/16-desktop), or
[#integration](https://chat.zulip.org/#narrow/stream/127-integrations).
* For the main server and web repository, start by looking through issues
with the label
[good first issue](https://github.com/zulip/zulip/issues?q=is%3Aopen+is%3Aissue+label%3A"good+first+issue").
These are smaller projects particularly suitable for a first contribution.
* For the main server and web repository, we recommend browsing
recently opened issues to look for issues you are confident you can
fix correctly in a way that clearly communicates why your changes
are the correct fix. Our GitHub workflow bot, zulipbot, limits
users who have 0 commits merged to claiming a single issue labeled
with "good first issue" or "help wanted".
* We also partition all of our issues in the main repo into areas like
admin, compose, emoji, hotkeys, i18n, onboarding, search, etc. Look
through our [list of labels](https://github.com/zulip/zulip/labels), and
@@ -105,8 +108,8 @@ on.
[#new members](https://chat.zulip.org/#narrow/stream/95-new-members) with a
bit about your background and interests, and we'll help you out. The most
important thing to say is whether you're looking for a backend (Python),
frontend (JavaScript), mobile (React Native), desktop (Electron),
documentation (English) or visual design (JavaScript + CSS) issue, and a
frontend (JavaScript and TypeScript), mobile (React Native), desktop (Electron),
documentation (English) or visual design (JavaScript/TypeScript + CSS) issue, and a
bit about your programming experience and available time.
We also welcome suggestions of features that you feel would be valuable or
@@ -119,11 +122,17 @@ Other notes:
* For a first pull request, it's better to aim for a smaller contribution
than a bigger one. Many first contributions have fewer than 10 lines of
changes (not counting changes to tests).
* The full list of issues looking for a contributor can be found with the
* The full list of issues explicitly looking for a contributor can be
found with the
[good first issue](https://github.com/zulip/zulip/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22)
and
[help wanted](https://github.com/zulip/zulip/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22)
labels.
labels. Avoid issues with the "difficult" label unless you
understand why it is difficult and are confident you can resolve the
issue correctly and completely. Issues without one of these labels
are fair game if Tim has written a clear technical design proposal
in the issue, or it is a bug that you can reproduce and you are
confident you can fix the issue correctly.
* For most new contributors, there's a lot to learn while making your first
pull request. It's OK if it takes you a while; that's normal! You'll be
able to work a lot faster as you build experience.
@@ -269,10 +278,10 @@ quickly become core team members. We hope you apply!
### Google Summer of Code
GSoC is by far the largest of our internship programs (we had 14 GSoC
students in summer 2017). While we don't control how many slots
GSoC is by far the largest of our internship programs (14 students in
2017; 11 in 2018; 17 in 2019). While we don't control how many slots
Google allocates to Zulip, we hope to mentor a similar number of
students in 2018.
students in future summers.
If you're reading this well before the application deadline and want
to make your application strong, we recommend getting involved in the
@@ -310,7 +319,7 @@ list typically takes about 15 minutes.
* Star us on GitHub. There are four main repositories:
[server/web](https://github.com/zulip/zulip),
[mobile](https://github.com/zulip/zulip-mobile),
[desktop](https://github.com/zulip/zulip-electron), and
[desktop](https://github.com/zulip/zulip-desktop), and
[Python API](https://github.com/zulip/python-zulip-api).
* [Follow us](https://twitter.com/zulip) on Twitter.

View File

@@ -1,17 +0,0 @@
FROM ubuntu:trusty
EXPOSE 9991
RUN apt-get update && apt-get install -y wget
RUN localedef -i en_US -f UTF-8 en_US.UTF-8
RUN useradd -d /home/zulip -m zulip && echo 'zulip ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
USER zulip
RUN ln -nsf /srv/zulip ~/zulip
RUN echo 'export LC_ALL="en_US.UTF-8" LANG="en_US.UTF-8" LANGUAGE="en_US.UTF-8"' >> ~zulip/.bashrc
RUN echo 'export LC_ALL="en_US.UTF-8" LANG="en_US.UTF-8" LANGUAGE="en_US.UTF-8"' >> ~zulip/.bash_profile
WORKDIR /srv/zulip

View File

@@ -1,33 +1,16 @@
# To build run `docker build -f Dockerfile-postgresql .` from the root of the
# zulip repo.
# Install build tools and build tsearch_extras for the current postgres
# version. Currently the postgres images do not support automatic upgrading of
# Currently the postgres images do not support automatic upgrading of
# the on-disk data in volumes. So the base image can not currently be upgraded
# without users needing a manual pgdump and restore.
FROM postgres:10
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
postgresql-server-dev-$PG_MAJOR \
postgresql-server-dev-all \
git \
build-essential \
fakeroot \
devscripts
RUN git clone https://github.com/zulip/tsearch_extras.git \
&& cd tsearch_extras \
&& echo $PG_MAJOR > debian/pgversions \
&& pg_buildext updatecontrol \
&& debuild -b -uc -us
# Install tsearch_extras, hunspell, zulip stop words, and run zulip database
# Install hunspell, zulip stop words, and run zulip database
# init.
FROM postgres:10
ENV TSEARCH_EXTRAS_VERSION=0.4
ENV TSEARCH_EXTRAS_DEB=postgresql-${PG_MAJOR}-tsearch-extras_${TSEARCH_EXTRAS_VERSION}_amd64.deb
COPY --from=0 /${TSEARCH_EXTRAS_DEB} /tmp
COPY puppet/zulip/files/postgresql/zulip_english.stop /usr/share/postgresql/$PG_MAJOR/tsearch_data/zulip_english.stop
COPY scripts/setup/postgres-create-db /docker-entrypoint-initdb.d/postgres-create-db.sh
COPY scripts/setup/create-db.sql /docker-entrypoint-initdb.d/zulip-create-db.sql
COPY scripts/setup/create-pgroonga.sql /docker-entrypoint-initdb.d/zulip-create-pgroonga.sql
COPY scripts/setup/pgroonga-debian.asc /tmp
RUN apt-key add /tmp/pgroonga-debian.asc \
&& echo "deb http://packages.groonga.org/debian/ stretch main" > /etc/apt/sources.list.d/zulip.list \
@@ -35,8 +18,6 @@ RUN apt-key add /tmp/pgroonga-debian.asc \
&& DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
hunspell-en-us \
postgresql-${PG_MAJOR}-pgroonga \
&& DEBIAN_FRONTEND=noninteractive dpkg -i /tmp/${TSEARCH_EXTRAS_DEB} \
&& rm /tmp/${TSEARCH_EXTRAS_DEB} \
&& ln -sf /var/cache/postgresql/dicts/en_us.dict "/usr/share/postgresql/$PG_MAJOR/tsearch_data/en_us.dict" \
&& ln -sf /var/cache/postgresql/dicts/en_us.affix "/usr/share/postgresql/$PG_MAJOR/tsearch_data/en_us.affix" \
&& rm -rf /var/lib/apt/lists/*

View File

@@ -5,12 +5,11 @@ immediacy of real-time chat with the productivity benefits of threaded
conversations. Zulip is used by open source projects, Fortune 500 companies,
large standards bodies, and others who need a real-time chat system that
allows users to easily process hundreds or thousands of messages a day. With
over 300 contributors merging over 500 commits a month, Zulip is also the
over 500 contributors merging over 500 commits a month, Zulip is also the
largest and fastest growing open source group chat project.
[![CircleCI branch](https://img.shields.io/circleci/project/github/zulip/zulip/master.svg)](https://circleci.com/gh/zulip/zulip)
[![Travis Build Status](https://travis-ci.org/zulip/zulip.svg?branch=master)](https://travis-ci.org/zulip/zulip)
[![Coverage Status](https://img.shields.io/codecov/c/github/zulip/zulip.svg)](https://codecov.io/gh/zulip/zulip)
[![CircleCI branch](https://img.shields.io/circleci/project/github/zulip/zulip/master.svg)](https://circleci.com/gh/zulip/zulip/tree/master)
[![Coverage Status](https://img.shields.io/codecov/c/github/zulip/zulip/master.svg)](https://codecov.io/gh/zulip/zulip/branch/master)
[![Mypy coverage](https://img.shields.io/badge/mypy-100%25-green.svg)][mypy-coverage]
[![GitHub release](https://img.shields.io/github/release/zulip/zulip.svg)](https://github.com/zulip/zulip/releases/latest)
[![docs](https://readthedocs.org/projects/zulip/badge/?version=latest)](https://zulip.readthedocs.io/en/latest/)
@@ -56,12 +55,11 @@ You might be interested in:
[companies](https://zulipchat.com/for/companies/), or Zulip for
[working groups and part time communities](https://zulipchat.com/for/working-groups-and-communities/).
* **Running a Zulip server**. Setting up a server takes just a couple
of minutes. Zulip runs on Ubuntu 18.04 Bionic, Ubuntu 16.04 Xenial,
Ubuntu 14.04 Trusty, and Debian 9 Stretch. The installation process is
[documented here](https://zulip.readthedocs.io/en/stable/production/install.html).
Commercial support is available; see <https://zulipchat.com/plans>
for details.
* **Running a Zulip server**. Use a preconfigured [Digital Ocean droplet](https://marketplace.digitalocean.com/apps/zulip),
[install Zulip](https://zulip.readthedocs.io/en/stable/production/install.html)
directly, or use Zulip's
experimental [Docker image](https://zulip.readthedocs.io/en/latest/production/deployment.html#zulip-in-docker).
Commercial support is available; see <https://zulipchat.com/plans> for details.
* **Using Zulip without setting up a server**. <https://zulipchat.com> offers
free and commercial hosting.

135
Vagrantfile vendored
View File

@@ -19,43 +19,6 @@ if Vagrant::VERSION == "1.8.7" then
end
end
# Workaround: the lxc-config in vagrant-lxc is incompatible with changes in
# LXC 2.1.0, found in Ubuntu 17.10 artful. LXC 2.1.1 (in 18.04 LTS bionic)
# ignores the old config key, so this will only be needed for artful.
#
# vagrant-lxc upstream has an attempted fix:
# https://github.com/fgrehm/vagrant-lxc/issues/445
# but it didn't work in our testing. This is a temporary issue, so we just
# hack in a fix: we patch the skeleton `lxc-config` file right in the
# distribution of the vagrant-lxc "box" we use. If the user doesn't yet
# have the box (e.g. on first setup), Vagrant would download it but too
# late for us to patch it like this; so we prompt them to explicitly add it
# first and then rerun.
if ['up', 'provision'].include? ARGV[0]
if command? "lxc-ls"
LXC_VERSION = `lxc-ls --version`.strip unless defined? LXC_VERSION
if LXC_VERSION == "2.1.0"
lxc_config_file = ENV['HOME'] + "/.vagrant.d/boxes/fgrehm-VAGRANTSLASH-trusty64-lxc/1.2.0/lxc/lxc-config"
if File.file?(lxc_config_file)
lines = File.readlines(lxc_config_file)
deprecated_line = "lxc.pivotdir = lxc_putold\n"
if lines[1] == deprecated_line
lines[1] = "# #{deprecated_line}"
File.open(lxc_config_file, 'w') do |f|
f.puts(lines)
end
end
else
puts 'You are running LXC 2.1.0, and fgrehm/trusty64-lxc box is incompatible '\
"with it by default. First add the box by doing:\n"\
" vagrant box add https://vagrantcloud.com/fgrehm/trusty64-lxc\n"\
'Once this command succeeds, do "vagrant up" again.'
exit
end
end
end
end
# Workaround: Vagrant removed the atlas.hashicorp.com to
# vagrantcloud.com redirect in February 2018. The value of
# DEFAULT_SERVER_URL in Vagrant versions less than 1.9.3 is
@@ -66,24 +29,38 @@ if Vagrant::DEFAULT_SERVER_URL == "atlas.hashicorp.com"
Vagrant::DEFAULT_SERVER_URL.replace('https://vagrantcloud.com')
end
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Monkey patch https://github.com/hashicorp/vagrant/pull/10879 so we
# can fall back to another provider if docker is not installed.
begin
require Vagrant.source_root.join("plugins", "providers", "docker", "provider")
rescue LoadError
else
VagrantPlugins::DockerProvider::Provider.class_eval do
method(:usable?).owner == singleton_class or def self.usable?(raise_error=false)
VagrantPlugins::DockerProvider::Driver.new.execute("docker", "version")
true
rescue Vagrant::Errors::CommandUnavailable, VagrantPlugins::DockerProvider::Errors::ExecuteError
raise if raise_error
return false
end
end
end
# For LXC. VirtualBox hosts use a different box, described below.
config.vm.box = "fgrehm/trusty64-lxc"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# The Zulip development environment runs on 9991 on the guest.
host_port = 9991
http_proxy = https_proxy = no_proxy = nil
host_ip_addr = "127.0.0.1"
# System settings for the virtual machine.
vm_num_cpus = "2"
vm_memory = "2048"
ubuntu_mirror = ""
config.vm.synced_folder ".", "/vagrant", disabled: true
if (/darwin/ =~ RUBY_PLATFORM) != nil
config.vm.synced_folder ".", "/srv/zulip", type: "nfs",
linux__nfs_options: ['rw']
config.vm.network "private_network", type: "dhcp"
else
config.vm.synced_folder ".", "/srv/zulip"
end
config.vm.synced_folder ".", "/srv/zulip"
vagrant_config_file = ENV['HOME'] + "/.zulip-vagrant-config"
if File.file?(vagrant_config_file)
@@ -97,6 +74,9 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
when "NO_PROXY"; no_proxy = value
when "HOST_PORT"; host_port = value.to_i
when "HOST_IP_ADDR"; host_ip_addr = value
when "GUEST_CPUS"; vm_num_cpus = value
when "GUEST_MEMORY_MB"; vm_memory = value
when "UBUNTU_MIRROR"; ubuntu_mirror = value
end
end
end
@@ -122,35 +102,28 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.network "forwarded_port", guest: 9991, host: host_port, host_ip: host_ip_addr
config.vm.network "forwarded_port", guest: 9994, host: host_port + 3, host_ip: host_ip_addr
# Specify LXC provider before VirtualBox provider so it's preferred.
config.vm.provider "lxc" do |lxc|
if command? "lxc-ls"
LXC_VERSION = `lxc-ls --version`.strip unless defined? LXC_VERSION
if LXC_VERSION >= "1.1.0" and LXC_VERSION < "3.0.0"
# Allow start without AppArmor, otherwise Box will not Start on Ubuntu 14.10
# see https://github.com/fgrehm/vagrant-lxc/issues/333
lxc.customize 'aa_allow_incomplete', 1
end
if LXC_VERSION >= "3.0.0"
lxc.customize 'apparmor.allow_incomplete', 1
end
if LXC_VERSION >= "2.0.0"
lxc.backingstore = 'dir'
end
# Specify Docker provider before VirtualBox provider so it's preferred.
config.vm.provider "docker" do |d, override|
d.build_dir = File.join(__dir__, "tools", "setup", "dev-vagrant-docker")
d.build_args = ["--build-arg", "VAGRANT_UID=#{Process.uid}"]
if !ubuntu_mirror.empty?
d.build_args += ["--build-arg", "UBUNTU_MIRROR=#{ubuntu_mirror}"]
end
d.has_ssh = true
d.create_args = ["--ulimit", "nofile=1024:65536"]
end
config.vm.provider "virtualbox" do |vb, override|
override.vm.box = "ubuntu/trusty64"
override.vm.box = "ubuntu/bionic64"
# An unnecessary log file gets generated when running vagrant up for the
# first time with the Ubuntu Bionic box. This looks like it is being
# caused upstream by the base box containing a Vagrantfile with a similar
# line to the one below.
# see https://github.com/hashicorp/vagrant/issues/9425
vb.customize [ "modifyvm", :id, "--uartmode1", "disconnected" ]
# It's possible we can get away with just 1.5GB; more testing needed
vb.memory = 2048
vb.cpus = 2
end
config.vm.provider "vmware_fusion" do |vb, override|
override.vm.box = "puphpet/ubuntu1404-x64"
vb.vmx["memsize"] = "2048"
vb.vmx["numvcpus"] = "2"
vb.memory = vm_memory
vb.cpus = vm_num_cpus
end
$provision_script = <<SCRIPT
@@ -162,19 +135,15 @@ set -o pipefail
# something that we don't want to happen when running provision in a
# development environment not using Vagrant.
# Set the Ubuntu mirror
[ ! '#{ubuntu_mirror}' ] || sudo sed -i 's|http://\\(\\w*\\.\\)*archive\\.ubuntu\\.com/ubuntu/\\? |#{ubuntu_mirror} |' /etc/apt/sources.list
# Set the MOTD on the system to have Zulip instructions
sudo rm -f /etc/update-motd.d/*
sudo bash -c 'cat << EndOfMessage > /etc/motd
Welcome to the Zulip development environment! Popular commands:
* tools/provision - Update the development environment
* tools/run-dev.py - Run the development server
* tools/lint - Run the linter (quick and catches many problems)
* tools/test-* - Run tests (use --help to learn about options)
Read https://zulip.readthedocs.io/en/latest/testing/testing.html to learn
how to run individual test suites so that you can get a fast debug cycle.
EndOfMessage'
sudo ln -nsf /srv/zulip/tools/setup/dev-motd /etc/update-motd.d/99-zulip-dev
sudo rm -f /etc/update-motd.d/10-help-text
sudo dpkg --purge landscape-client landscape-common ubuntu-release-upgrader-core update-manager-core update-notifier-common ubuntu-server
sudo dpkg-divert --add --rename /etc/default/motd-news
sudo sh -c 'echo ENABLED=0 > /etc/default/motd-news'
# If the host is running SELinux remount the /sys/fs/selinux directory as read only,
# needed for apt-get to work.

View File

@@ -15,7 +15,7 @@ from analytics.models import BaseCount, \
from zerver.lib.logging_util import log_to_file
from zerver.lib.timestamp import ceiling_to_day, \
ceiling_to_hour, floor_to_hour, verify_UTC
from zerver.models import Message, Realm, \
from zerver.models import Message, Realm, RealmAuditLog, \
Stream, UserActivityInterval, UserProfile, models
## Logging setup ##
@@ -295,8 +295,8 @@ count_message_by_user_query = """
zerver_userprofile.id = zerver_message.sender_id
WHERE
zerver_userprofile.date_joined < %%(time_end)s AND
zerver_message.pub_date >= %%(time_start)s AND
zerver_message.pub_date < %%(time_end)s
zerver_message.date_sent >= %%(time_start)s AND
zerver_message.date_sent < %%(time_end)s
GROUP BY zerver_userprofile.id %(group_by_clause)s
"""
@@ -322,8 +322,8 @@ count_message_type_by_user_query = """
JOIN zerver_message
ON
zerver_userprofile.id = zerver_message.sender_id AND
zerver_message.pub_date >= %%(time_start)s AND
zerver_message.pub_date < %%(time_end)s
zerver_message.date_sent >= %%(time_start)s AND
zerver_message.date_sent < %%(time_end)s
JOIN zerver_recipient
ON
zerver_message.recipient_id = zerver_recipient.id
@@ -359,8 +359,8 @@ count_message_by_stream_query = """
WHERE
zerver_stream.date_created < %%(time_end)s AND
zerver_recipient.type = 2 AND
zerver_message.pub_date >= %%(time_start)s AND
zerver_message.pub_date < %%(time_end)s
zerver_message.date_sent >= %%(time_start)s AND
zerver_message.date_sent < %%(time_end)s
GROUP BY zerver_stream.id %(group_by_clause)s
"""
@@ -385,7 +385,7 @@ count_user_by_realm_query = """
# Currently hardcodes the query needed for active_users_audit:is_bot:day.
# Assumes that a user cannot have two RealmAuditLog entries with the same event_time and
# event_type in ['user_created', 'user_deactivated', etc].
# event_type in [RealmAuditLog.USER_CREATED, USER_DEACTIVATED, etc].
# In particular, it's important to ensure that migrations don't cause that to happen.
check_realmauditlog_by_user_query = """
INSERT INTO analytics_usercount
@@ -397,7 +397,7 @@ check_realmauditlog_by_user_query = """
SELECT modified_user_id, max(event_time) AS max_event_time
FROM zerver_realmauditlog
WHERE
event_type in ('user_created', 'user_deactivated', 'user_activated', 'user_reactivated') AND
event_type in ({user_created}, {user_activated}, {user_deactivated}, {user_reactivated}) AND
event_time < %%(time_end)s
GROUP BY modified_user_id
) ral2
@@ -408,8 +408,11 @@ check_realmauditlog_by_user_query = """
ON
ral1.modified_user_id = zerver_userprofile.id
WHERE
ral1.event_type in ('user_created', 'user_activated', 'user_reactivated')
"""
ral1.event_type in ({user_created}, {user_activated}, {user_reactivated})
""".format(user_created=RealmAuditLog.USER_CREATED,
user_activated=RealmAuditLog.USER_ACTIVATED,
user_deactivated=RealmAuditLog.USER_DEACTIVATED,
user_reactivated=RealmAuditLog.USER_REACTIVATED)
check_useractivityinterval_by_user_query = """
INSERT INTO analytics_usercount

View File

@@ -15,7 +15,7 @@ def compute_stats(log_level: int) -> None:
one_week_ago = timestamp_to_datetime(time.time()) - datetime.timedelta(weeks=1)
mit_query = Message.objects.filter(sender__realm__string_id="zephyr",
recipient__type=Recipient.STREAM,
pub_date__gt=one_week_ago)
date_sent__gt=one_week_ago)
for bot_sender_start in ["imap.", "rcmd.", "sys."]:
mit_query = mit_query.exclude(sender__email__startswith=(bot_sender_start))
# Filtering for "/" covers tabbott/extra@ and all the daemon/foo bots.

View File

@@ -1,8 +1,7 @@
import sys
from argparse import ArgumentParser
from typing import Any
from django.core.management.base import BaseCommand
from django.core.management.base import BaseCommand, CommandError
from analytics.lib.counts import do_drop_all_analytics_tables
@@ -18,5 +17,4 @@ class Command(BaseCommand):
if options['force']:
do_drop_all_analytics_tables()
else:
print("Would delete all data from analytics tables (!); use --force to do so.")
sys.exit(1)
raise CommandError("Would delete all data from analytics tables (!); use --force to do so.")

View File

@@ -1,8 +1,7 @@
import sys
from argparse import ArgumentParser
from typing import Any
from django.core.management.base import BaseCommand
from django.core.management.base import BaseCommand, CommandError
from analytics.lib.counts import COUNT_STATS, do_drop_single_stat
@@ -20,10 +19,8 @@ class Command(BaseCommand):
def handle(self, *args: Any, **options: Any) -> None:
property = options['property']
if property not in COUNT_STATS:
print("Invalid property: %s" % (property,))
sys.exit(1)
raise CommandError("Invalid property: %s" % (property,))
if not options['force']:
print("No action taken. Use --force.")
sys.exit(1)
raise CommandError("No action taken. Use --force.")
do_drop_single_stat(property)

View File

@@ -1,6 +1,6 @@
import datetime
from argparse import ArgumentParser
from typing import Any
from typing import Any, Optional
from django.db.models import Count, QuerySet
from django.utils.timezone import now as timezone_now
@@ -56,7 +56,7 @@ Usage examples:
print("%25s %15d" % (count[1], count[0]))
print("Total:", total)
def handle(self, *args: Any, **options: str) -> None:
def handle(self, *args: Any, **options: Optional[str]) -> None:
realm = self.get_realm(options)
if options["user"] is None:
if options["target"] == "server" and realm is None:

View File

@@ -1,6 +1,6 @@
from datetime import datetime, timedelta
from datetime import timedelta
from typing import Any, Dict, List, Mapping, Optional, Type
import mock
from django.core.management.base import BaseCommand
from django.utils.timezone import now as timezone_now
@@ -12,9 +12,10 @@ from analytics.lib.time_utils import time_range
from analytics.models import BaseCount, FillState, RealmCount, UserCount, \
StreamCount, InstallationCount
from zerver.lib.actions import do_change_is_admin, STREAM_ASSIGNMENT_COLORS
from zerver.lib.create_user import create_user
from zerver.lib.timestamp import floor_to_day
from zerver.models import Realm, UserProfile, Stream, Client, \
RealmAuditLog, Recipient, Subscription
from zerver.models import Realm, Stream, Client, \
Recipient, Subscription
class Command(BaseCommand):
help = """Populates analytics tables with randomly generated data."""
@@ -22,20 +23,6 @@ class Command(BaseCommand):
DAYS_OF_DATA = 100
random_seed = 26
def create_user(self, email: str,
full_name: str,
is_staff: bool,
date_joined: datetime,
realm: Realm) -> UserProfile:
user = UserProfile.objects.create(
email=email, full_name=full_name, is_staff=is_staff,
realm=realm, short_name=full_name, pointer=-1, last_pointer_updater='none',
api_key='42', date_joined=date_joined)
RealmAuditLog.objects.create(
realm=realm, modified_user=user, event_type=RealmAuditLog.USER_CREATED,
event_time=user.date_joined)
return user
def generate_fixture_data(self, stat: CountStat, business_hours_base: float,
non_business_hours_base: float, growth: float,
autocorrelation: float, spikiness: float,
@@ -68,7 +55,10 @@ class Command(BaseCommand):
last_end_time = floor_to_day(timezone_now())
realm = Realm.objects.create(
string_id='analytics', name='Analytics', date_created=installation_time)
shylock = self.create_user('shylock@analytics.ds', 'Shylock', True, installation_time, realm)
with mock.patch("zerver.lib.create_user.timezone_now", return_value=installation_time):
shylock = create_user('shylock@analytics.ds', 'Shylock', realm,
full_name='Shylock', short_name='shylock',
is_realm_admin=True)
do_change_is_admin(shylock, True)
stream = Stream.objects.create(
name='all', realm=realm, date_created=installation_time)

View File

@@ -2,7 +2,7 @@ import datetime
from argparse import ArgumentParser
from typing import Any, List
from django.core.management.base import BaseCommand
from django.core.management.base import BaseCommand, CommandError
from django.db.models import Count
from django.utils.timezone import now as timezone_now
@@ -33,32 +33,32 @@ class Command(BaseCommand):
def messages_sent_by(self, user: UserProfile, days_ago: int) -> int:
sent_time_cutoff = timezone_now() - datetime.timedelta(days=days_ago)
return human_messages.filter(sender=user, pub_date__gt=sent_time_cutoff).count()
return human_messages.filter(sender=user, date_sent__gt=sent_time_cutoff).count()
def total_messages(self, realm: Realm, days_ago: int) -> int:
sent_time_cutoff = timezone_now() - datetime.timedelta(days=days_ago)
return Message.objects.filter(sender__realm=realm, pub_date__gt=sent_time_cutoff).count()
return Message.objects.filter(sender__realm=realm, date_sent__gt=sent_time_cutoff).count()
def human_messages(self, realm: Realm, days_ago: int) -> int:
sent_time_cutoff = timezone_now() - datetime.timedelta(days=days_ago)
return human_messages.filter(sender__realm=realm, pub_date__gt=sent_time_cutoff).count()
return human_messages.filter(sender__realm=realm, date_sent__gt=sent_time_cutoff).count()
def api_messages(self, realm: Realm, days_ago: int) -> int:
return (self.total_messages(realm, days_ago) - self.human_messages(realm, days_ago))
def stream_messages(self, realm: Realm, days_ago: int) -> int:
sent_time_cutoff = timezone_now() - datetime.timedelta(days=days_ago)
return human_messages.filter(sender__realm=realm, pub_date__gt=sent_time_cutoff,
return human_messages.filter(sender__realm=realm, date_sent__gt=sent_time_cutoff,
recipient__type=Recipient.STREAM).count()
def private_messages(self, realm: Realm, days_ago: int) -> int:
sent_time_cutoff = timezone_now() - datetime.timedelta(days=days_ago)
return human_messages.filter(sender__realm=realm, pub_date__gt=sent_time_cutoff).exclude(
return human_messages.filter(sender__realm=realm, date_sent__gt=sent_time_cutoff).exclude(
recipient__type=Recipient.STREAM).exclude(recipient__type=Recipient.HUDDLE).count()
def group_private_messages(self, realm: Realm, days_ago: int) -> int:
sent_time_cutoff = timezone_now() - datetime.timedelta(days=days_ago)
return human_messages.filter(sender__realm=realm, pub_date__gt=sent_time_cutoff).exclude(
return human_messages.filter(sender__realm=realm, date_sent__gt=sent_time_cutoff).exclude(
recipient__type=Recipient.STREAM).exclude(recipient__type=Recipient.PERSONAL).count()
def report_percentage(self, numerator: float, denominator: float, text: str) -> None:
@@ -73,8 +73,7 @@ class Command(BaseCommand):
try:
realms = [get_realm(string_id) for string_id in options['realms']]
except Realm.DoesNotExist as e:
print(e)
exit(1)
raise CommandError(e)
else:
realms = Realm.objects.all()
@@ -131,7 +130,7 @@ class Command(BaseCommand):
user_profile__in=user_profiles, active=True)
# Streams not in home view
non_home_view = active_user_subs.filter(in_home_view=False).values(
non_home_view = active_user_subs.filter(is_muted=True).values(
"user_profile").annotate(count=Count("user_profile"))
print("%d users have %d streams not in home view" % (
len(non_home_view), sum([elt["count"] for elt in non_home_view])))

View File

@@ -1,7 +1,7 @@
from argparse import ArgumentParser
from typing import Any
from django.core.management.base import BaseCommand
from django.core.management.base import BaseCommand, CommandError
from django.db.models import Q
from zerver.models import Message, Realm, \
@@ -19,8 +19,7 @@ class Command(BaseCommand):
try:
realms = [get_realm(string_id) for string_id in options['realms']]
except Realm.DoesNotExist as e:
print(e)
exit(1)
raise CommandError(e)
else:
realms = Realm.objects.all()

View File

@@ -2,7 +2,7 @@ import datetime
from argparse import ArgumentParser
from typing import Any
from django.core.management.base import BaseCommand
from django.core.management.base import BaseCommand, CommandError
from django.utils.timezone import now as timezone_now
from zerver.models import Message, Realm, Stream, UserProfile, get_realm
@@ -17,15 +17,14 @@ class Command(BaseCommand):
def messages_sent_by(self, user: UserProfile, week: int) -> int:
start = timezone_now() - datetime.timedelta(days=(week + 1)*7)
end = timezone_now() - datetime.timedelta(days=week*7)
return Message.objects.filter(sender=user, pub_date__gt=start, pub_date__lte=end).count()
return Message.objects.filter(sender=user, date_sent__gt=start, date_sent__lte=end).count()
def handle(self, *args: Any, **options: Any) -> None:
if options['realms']:
try:
realms = [get_realm(string_id) for string_id in options['realms']]
except Realm.DoesNotExist as e:
print(e)
exit(1)
raise CommandError(e)
else:
realms = Realm.objects.all()
@@ -38,5 +37,5 @@ class Command(BaseCommand):
for user_profile in user_profiles:
print("%35s" % (user_profile.email,), end=' ')
for week in range(10):
print("%5d" % (self.messages_sent_by(user_profile, week)), end=' ')
print("%5d" % (self.messages_sent_by(user_profile, week),), end=' ')
print("")

View File

@@ -1,7 +1,7 @@
from datetime import datetime, timedelta
from typing import Any, Dict, List, Optional, Tuple, Type
import mock
import ujson
from django.apps import apps
from django.db import models
@@ -22,6 +22,7 @@ from zerver.lib.actions import do_activate_user, do_create_user, \
do_deactivate_user, do_reactivate_user, update_user_activity_interval, \
do_invite_users, do_revoke_user_invite, do_resend_user_invite_email, \
InvitationError
from zerver.lib.create_user import create_user
from zerver.lib.timestamp import TimezoneNotUTCException, floor_to_day
from zerver.lib.topic import DB_TOPIC_NAME
from zerver.models import Client, Huddle, Message, Realm, \
@@ -36,6 +37,7 @@ class AnalyticsTestCase(TestCase):
TIME_LAST_HOUR = TIME_ZERO - HOUR
def setUp(self) -> None:
super().setUp()
self.default_realm = Realm.objects.create(
string_id='realmtest', name='Realm Test', date_created=self.TIME_ZERO - 2*self.DAY)
# used to generate unique names in self.create_*
@@ -51,16 +53,21 @@ class AnalyticsTestCase(TestCase):
'date_joined': self.TIME_LAST_HOUR,
'full_name': 'full_name',
'short_name': 'short_name',
'pointer': -1,
'last_pointer_updater': 'seems unused?',
'realm': self.default_realm,
'api_key': '42'}
'is_active': True,
'is_bot': False,
'realm': self.default_realm}
for key, value in defaults.items():
kwargs[key] = kwargs.get(key, value)
kwargs['delivery_email'] = kwargs['email']
user_profile = UserProfile.objects.create(**kwargs)
# TODO: Make this pass user_profile.full_clean()
return user_profile
with mock.patch("zerver.lib.create_user.timezone_now", return_value=kwargs['date_joined']):
pass_kwargs = {} # type: Dict[str, Any]
if kwargs['is_bot']:
pass_kwargs['bot_type'] = UserProfile.DEFAULT_BOT
pass_kwargs['bot_owner'] = None
return create_user(kwargs['email'], 'password', kwargs['realm'],
active=kwargs['is_active'],
full_name=kwargs['full_name'], short_name=kwargs['short_name'],
is_realm_admin=True, **pass_kwargs)
def create_stream_with_recipient(self, **kwargs: Any) -> Tuple[Stream, Recipient]:
self.name_counter += 1
@@ -88,7 +95,7 @@ class AnalyticsTestCase(TestCase):
'recipient': recipient,
DB_TOPIC_NAME: 'subject',
'content': 'hi',
'pub_date': self.TIME_LAST_HOUR,
'date_sent': self.TIME_LAST_HOUR,
'sending_client': get_client("website")}
for key, value in defaults.items():
kwargs[key] = kwargs.get(key, value)
@@ -318,7 +325,7 @@ class TestCountStats(AnalyticsTestCase):
recipient = self.create_stream_with_recipient(
name='stream %s' % (minutes_ago,), realm=self.second_realm,
date_created=creation_time)[1]
self.create_message(user, recipient, pub_date=creation_time)
self.create_message(user, recipient, date_sent=creation_time)
self.hourly_user = get_user('user-1@second.analytics', self.second_realm)
self.daily_user = get_user('user-61@second.analytics', self.second_realm)
@@ -363,8 +370,8 @@ class TestCountStats(AnalyticsTestCase):
bot = self.create_user(is_bot=True)
human1 = self.create_user()
human2 = self.create_user()
recipient_human1 = Recipient.objects.create(type_id=human1.id,
type=Recipient.PERSONAL)
recipient_human1 = Recipient.objects.get(type_id=human1.id,
type=Recipient.PERSONAL)
recipient_stream = self.create_stream_with_recipient()[1]
recipient_huddle = self.create_huddle_with_recipient()[1]
@@ -418,9 +425,9 @@ class TestCountStats(AnalyticsTestCase):
self.create_message(user2, recipient_huddle2)
# private messages
recipient_user1 = Recipient.objects.create(type_id=user1.id, type=Recipient.PERSONAL)
recipient_user2 = Recipient.objects.create(type_id=user2.id, type=Recipient.PERSONAL)
recipient_user3 = Recipient.objects.create(type_id=user3.id, type=Recipient.PERSONAL)
recipient_user1 = Recipient.objects.get(type_id=user1.id, type=Recipient.PERSONAL)
recipient_user2 = Recipient.objects.get(type_id=user2.id, type=Recipient.PERSONAL)
recipient_user3 = Recipient.objects.get(type_id=user3.id, type=Recipient.PERSONAL)
self.create_message(user1, recipient_user2)
self.create_message(user2, recipient_user1)
self.create_message(user3, recipient_user3)
@@ -452,7 +459,7 @@ class TestCountStats(AnalyticsTestCase):
self.current_property = stat.property
user = self.create_user(id=1000)
user_recipient = Recipient.objects.create(type_id=user.id, type=Recipient.PERSONAL)
user_recipient = Recipient.objects.get(type_id=user.id, type=Recipient.PERSONAL)
stream_recipient = self.create_stream_with_recipient(id=1000)[1]
huddle_recipient = self.create_huddle_with_recipient(id=1000)[1]
@@ -472,7 +479,7 @@ class TestCountStats(AnalyticsTestCase):
user1 = self.create_user(is_bot=True)
user2 = self.create_user()
recipient_user2 = Recipient.objects.create(type_id=user2.id, type=Recipient.PERSONAL)
recipient_user2 = Recipient.objects.get(type_id=user2.id, type=Recipient.PERSONAL)
recipient_stream = self.create_stream_with_recipient()[1]
recipient_huddle = self.create_huddle_with_recipient()[1]
@@ -508,7 +515,7 @@ class TestCountStats(AnalyticsTestCase):
bot = self.create_user(is_bot=True)
human1 = self.create_user()
human2 = self.create_user()
recipient_human1 = Recipient.objects.create(type_id=human1.id, type=Recipient.PERSONAL)
recipient_human1 = Recipient.objects.get(type_id=human1.id, type=Recipient.PERSONAL)
stream1, recipient_stream1 = self.create_stream_with_recipient()
stream2, recipient_stream2 = self.create_stream_with_recipient()
@@ -885,7 +892,7 @@ class TestActiveUsersAudit(AnalyticsTestCase):
self.stat = COUNT_STATS['active_users_audit:is_bot:day']
self.current_property = self.stat.property
def add_event(self, event_type: str, days_offset: float,
def add_event(self, event_type: int, days_offset: float,
user: Optional[UserProfile]=None) -> None:
hours_offset = int(24*days_offset)
if user is None:
@@ -979,7 +986,7 @@ class TestActiveUsersAudit(AnalyticsTestCase):
# doesn't go through do_create_user. Mainly just want to make sure that
# that situation doesn't throw an error.
def test_empty_realm_or_user_with_no_relevant_activity(self) -> None:
self.add_event('unrelated', 1)
self.add_event(RealmAuditLog.USER_SOFT_ACTIVATED, 1)
self.create_user() # also test a user with no RealmAuditLog entries
Realm.objects.create(string_id='moo', name='moo')
do_fill_count_stat_at_hour(self.stat, self.TIME_ZERO)
@@ -987,14 +994,14 @@ class TestActiveUsersAudit(AnalyticsTestCase):
def test_max_audit_entry_is_unrelated(self) -> None:
self.add_event(RealmAuditLog.USER_CREATED, 1)
self.add_event('unrelated', .5)
self.add_event(RealmAuditLog.USER_SOFT_ACTIVATED, .5)
do_fill_count_stat_at_hour(self.stat, self.TIME_ZERO)
self.assertTableState(UserCount, ['subgroup'], [['false']])
# Simultaneous related audit entries should not be allowed, and so not testing for that.
def test_simultaneous_unrelated_audit_entry(self) -> None:
self.add_event(RealmAuditLog.USER_CREATED, 1)
self.add_event('unrelated', 1)
self.add_event(RealmAuditLog.USER_SOFT_ACTIVATED, 1)
do_fill_count_stat_at_hour(self.stat, self.TIME_ZERO)
self.assertTableState(UserCount, ['subgroup'], [['false']])

View File

@@ -3,6 +3,8 @@ from typing import List, Optional
import mock
from django.utils.timezone import utc
from django.http import HttpResponse
import ujson
from analytics.lib.counts import COUNT_STATS, CountStat
from analytics.lib.time_utils import time_range
@@ -13,7 +15,9 @@ from analytics.views import rewrite_client_arrays, \
from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.timestamp import ceiling_to_day, \
ceiling_to_hour, datetime_to_timestamp
from zerver.models import Client, get_realm
from zerver.lib.actions import do_create_multiuse_invite_link, \
do_send_realm_reactivation_email
from zerver.models import Client, get_realm, MultiuseInvite
class TestStatsEndpoint(ZulipTestCase):
def test_stats(self) -> None:
@@ -68,6 +72,7 @@ class TestStatsEndpoint(ZulipTestCase):
class TestGetChartData(ZulipTestCase):
def setUp(self) -> None:
super().setUp()
self.realm = get_realm('zulip')
self.user = self.example_user('hamlet')
self.login(self.user.email)
@@ -327,6 +332,215 @@ class TestGetChartData(ZulipTestCase):
{'chart_name': 'number_of_humans'})
self.assert_json_success(result)
class TestSupportEndpoint(ZulipTestCase):
def test_search(self) -> None:
def check_hamlet_user_query_result(result: HttpResponse) -> None:
self.assert_in_success_response(['<span class="label">user</span>\n', '<h3>King Hamlet</h3>',
'<b>Email</b>: hamlet@zulip.com', '<b>Is active</b>: True<br>',
'<b>Admins</b>: iago@zulip.com\n',
'class="copy-button" data-copytext="iago@zulip.com"'
], result)
def check_zulip_realm_query_result(result: HttpResponse) -> None:
zulip_realm = get_realm("zulip")
self.assert_in_success_response(['<input type="hidden" name="realm_id" value="%s"' % (zulip_realm.id,),
'Zulip Dev</h3>',
'<option value="1" selected>Self Hosted</option>',
'<option value="2" >Limited</option>',
'input type="number" name="discount" value="None"',
'<option value="active" selected>Active</option>',
'<option value="deactivated" >Deactivated</option>',
'scrub-realm-button">',
'data-string-id="zulip"'], result)
def check_lear_realm_query_result(result: HttpResponse) -> None:
lear_realm = get_realm("lear")
self.assert_in_success_response(['<input type="hidden" name="realm_id" value="%s"' % (lear_realm.id,),
'Lear &amp; Co.</h3>',
'<option value="1" selected>Self Hosted</option>',
'<option value="2" >Limited</option>',
'input type="number" name="discount" value="None"',
'<option value="active" selected>Active</option>',
'<option value="deactivated" >Deactivated</option>',
'scrub-realm-button">',
'data-string-id="lear"'], result)
def check_preregistration_user_query_result(result: HttpResponse, email: str, invite: Optional[bool]=False) -> None:
self.assert_in_success_response(['<span class="label">preregistration user</span>\n',
'<b>Email</b>: {}'.format(email),
], result)
if invite:
self.assert_in_success_response(['<span class="label">invite</span>'], result)
self.assert_in_success_response(['<b>Expires in</b>: 1\xa0week, 3',
'<b>Status</b>: Link has never been clicked'], result)
self.assert_in_success_response([], result)
else:
self.assert_not_in_success_response(['<span class="label">invite</span>'], result)
self.assert_in_success_response(['<b>Expires in</b>: 1\xa0day',
'<b>Status</b>: Link has never been clicked'], result)
def check_realm_creation_query_result(result: HttpResponse, email: str) -> None:
self.assert_in_success_response(['<span class="label">preregistration user</span>\n',
'<span class="label">realm creation</span>\n',
'<b>Link</b>: http://zulip.testserver/accounts/do_confirm/',
'<b>Expires in</b>: 1\xa0day<br>\n'
], result)
def check_multiuse_invite_link_query_result(result: HttpResponse) -> None:
self.assert_in_success_response(['<span class="label">multiuse invite</span>\n',
'<b>Link</b>: http://zulip.testserver/join/',
'<b>Expires in</b>: 1\xa0week, 3'
], result)
def check_realm_reactivation_link_query_result(result: HttpResponse) -> None:
self.assert_in_success_response(['<span class="label">realm reactivation</span>\n',
'<b>Link</b>: http://zulip.testserver/reactivate/',
'<b>Expires in</b>: 1\xa0day'
], result)
cordelia_email = self.example_email("cordelia")
self.login(cordelia_email)
result = self.client_get("/activity/support")
self.assertEqual(result.status_code, 302)
self.assertEqual(result["Location"], "/login/")
iago_email = self.example_email("iago")
self.login(iago_email)
result = self.client_get("/activity/support")
self.assert_in_success_response(['<input type="text" name="q" class="input-xxlarge search-query"'], result)
result = self.client_get("/activity/support", {"q": "hamlet@zulip.com"})
check_hamlet_user_query_result(result)
check_zulip_realm_query_result(result)
result = self.client_get("/activity/support", {"q": "lear"})
check_lear_realm_query_result(result)
result = self.client_get("/activity/support", {"q": "http://lear.testserver"})
check_lear_realm_query_result(result)
with self.settings(REALM_HOSTS={'zulip': 'localhost'}):
result = self.client_get("/activity/support", {"q": "http://localhost"})
check_zulip_realm_query_result(result)
result = self.client_get("/activity/support", {"q": "hamlet@zulip.com, lear"})
check_hamlet_user_query_result(result)
check_zulip_realm_query_result(result)
check_lear_realm_query_result(result)
result = self.client_get("/activity/support", {"q": "lear, Hamlet <hamlet@zulip.com>"})
check_hamlet_user_query_result(result)
check_zulip_realm_query_result(result)
check_lear_realm_query_result(result)
self.client_post('/accounts/home/', {'email': self.nonreg_email("test")})
self.login(iago_email)
result = self.client_get("/activity/support", {"q": self.nonreg_email("test")})
check_preregistration_user_query_result(result, self.nonreg_email("test"))
check_zulip_realm_query_result(result)
stream_ids = [self.get_stream_id("Denmark")]
invitee_emails = [self.nonreg_email("test1")]
self.client_post("/json/invites", {"invitee_emails": invitee_emails,
"stream_ids": ujson.dumps(stream_ids), "invite_as": 1})
result = self.client_get("/activity/support", {"q": self.nonreg_email("test1")})
check_preregistration_user_query_result(result, self.nonreg_email("test1"), invite=True)
check_zulip_realm_query_result(result)
email = self.nonreg_email('alice')
self.client_post('/new/', {'email': email})
result = self.client_get("/activity/support", {"q": email})
check_realm_creation_query_result(result, email)
do_create_multiuse_invite_link(self.example_user("hamlet"), invited_as=1)
result = self.client_get("/activity/support", {"q": "zulip"})
check_multiuse_invite_link_query_result(result)
check_zulip_realm_query_result(result)
MultiuseInvite.objects.all().delete()
do_send_realm_reactivation_email(get_realm("zulip"))
result = self.client_get("/activity/support", {"q": "zulip"})
check_realm_reactivation_link_query_result(result)
check_zulip_realm_query_result(result)
def test_change_plan_type(self) -> None:
cordelia = self.example_user("cordelia")
self.login(cordelia.email)
result = self.client_post("/activity/support", {"realm_id": "%s" % (cordelia.realm_id,), "plan_type": "2"})
self.assertEqual(result.status_code, 302)
self.assertEqual(result["Location"], "/login/")
iago = self.example_user("iago")
self.login(iago.email)
with mock.patch("analytics.views.do_change_plan_type") as m:
result = self.client_post("/activity/support", {"realm_id": "%s" % (iago.realm_id,), "plan_type": "2"})
m.assert_called_once_with(get_realm("zulip"), 2)
self.assert_in_success_response(["Plan type of Zulip Dev changed from self hosted to limited"], result)
def test_attach_discount(self) -> None:
lear_realm = get_realm("lear")
cordelia_email = self.example_email("cordelia")
self.login(cordelia_email)
result = self.client_post("/activity/support", {"realm_id": "%s" % (lear_realm.id,), "discount": "25"})
self.assertEqual(result.status_code, 302)
self.assertEqual(result["Location"], "/login/")
iago_email = self.example_email("iago")
self.login(iago_email)
with mock.patch("analytics.views.attach_discount_to_realm") as m:
result = self.client_post("/activity/support", {"realm_id": "%s" % (lear_realm.id,), "discount": "25"})
m.assert_called_once_with(get_realm("lear"), 25)
self.assert_in_success_response(["Discount of Lear &amp; Co. changed to 25 from None"], result)
def test_activate_or_deactivate_realm(self) -> None:
lear_realm = get_realm("lear")
cordelia_email = self.example_email("cordelia")
self.login(cordelia_email)
result = self.client_post("/activity/support", {"realm_id": "%s" % (lear_realm.id,), "status": "deactivated"})
self.assertEqual(result.status_code, 302)
self.assertEqual(result["Location"], "/login/")
iago_email = self.example_email("iago")
self.login(iago_email)
with mock.patch("analytics.views.do_deactivate_realm") as m:
result = self.client_post("/activity/support", {"realm_id": "%s" % (lear_realm.id,), "status": "deactivated"})
m.assert_called_once_with(lear_realm, self.example_user("iago"))
self.assert_in_success_response(["Lear &amp; Co. deactivated"], result)
with mock.patch("analytics.views.do_reactivate_realm") as m:
result = self.client_post("/activity/support", {"realm_id": "%s" % (lear_realm.id,), "status": "active"})
m.assert_called_once_with(lear_realm)
self.assert_in_success_response(["Lear &amp; Co. reactivated."], result)
def test_scrub_realm(self) -> None:
lear_realm = get_realm("lear")
cordelia_email = self.example_email("cordelia")
self.login(cordelia_email)
result = self.client_post("/activity/support", {"realm_id": "%s" % (lear_realm.id,), "discount": "25"})
self.assertEqual(result.status_code, 302)
self.assertEqual(result["Location"], "/login/")
iago_email = self.example_email("iago")
self.login(iago_email)
with mock.patch("analytics.views.do_scrub_realm") as m:
result = self.client_post("/activity/support", {"realm_id": "%s" % (lear_realm.id,), "scrub_realm": "scrub_realm"})
m.assert_called_once_with(lear_realm)
self.assert_in_success_response(["Lear &amp; Co. scrubbed"], result)
with mock.patch("analytics.views.do_scrub_realm") as m:
result = self.client_post("/activity/support", {"realm_id": "%s" % (lear_realm.id,)})
m.assert_not_called()
class TestGetChartDataHelpers(ZulipTestCase):
# last_successful_fill is in analytics/models.py, but get_chart_data is
# the only function that uses it at the moment

View File

@@ -7,6 +7,8 @@ i18n_urlpatterns = [
# Server admin (user_profile.is_staff) visible stats pages
url(r'^activity$', analytics.views.get_activity,
name='analytics.views.get_activity'),
url(r'^activity/support$', analytics.views.support,
name='analytics.views.support'),
url(r'^realm_activity/(?P<realm_str>[\S]+)/$', analytics.views.get_realm_activity,
name='analytics.views.get_realm_activity'),
url(r'^user_activity/(?P<email>[\S]+)/$', analytics.views.get_user_activity,

View File

@@ -1,12 +1,14 @@
import itertools
import logging
import re
import time
import urllib
from collections import defaultdict
from datetime import datetime, timedelta
from decimal import Decimal
from typing import Any, Callable, Dict, List, \
Optional, Set, Tuple, Type, Union, cast
Optional, Set, Tuple, Type, Union
import pytz
from django.conf import settings
@@ -18,21 +20,34 @@ from django.shortcuts import render
from django.template import loader
from django.utils.timezone import now as timezone_now, utc as timezone_utc
from django.utils.translation import ugettext as _
from django.utils.timesince import timesince
from django.core.validators import URLValidator
from django.core.exceptions import ValidationError
from jinja2 import Markup as mark_safe
from analytics.lib.counts import COUNT_STATS, CountStat
from analytics.lib.time_utils import time_range
from analytics.models import BaseCount, InstallationCount, \
RealmCount, StreamCount, UserCount, last_successful_fill, installation_epoch
from confirmation.models import Confirmation, confirmation_url, _properties
from zerver.decorator import require_server_admin, require_server_admin_api, \
to_non_negative_int, to_utc_datetime, zulip_login_required, require_non_guest_user
from zerver.lib.exceptions import JsonableError
from zerver.lib.json_encoder_for_html import JSONEncoderForHTML
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import json_success
from zerver.lib.timestamp import convert_to_UTC, timestamp_to_datetime
from zerver.models import Client, get_realm, Realm, \
UserActivity, UserActivityInterval, UserProfile
from zerver.lib.realm_icon import realm_icon_url
from zerver.views.invite import get_invitee_emails_set
from zerver.lib.subdomains import get_subdomain_from_hostname
from zerver.lib.actions import do_change_plan_type, do_deactivate_realm, \
do_reactivate_realm, do_scrub_realm
from confirmation.settings import STATUS_ACTIVE
if settings.BILLING_ENABLED:
from corporate.lib.stripe import attach_discount_to_realm, get_discount_for_realm
from zerver.models import Client, get_realm, Realm, UserActivity, UserActivityInterval, \
UserProfile, PreregistrationUser, MultiuseInvite
if settings.ZILENCER_ENABLED:
from zilencer.models import RemoteInstallationCount, RemoteRealmCount, \
@@ -54,22 +69,23 @@ def render_stats(request: HttpRequest, data_url_suffix: str, target_name: str,
return render(request,
'analytics/stats.html',
context=dict(target_name=target_name,
page_params=JSONEncoderForHTML().encode(page_params)))
page_params=page_params))
@zulip_login_required
def stats(request: HttpRequest) -> HttpResponse:
realm = request.user.realm
if request.user.is_guest:
# TODO: Make @zulip_login_required pass the UserProfile so we
# can use @require_non_guest_human_user
# can use @require_member_or_admin
raise JsonableError(_("Not allowed for guest users"))
return render_stats(request, '', realm.name or realm.string_id)
@require_server_admin
@has_request_variables
def stats_for_realm(request: HttpRequest, realm_str: str) -> HttpResponse:
realm = get_realm(realm_str)
if realm is None:
try:
realm = get_realm(realm_str)
except Realm.DoesNotExist:
return HttpResponseNotFound("Realm %s does not exist" % (realm_str,))
return render_stats(request, '/realm/%s' % (realm_str,), realm.name or realm.string_id)
@@ -86,8 +102,9 @@ def stats_for_remote_realm(request: HttpRequest, remote_server_id: str,
@has_request_variables
def get_chart_data_for_realm(request: HttpRequest, user_profile: UserProfile,
realm_str: str, **kwargs: Any) -> HttpResponse:
realm = get_realm(realm_str)
if realm is None:
try:
realm = get_realm(realm_str)
except Realm.DoesNotExist:
raise JsonableError(_("Invalid organization"))
return get_chart_data(request=request, user_profile=user_profile, realm=realm, **kwargs)
@@ -109,7 +126,7 @@ def stats_for_installation(request: HttpRequest) -> HttpResponse:
def stats_for_remote_installation(request: HttpRequest, remote_server_id: str) -> HttpResponse:
server = RemoteZulipServer.objects.get(id=remote_server_id)
return render_stats(request, '/remote/%s/installation' % (server.id,),
'remote Installation %s' % (server.hostname), True, True)
'remote Installation %s' % (server.hostname,), True, True)
@require_server_admin_api
@has_request_variables
@@ -227,7 +244,7 @@ def get_chart_data(request: HttpRequest, user_profile: UserProfile, chart_name:
if end is None:
end = max(last_successful_fill(stat.property) or
datetime.min.replace(tzinfo=timezone_utc) for stat in stats)
if end is None or start > end:
if start > end:
logging.warning("User from realm %s attempted to access /stats, but the computed "
"start time: %s (creation of realm or installation) is later than the computed "
"end time: %s (last successful analytics update). Is the "
@@ -249,7 +266,7 @@ def get_chart_data(request: HttpRequest, user_profile: UserProfile, chart_name:
id_value = {
InstallationCount: -1,
RealmCount: realm.id,
RemoteInstallationCount: cast(RemoteZulipServer, server).id if server is not None else None,
RemoteInstallationCount: server.id if server is not None else None,
# TODO: RemoteRealmCount logic doesn't correctly handle
# filtering by server_id as well.
RemoteRealmCount: remote_realm_id,
@@ -390,7 +407,7 @@ def get_realm_day_counts() -> Dict[str, Dict[str, str]]:
query = '''
select
r.string_id,
(now()::date - pub_date::date) age,
(now()::date - date_sent::date) age,
count(*) cnt
from zerver_message m
join zerver_userprofile up on up.id = m.sender_id
@@ -399,7 +416,7 @@ def get_realm_day_counts() -> Dict[str, Dict[str, str]]:
where
(not up.is_bot)
and
pub_date > now()::date - interval '8 day'
date_sent > now()::date - interval '8 day'
and
c.name not in ('zephyr_mirror', 'ZulipMonitoring')
group by
@@ -442,6 +459,9 @@ def get_realm_day_counts() -> Dict[str, Dict[str, str]]:
return result
def get_plan_name(plan_type: int) -> str:
return ['', 'self hosted', 'limited', 'standard', 'open source'][plan_type]
def realm_summary_table(realm_minutes: Dict[str, float]) -> str:
now = timezone_now()
@@ -502,7 +522,7 @@ def realm_summary_table(realm_minutes: Dict[str, float]) -> str:
FROM (
SELECT
realm.id as realm_id,
up.email
up.delivery_email
FROM zerver_useractivity ua
JOIN zerver_userprofile up
ON up.id = ua.user_profile_id
@@ -519,7 +539,7 @@ def realm_summary_table(realm_minutes: Dict[str, float]) -> str:
'/json/users/me/pointer',
'update_pointer_backend'
)
GROUP by realm.id, up.email
GROUP by realm.id, up.delivery_email
HAVING max(last_visit) > now() - interval '7 day'
) as wau_users
GROUP BY realm_id
@@ -557,15 +577,14 @@ def realm_summary_table(realm_minutes: Dict[str, float]) -> str:
# Fetch all the realm administrator users
realm_admins = defaultdict(list) # type: Dict[str, List[str]]
for up in UserProfile.objects.select_related("realm").filter(
is_realm_admin=True,
role=UserProfile.ROLE_REALM_ADMINISTRATOR,
is_active=True
):
realm_admins[up.realm.string_id].append(up.email)
realm_admins[up.realm.string_id].append(up.delivery_email)
for row in rows:
row['date_created_day'] = row['date_created'].strftime('%Y-%m-%d')
row['plan_type_string'] = [
'', 'self hosted', 'limited', 'standard', 'open source'][row['plan_type']]
row['plan_type_string'] = get_plan_name(row['plan_type'])
row['age_days'] = int((now - row['date_created']).total_seconds()
/ 86400)
row['is_new'] = row['age_days'] < 12 * 7
@@ -721,7 +740,7 @@ def sent_messages_report(realm: str) -> str:
) as series
left join (
select
pub_date::date pub_date,
date_sent::date date_sent,
count(*) cnt
from zerver_message m
join zerver_userprofile up on up.id = m.sender_id
@@ -731,16 +750,16 @@ def sent_messages_report(realm: str) -> str:
and
(not up.is_bot)
and
pub_date > now() - interval '2 week'
date_sent > now() - interval '2 week'
group by
pub_date::date
date_sent::date
order by
pub_date::date
date_sent::date
) humans on
series.day = humans.pub_date
series.day = humans.date_sent
left join (
select
pub_date::date pub_date,
date_sent::date date_sent,
count(*) cnt
from zerver_message m
join zerver_userprofile up on up.id = m.sender_id
@@ -750,13 +769,13 @@ def sent_messages_report(realm: str) -> str:
and
up.is_bot
and
pub_date > now() - interval '2 week'
date_sent > now() - interval '2 week'
group by
pub_date::date
date_sent::date
order by
pub_date::date
date_sent::date
) bots on
series.day = bots.pub_date
series.day = bots.date_sent
'''
cursor = connection.cursor()
cursor.execute(query, [realm, realm])
@@ -1011,6 +1030,134 @@ def get_activity(request: HttpRequest) -> HttpResponse:
context=dict(data=data, title=title, is_home=True),
)
def get_confirmations(types: List[int], object_ids: List[int],
hostname: Optional[str]=None) -> List[Dict[str, Any]]:
lowest_datetime = timezone_now() - timedelta(days=30)
confirmations = Confirmation.objects.filter(type__in=types, object_id__in=object_ids,
date_sent__gte=lowest_datetime)
confirmation_dicts = []
for confirmation in confirmations:
realm = confirmation.realm
content_object = confirmation.content_object
if realm is not None:
realm_host = realm.host
elif isinstance(content_object, Realm):
realm_host = content_object.host
else:
realm_host = hostname
type = confirmation.type
days_to_activate = _properties[type].validity_in_days
expiry_date = confirmation.date_sent + timedelta(days=days_to_activate)
if hasattr(content_object, "status"):
if content_object.status == STATUS_ACTIVE:
link_status = "Link has been clicked"
else:
link_status = "Link has never been clicked"
else:
link_status = ""
if timezone_now() < expiry_date:
expires_in = timesince(confirmation.date_sent, expiry_date)
else:
expires_in = "Expired"
url = confirmation_url(confirmation.confirmation_key, realm_host, type)
confirmation_dicts.append({"object": confirmation.content_object,
"url": url, "type": type, "link_status": link_status,
"expires_in": expires_in})
return confirmation_dicts
@require_server_admin
def support(request: HttpRequest) -> HttpResponse:
context = {} # type: Dict[str, Any]
if settings.BILLING_ENABLED and request.method == "POST":
realm_id = request.POST.get("realm_id", None)
realm = Realm.objects.get(id=realm_id)
new_plan_type = request.POST.get("plan_type", None)
if new_plan_type is not None:
new_plan_type = int(new_plan_type)
current_plan_type = realm.plan_type
do_change_plan_type(realm, new_plan_type)
msg = "Plan type of {} changed from {} to {} ".format(realm.name,
get_plan_name(current_plan_type),
get_plan_name(new_plan_type))
context["message"] = msg
new_discount = request.POST.get("discount", None)
if new_discount is not None:
new_discount = Decimal(new_discount)
current_discount = get_discount_for_realm(realm)
attach_discount_to_realm(realm, new_discount)
msg = "Discount of {} changed to {} from {} ".format(realm.name, new_discount, current_discount)
context["message"] = msg
status = request.POST.get("status", None)
if status is not None:
if status == "active":
do_reactivate_realm(realm)
context["message"] = "{} reactivated.".format(realm.name)
elif status == "deactivated":
do_deactivate_realm(realm, request.user)
context["message"] = "{} deactivated.".format(realm.name)
scrub_realm = request.POST.get("scrub_realm", None)
if scrub_realm is not None:
if scrub_realm == "scrub_realm":
do_scrub_realm(realm)
context["message"] = "{} scrubbed.".format(realm.name)
query = request.GET.get("q", None)
if query:
key_words = get_invitee_emails_set(query)
context["users"] = UserProfile.objects.filter(delivery_email__in=key_words)
realms = set(Realm.objects.filter(string_id__in=key_words))
for key_word in key_words:
try:
URLValidator()(key_word)
parse_result = urllib.parse.urlparse(key_word)
hostname = parse_result.hostname
assert hostname is not None
if parse_result.port:
hostname = "{}:{}".format(hostname, parse_result.port)
subdomain = get_subdomain_from_hostname(hostname)
try:
realms.add(get_realm(subdomain))
except Realm.DoesNotExist:
pass
except ValidationError:
pass
context["realms"] = realms
confirmations = [] # type: List[Dict[str, Any]]
preregistration_users = PreregistrationUser.objects.filter(email__in=key_words)
confirmations += get_confirmations([Confirmation.USER_REGISTRATION, Confirmation.INVITATION,
Confirmation.REALM_CREATION], preregistration_users,
hostname=request.get_host())
multiuse_invites = MultiuseInvite.objects.filter(realm__in=realms)
confirmations += get_confirmations([Confirmation.MULTIUSE_INVITE], multiuse_invites)
confirmations += get_confirmations([Confirmation.REALM_REACTIVATION], [realm.id for realm in realms])
context["confirmations"] = confirmations
def realm_admin_emails(realm: Realm) -> str:
return ", ".join(realm.get_human_admin_users().values_list("delivery_email", flat=True))
context["realm_admin_emails"] = realm_admin_emails
context["get_discount_for_realm"] = get_discount_for_realm
context["realm_icon_url"] = realm_icon_url
context["Confirmation"] = Confirmation
return render(request, 'analytics/support.html', context=context)
def get_user_activity_records_for_realm(realm: str, is_bot: bool) -> QuerySet:
fields = [
'user_profile__full_name',
@@ -1136,7 +1283,7 @@ def realm_activity_link(realm_str: str) -> mark_safe:
def realm_stats_link(realm_str: str) -> mark_safe:
url_name = 'analytics.views.stats_for_realm'
url = reverse(url_name, kwargs=dict(realm_str=realm_str))
stats_link = '<a href="{}"><i class="fa fa-pie-chart"></i></a>'.format(url, realm_str)
stats_link = '<a href="{}"><i class="fa fa-pie-chart"></i>{}</a>'.format(url, realm_str)
return mark_safe(stats_link)
def remote_installation_stats_link(server_id: int, hostname: str) -> mark_safe:
@@ -1287,7 +1434,7 @@ def get_realm_activity(request: HttpRequest, realm_str: str) -> HttpResponse:
all_user_records = {} # type: Dict[str, Any]
try:
admins = Realm.objects.get(string_id=realm_str).get_admin_users()
admins = Realm.objects.get(string_id=realm_str).get_human_admin_users()
except Realm.DoesNotExist:
return HttpResponseNotFound("Realm %s does not exist" % (realm_str,))

16
babel.config.js Normal file
View File

@@ -0,0 +1,16 @@
module.exports = {
presets: [
[
"@babel/preset-env",
{
corejs: 3,
useBuiltIns: "usage",
},
],
"@babel/typescript",
],
plugins: [
"@babel/proposal-class-properties",
],
sourceType: "unambiguous",
};

View File

@@ -72,6 +72,9 @@ def create_confirmation_link(obj: ContentType, host: str,
realm = None
if hasattr(obj, 'realm'):
realm = obj.realm
elif isinstance(obj, Realm):
realm = obj
Confirmation.objects.create(content_object=obj, date_sent=timezone_now(), confirmation_key=key,
realm=realm, type=confirmation_type)
return confirmation_url(key, host, confirmation_type, url_args)

View File

@@ -19,8 +19,8 @@ from zerver.lib.timestamp import datetime_to_timestamp, timestamp_to_datetime
from zerver.lib.utils import generate_random_token
from zerver.models import Realm, UserProfile, RealmAuditLog
from corporate.models import Customer, CustomerPlan, LicenseLedger, \
get_active_plan
from zproject.settings import get_secret
get_current_plan
from zproject.config import get_secret
STRIPE_PUBLISHABLE_KEY = get_secret('stripe_publishable_key')
stripe.api_key = get_secret('stripe_secret_key')
@@ -38,11 +38,11 @@ CallableT = TypeVar('CallableT', bound=Callable[..., Any])
MIN_INVOICED_LICENSES = 30
DEFAULT_INVOICE_DAYS_UNTIL_DUE = 30
def get_seat_count(realm: Realm) -> int:
def get_latest_seat_count(realm: Realm) -> int:
non_guests = UserProfile.objects.filter(
realm=realm, is_active=True, is_bot=False, is_guest=False).count()
realm=realm, is_active=True, is_bot=False).exclude(role=UserProfile.ROLE_GUEST).count()
guests = UserProfile.objects.filter(
realm=realm, is_active=True, is_bot=False, is_guest=True).count()
realm=realm, is_active=True, is_bot=False, role=UserProfile.ROLE_GUEST).count()
return max(non_guests, math.ceil(guests / 5))
def sign_string(string: str) -> Tuple[str, str]:
@@ -82,8 +82,7 @@ def next_month(billing_cycle_anchor: datetime, dt: datetime) -> datetime:
raise AssertionError('Something wrong in next_month calculation with '
'billing_cycle_anchor: %s, dt: %s' % (billing_cycle_anchor, dt))
# TODO take downgrade into account
def next_renewal_date(plan: CustomerPlan, event_time: datetime) -> datetime:
def start_of_next_billing_cycle(plan: CustomerPlan, event_time: datetime) -> datetime:
months_per_period = {
CustomerPlan.ANNUAL: 12,
CustomerPlan.MONTHLY: 1,
@@ -95,8 +94,10 @@ def next_renewal_date(plan: CustomerPlan, event_time: datetime) -> datetime:
periods += 1
return dt
# TODO take downgrade into account
def next_invoice_date(plan: CustomerPlan) -> datetime:
def next_invoice_date(plan: CustomerPlan) -> Optional[datetime]:
if plan.status == CustomerPlan.ENDED:
return None
assert(plan.next_invoice_date is not None) # for mypy
months_per_period = {
CustomerPlan.ANNUAL: 12,
CustomerPlan.MONTHLY: 1,
@@ -110,18 +111,20 @@ def next_invoice_date(plan: CustomerPlan) -> datetime:
periods += 1
return dt
def renewal_amount(plan: CustomerPlan, event_time: datetime) -> Optional[int]: # nocoverage: TODO
def renewal_amount(plan: CustomerPlan, event_time: datetime) -> int: # nocoverage: TODO
if plan.fixed_price is not None:
return plan.fixed_price
last_ledger_entry = add_plan_renewal_to_license_ledger_if_needed(plan, event_time)
last_ledger_entry = make_end_of_cycle_updates_if_needed(plan, event_time)
if last_ledger_entry is None:
return 0
if last_ledger_entry.licenses_at_next_renewal is None:
return None
return 0
assert(plan.price_per_license is not None) # for mypy
return plan.price_per_license * last_ledger_entry.licenses_at_next_renewal
class BillingError(Exception):
# error messages
CONTACT_SUPPORT = _("Something went wrong. Please contact %s." % (settings.ZULIP_ADMINISTRATOR,))
CONTACT_SUPPORT = _("Something went wrong. Please contact %s.") % (settings.ZULIP_ADMINISTRATOR,)
TRY_RELOADING = _("Something went wrong. Please reload the page.")
# description is used only for tests
@@ -175,7 +178,7 @@ def do_create_stripe_customer(user: UserProfile, stripe_token: Optional[str]=Non
# customer that we can delete or ignore.
stripe_customer = stripe.Customer.create(
description="%s (%s)" % (realm.string_id, realm.name),
email=user.email,
email=user.delivery_email,
metadata={'realm_id': realm.id, 'realm_str': realm.string_id},
source=stripe_token)
event_time = timestamp_to_datetime(stripe_customer.created)
@@ -194,31 +197,42 @@ def do_create_stripe_customer(user: UserProfile, stripe_token: Optional[str]=Non
return customer
@catch_stripe_errors
def do_replace_payment_source(user: UserProfile, stripe_token: str) -> stripe.Customer:
def do_replace_payment_source(user: UserProfile, stripe_token: str,
pay_invoices: bool=False) -> stripe.Customer:
stripe_customer = stripe_get_customer(Customer.objects.get(realm=user.realm).stripe_customer_id)
stripe_customer.source = stripe_token
# Deletes existing card: https://stripe.com/docs/api#update_customer-source
# This can also have other side effects, e.g. it will try to pay certain past-due
# invoices: https://stripe.com/docs/api#update_customer
updated_stripe_customer = stripe.Customer.save(stripe_customer)
RealmAuditLog.objects.create(
realm=user.realm, acting_user=user, event_type=RealmAuditLog.STRIPE_CARD_CHANGED,
event_time=timezone_now())
if pay_invoices:
for stripe_invoice in stripe.Invoice.list(
billing='charge_automatically', customer=stripe_customer.id, status='open'):
# The user will get either a receipt or a "failed payment" email, but the in-app
# messaging could be clearer here (e.g. it could explictly tell the user that there
# were payment(s) and that they succeeded or failed).
# Worth fixing if we notice that a lot of cards end up failing at this step.
stripe.Invoice.pay(stripe_invoice)
return updated_stripe_customer
# event_time should roughly be timezone_now(). Not designed to handle
# event_times in the past or future
# TODO handle downgrade
def add_plan_renewal_to_license_ledger_if_needed(plan: CustomerPlan, event_time: datetime) -> LicenseLedger:
def make_end_of_cycle_updates_if_needed(plan: CustomerPlan,
event_time: datetime) -> Optional[LicenseLedger]:
last_ledger_entry = LicenseLedger.objects.filter(plan=plan).order_by('-id').first()
last_renewal = LicenseLedger.objects.filter(plan=plan, is_renewal=True) \
.order_by('-id').first().event_time
plan_renewal_date = next_renewal_date(plan, last_renewal)
if plan_renewal_date <= event_time:
return LicenseLedger.objects.create(
plan=plan, is_renewal=True, event_time=plan_renewal_date,
licenses=last_ledger_entry.licenses_at_next_renewal,
licenses_at_next_renewal=last_ledger_entry.licenses_at_next_renewal)
next_billing_cycle = start_of_next_billing_cycle(plan, last_renewal)
if next_billing_cycle <= event_time:
if plan.status == CustomerPlan.ACTIVE:
return LicenseLedger.objects.create(
plan=plan, is_renewal=True, event_time=next_billing_cycle,
licenses=last_ledger_entry.licenses_at_next_renewal,
licenses_at_next_renewal=last_ledger_entry.licenses_at_next_renewal)
if plan.status == CustomerPlan.DOWNGRADE_AT_END_OF_CYCLE:
process_downgrade(plan)
return None
return last_ledger_entry
# Returns Customer instead of stripe_customer so that we don't make a Stripe
@@ -262,7 +276,7 @@ def process_initial_upgrade(user: UserProfile, licenses: int, automanage_license
billing_schedule: int, stripe_token: Optional[str]) -> None:
realm = user.realm
customer = update_or_create_stripe_customer(user, stripe_token=stripe_token)
if CustomerPlan.objects.filter(customer=customer, status=CustomerPlan.ACTIVE).exists():
if get_current_plan(customer) is not None:
# Unlikely race condition from two people upgrading (clicking "Make payment")
# at exactly the same time. Doesn't fully resolve the race condition, but having
# a check here reduces the likelihood.
@@ -284,7 +298,7 @@ def process_initial_upgrade(user: UserProfile, licenses: int, automanage_license
currency='usd',
customer=customer.stripe_customer_id,
description="Upgrade to Zulip Standard, ${} x {}".format(price_per_license/100, licenses),
receipt_email=user.email,
receipt_email=user.delivery_email,
statement_descriptor='Zulip Standard')
# Not setting a period start and end, but maybe we should? Unclear what will make things
# most similar to the renewal case from an accounting perspective.
@@ -300,7 +314,7 @@ def process_initial_upgrade(user: UserProfile, licenses: int, automanage_license
with transaction.atomic():
# billed_licenses can greater than licenses if users are added between the start of
# this function (process_initial_upgrade) and now
billed_licenses = max(get_seat_count(realm), licenses)
billed_licenses = max(get_latest_seat_count(realm), licenses)
plan_params = {
'automanage_licenses': automanage_licenses,
'charge_automatically': charge_automatically,
@@ -354,9 +368,10 @@ def process_initial_upgrade(user: UserProfile, licenses: int, automanage_license
def update_license_ledger_for_automanaged_plan(realm: Realm, plan: CustomerPlan,
event_time: datetime) -> None:
last_ledger_entry = add_plan_renewal_to_license_ledger_if_needed(plan, event_time)
# todo: handle downgrade, where licenses_at_next_renewal should be 0
licenses_at_next_renewal = get_seat_count(realm)
last_ledger_entry = make_end_of_cycle_updates_if_needed(plan, event_time)
if last_ledger_entry is None:
return
licenses_at_next_renewal = get_latest_seat_count(realm)
licenses = max(licenses_at_next_renewal, last_ledger_entry.licenses)
LicenseLedger.objects.create(
plan=plan, event_time=event_time, licenses=licenses,
@@ -366,7 +381,7 @@ def update_license_ledger_if_needed(realm: Realm, event_time: datetime) -> None:
customer = Customer.objects.filter(realm=realm).first()
if customer is None:
return
plan = get_active_plan(customer)
plan = get_current_plan(customer)
if plan is None:
return
if not plan.automanage_licenses:
@@ -376,7 +391,7 @@ def update_license_ledger_if_needed(realm: Realm, event_time: datetime) -> None:
def invoice_plan(plan: CustomerPlan, event_time: datetime) -> None:
if plan.invoicing_status == CustomerPlan.STARTED:
raise NotImplementedError('Plan with invoicing_status==STARTED needs manual resolution.')
add_plan_renewal_to_license_ledger_if_needed(plan, event_time)
make_end_of_cycle_updates_if_needed(plan, event_time)
assert(plan.invoiced_through is not None)
licenses_base = plan.invoiced_through.licenses
invoice_item_created = False
@@ -396,7 +411,7 @@ def invoice_plan(plan: CustomerPlan, event_time: datetime) -> None:
last_renewal = LicenseLedger.objects.filter(
plan=plan, is_renewal=True, event_time__lte=ledger_entry.event_time) \
.order_by('-id').first().event_time
period_end = next_renewal_date(plan, ledger_entry.event_time)
period_end = start_of_next_billing_cycle(plan, ledger_entry.event_time)
proration_fraction = (period_end - ledger_entry.event_time) / (period_end - last_renewal)
price_args = {'unit_amount': int(plan.price_per_license * proration_fraction + .5),
'quantity': ledger_entry.licenses - licenses_base}
@@ -416,7 +431,8 @@ def invoice_plan(plan: CustomerPlan, event_time: datetime) -> None:
description=description,
discountable=False,
period = {'start': datetime_to_timestamp(ledger_entry.event_time),
'end': datetime_to_timestamp(next_renewal_date(plan, ledger_entry.event_time))},
'end': datetime_to_timestamp(
start_of_next_billing_cycle(plan, ledger_entry.event_time))},
idempotency_key=idempotency_key,
**price_args)
invoice_item_created = True
@@ -443,15 +459,30 @@ def invoice_plan(plan: CustomerPlan, event_time: datetime) -> None:
plan.next_invoice_date = next_invoice_date(plan)
plan.save(update_fields=['next_invoice_date'])
def invoice_plans_as_needed(event_time: datetime) -> None:
def invoice_plans_as_needed(event_time: datetime=timezone_now()) -> None:
for plan in CustomerPlan.objects.filter(next_invoice_date__lte=event_time):
invoice_plan(plan, event_time)
def attach_discount_to_realm(realm: Realm, discount: Decimal) -> None:
Customer.objects.update_or_create(realm=realm, defaults={'default_discount': discount})
def process_downgrade(user: UserProfile) -> None: # nocoverage
pass
def get_discount_for_realm(realm: Realm) -> Optional[Decimal]:
customer = Customer.objects.filter(realm=realm).first()
if customer is not None:
return customer.default_discount
return None
def do_change_plan_status(plan: CustomerPlan, status: int) -> None:
plan.status = status
plan.save(update_fields=['status'])
billing_logger.info('Change plan status: Customer.id: %s, CustomerPlan.id: %s, status: %s' % (
plan.customer.id, plan.id, status))
def process_downgrade(plan: CustomerPlan) -> None:
from zerver.lib.actions import do_change_plan_type
do_change_plan_type(plan.customer.realm, Realm.LIMITED)
plan.status = CustomerPlan.ENDED
plan.save(update_fields=['status'])
def estimate_annual_recurring_revenue_by_realm() -> Dict[str, int]: # nocoverage
annual_revenue = {}
@@ -459,7 +490,7 @@ def estimate_annual_recurring_revenue_by_realm() -> Dict[str, int]: # nocoverag
status=CustomerPlan.ACTIVE).select_related('customer__realm'):
# TODO: figure out what to do for plans that don't automatically
# renew, but which probably will renew
renewal_cents = renewal_amount(plan, timezone_now()) or 0
renewal_cents = renewal_amount(plan, timezone_now())
if plan.billing_schedule == CustomerPlan.MONTHLY:
renewal_cents *= 12
# TODO: Decimal stuff

View File

@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-04-11 00:45
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('corporate', '0007_remove_deprecated_fields'),
]
operations = [
migrations.AlterField(
model_name='customerplan',
name='next_invoice_date',
field=models.DateTimeField(db_index=True, null=True),
),
]

View File

@@ -35,7 +35,7 @@ class CustomerPlan(models.Model):
MONTHLY = 2
billing_schedule = models.SmallIntegerField() # type: int
next_invoice_date = models.DateTimeField(db_index=True) # type: datetime.datetime
next_invoice_date = models.DateTimeField(db_index=True, null=True) # type: Optional[datetime.datetime]
invoiced_through = models.ForeignKey(
'LicenseLedger', null=True, on_delete=CASCADE, related_name='+') # type: Optional[LicenseLedger]
DONE = 1
@@ -48,15 +48,19 @@ class CustomerPlan(models.Model):
tier = models.SmallIntegerField() # type: int
ACTIVE = 1
ENDED = 2
NEVER_STARTED = 3
# You can only have 1 active subscription at a time
DOWNGRADE_AT_END_OF_CYCLE = 2
# "Live" plans should have a value < LIVE_STATUS_THRESHOLD.
# There should be at most one live plan per customer.
LIVE_STATUS_THRESHOLD = 10
ENDED = 11
NEVER_STARTED = 12
status = models.SmallIntegerField(default=ACTIVE) # type: int
# TODO maybe override setattr to ensure billing_cycle_anchor, etc are immutable
def get_active_plan(customer: Customer) -> Optional[CustomerPlan]:
return CustomerPlan.objects.filter(customer=customer, status=CustomerPlan.ACTIVE).first()
def get_current_plan(customer: Customer) -> Optional[CustomerPlan]:
return CustomerPlan.objects.filter(
customer=customer, status__lt=CustomerPlan.LIVE_STATUS_THRESHOLD).first()
class LicenseLedger(models.Model):
plan = models.ForeignKey(CustomerPlan, on_delete=CASCADE) # type: CustomerPlan
@@ -65,6 +69,5 @@ class LicenseLedger(models.Model):
event_time = models.DateTimeField() # type: datetime.datetime
licenses = models.IntegerField() # type: int
# None means the plan does not automatically renew.
# 0 means the plan has been explicitly downgraded.
# This cannot be None if plan.automanage_licenses.
licenses_at_next_renewal = models.IntegerField(null=True) # type: Optional[int]

View File

@@ -5,6 +5,19 @@
"application_fee": null,
"application_fee_amount": null,
"balance_transaction": "txn_NORMALIZED00000000000001",
"billing_details": {
"address": {
"city": "Pacific",
"country": "United States",
"line1": "Under the sea,",
"line2": null,
"postal_code": "33333",
"state": null
},
"email": null,
"name": "Ada Starr",
"phone": null
},
"captured": true,
"created": 1000000000,
"currency": "usd",
@@ -32,6 +45,26 @@
},
"paid": true,
"payment_intent": null,
"payment_method": "card_NORMALIZED00000000000001",
"payment_method_details": {
"card": {
"brand": "visa",
"checks": {
"address_line1_check": "pass",
"address_postal_code_check": "pass",
"cvc_check": "pass"
},
"country": "US",
"exp_month": 3,
"exp_year": 2033,
"fingerprint": "NORMALIZED000001",
"funding": "credit",
"last4": "4242",
"three_d_secure": null,
"wallet": null
},
"type": "card"
},
"receipt_email": "hamlet@zulip.com",
"receipt_number": null,
"receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000001/rcpt_NORMALIZED000000000000000000001",
@@ -72,6 +105,7 @@
},
"source_transfer": null,
"statement_descriptor": "Zulip Standard",
"statement_descriptor_suffix": "Zulip Standard",
"status": "succeeded",
"transfer_data": null,
"transfer_group": null

View File

@@ -5,6 +5,19 @@
"application_fee": null,
"application_fee_amount": null,
"balance_transaction": "txn_NORMALIZED00000000000002",
"billing_details": {
"address": {
"city": "Pacific",
"country": "United States",
"line1": "Under the sea,",
"line2": null,
"postal_code": "33333",
"state": null
},
"email": null,
"name": "Ada Starr",
"phone": null
},
"captured": true,
"created": 1000000000,
"currency": "usd",
@@ -32,6 +45,26 @@
},
"paid": true,
"payment_intent": null,
"payment_method": "card_NORMALIZED00000000000002",
"payment_method_details": {
"card": {
"brand": "visa",
"checks": {
"address_line1_check": "pass",
"address_postal_code_check": "pass",
"cvc_check": "pass"
},
"country": "US",
"exp_month": 3,
"exp_year": 2033,
"fingerprint": "NORMALIZED000001",
"funding": "credit",
"last4": "4242",
"three_d_secure": null,
"wallet": null
},
"type": "card"
},
"receipt_email": "hamlet@zulip.com",
"receipt_number": null,
"receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000002/rcpt_NORMALIZED000000000000000000002",
@@ -72,6 +105,7 @@
},
"source_transfer": null,
"statement_descriptor": "Zulip Standard",
"statement_descriptor_suffix": "Zulip Standard",
"status": "succeeded",
"transfer_data": null,
"transfer_group": null

View File

@@ -7,6 +7,19 @@
"application_fee": null,
"application_fee_amount": null,
"balance_transaction": "txn_NORMALIZED00000000000001",
"billing_details": {
"address": {
"city": "Pacific",
"country": "United States",
"line1": "Under the sea,",
"line2": null,
"postal_code": "33333",
"state": null
},
"email": null,
"name": "Ada Starr",
"phone": null
},
"captured": true,
"created": 1000000000,
"currency": "usd",
@@ -34,6 +47,26 @@
},
"paid": true,
"payment_intent": null,
"payment_method": "card_NORMALIZED00000000000001",
"payment_method_details": {
"card": {
"brand": "visa",
"checks": {
"address_line1_check": "pass",
"address_postal_code_check": "pass",
"cvc_check": "pass"
},
"country": "US",
"exp_month": 3,
"exp_year": 2033,
"fingerprint": "NORMALIZED000001",
"funding": "credit",
"last4": "4242",
"three_d_secure": null,
"wallet": null
},
"type": "card"
},
"receipt_email": "hamlet@zulip.com",
"receipt_number": null,
"receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000001/rcpt_NORMALIZED000000000000000000001",
@@ -68,6 +101,7 @@
},
"source_transfer": null,
"statement_descriptor": "Zulip Standard",
"statement_descriptor_suffix": "Zulip Standard",
"status": "succeeded",
"transfer_data": null,
"transfer_group": null

View File

@@ -7,6 +7,19 @@
"application_fee": null,
"application_fee_amount": null,
"balance_transaction": "txn_NORMALIZED00000000000002",
"billing_details": {
"address": {
"city": "Pacific",
"country": "United States",
"line1": "Under the sea,",
"line2": null,
"postal_code": "33333",
"state": null
},
"email": null,
"name": "Ada Starr",
"phone": null
},
"captured": true,
"created": 1000000000,
"currency": "usd",
@@ -34,6 +47,26 @@
},
"paid": true,
"payment_intent": null,
"payment_method": "card_NORMALIZED00000000000002",
"payment_method_details": {
"card": {
"brand": "visa",
"checks": {
"address_line1_check": "pass",
"address_postal_code_check": "pass",
"cvc_check": "pass"
},
"country": "US",
"exp_month": 3,
"exp_year": 2033,
"fingerprint": "NORMALIZED000001",
"funding": "credit",
"last4": "4242",
"three_d_secure": null,
"wallet": null
},
"type": "card"
},
"receipt_email": "hamlet@zulip.com",
"receipt_number": null,
"receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000002/rcpt_NORMALIZED000000000000000000002",
@@ -68,6 +101,7 @@
},
"source_transfer": null,
"statement_descriptor": "Zulip Standard",
"statement_descriptor_suffix": "Zulip Standard",
"status": "succeeded",
"transfer_data": null,
"transfer_group": null
@@ -79,6 +113,19 @@
"application_fee": null,
"application_fee_amount": null,
"balance_transaction": "txn_NORMALIZED00000000000001",
"billing_details": {
"address": {
"city": "Pacific",
"country": "United States",
"line1": "Under the sea,",
"line2": null,
"postal_code": "33333",
"state": null
},
"email": null,
"name": "Ada Starr",
"phone": null
},
"captured": true,
"created": 1000000000,
"currency": "usd",
@@ -106,6 +153,26 @@
},
"paid": true,
"payment_intent": null,
"payment_method": "card_NORMALIZED00000000000001",
"payment_method_details": {
"card": {
"brand": "visa",
"checks": {
"address_line1_check": "pass",
"address_postal_code_check": "pass",
"cvc_check": "pass"
},
"country": "US",
"exp_month": 3,
"exp_year": 2033,
"fingerprint": "NORMALIZED000001",
"funding": "credit",
"last4": "4242",
"three_d_secure": null,
"wallet": null
},
"type": "card"
},
"receipt_email": "hamlet@zulip.com",
"receipt_number": null,
"receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000001/rcpt_NORMALIZED000000000000000000001",
@@ -140,6 +207,7 @@
},
"source_transfer": null,
"statement_descriptor": "Zulip Standard",
"statement_descriptor_suffix": "Zulip Standard",
"status": "succeeded",
"transfer_data": null,
"transfer_group": null

View File

@@ -1,5 +1,7 @@
{
"account_balance": 0,
"address": null,
"balance": 0,
"created": 1000000000,
"currency": null,
"default_source": "card_NORMALIZED00000000000001",
@@ -11,6 +13,7 @@
"invoice_prefix": "NORMA01",
"invoice_settings": {
"custom_fields": null,
"default_payment_method": null,
"footer": null
},
"livemode": false,
@@ -18,7 +21,10 @@
"realm_id": "1",
"realm_str": "zulip"
},
"name": null,
"object": "customer",
"phone": null,
"preferred_locales": [],
"shipping": null,
"sources": {
"data": [
@@ -60,6 +66,14 @@
"total_count": 0,
"url": "/v1/customers/cus_NORMALIZED0001/subscriptions"
},
"tax_exempt": "none",
"tax_ids": {
"data": [],
"has_more": false,
"object": "list",
"total_count": 0,
"url": "/v1/customers/cus_NORMALIZED0001/tax_ids"
},
"tax_info": null,
"tax_info_verification": null
}

View File

@@ -1,5 +1,7 @@
{
"account_balance": 0,
"address": null,
"balance": 0,
"created": 1000000000,
"currency": "usd",
"default_source": {
@@ -35,6 +37,7 @@
"invoice_prefix": "NORMA01",
"invoice_settings": {
"custom_fields": null,
"default_payment_method": null,
"footer": null
},
"livemode": false,
@@ -42,7 +45,10 @@
"realm_id": "1",
"realm_str": "zulip"
},
"name": null,
"object": "customer",
"phone": null,
"preferred_locales": [],
"shipping": null,
"sources": {
"data": [
@@ -84,6 +90,14 @@
"total_count": 0,
"url": "/v1/customers/cus_NORMALIZED0001/subscriptions"
},
"tax_exempt": "none",
"tax_ids": {
"data": [],
"has_more": false,
"object": "list",
"total_count": 0,
"url": "/v1/customers/cus_NORMALIZED0001/tax_ids"
},
"tax_info": null,
"tax_info_verification": null
}

View File

@@ -1,5 +1,7 @@
{
"account_balance": 0,
"address": null,
"balance": 0,
"created": 1000000000,
"currency": "usd",
"default_source": "card_NORMALIZED00000000000002",
@@ -11,6 +13,7 @@
"invoice_prefix": "NORMA01",
"invoice_settings": {
"custom_fields": null,
"default_payment_method": null,
"footer": null
},
"livemode": false,
@@ -18,7 +21,10 @@
"realm_id": "1",
"realm_str": "zulip"
},
"name": null,
"object": "customer",
"phone": null,
"preferred_locales": [],
"shipping": null,
"sources": {
"data": [
@@ -60,6 +66,14 @@
"total_count": 0,
"url": "/v1/customers/cus_NORMALIZED0001/subscriptions"
},
"tax_exempt": "none",
"tax_ids": {
"data": [],
"has_more": false,
"object": "list",
"total_count": 0,
"url": "/v1/customers/cus_NORMALIZED0001/tax_ids"
},
"tax_info": null,
"tax_info_verification": null
}

View File

@@ -1,24 +1,35 @@
{
"account_country": "US",
"account_name": "Dev account",
"amount_due": 0,
"amount_paid": 0,
"amount_remaining": 0,
"application_fee": null,
"application_fee_amount": null,
"attempt_count": 0,
"attempted": false,
"auto_advance": true,
"billing": "charge_automatically",
"billing_reason": "manual",
"charge": null,
"collection_method": "charge_automatically",
"created": 1000000000,
"currency": "usd",
"custom_fields": null,
"customer": "cus_NORMALIZED0001",
"date": 1000000000,
"customer_address": null,
"customer_email": "hamlet@zulip.com",
"customer_name": null,
"customer_phone": null,
"customer_shipping": null,
"customer_tax_exempt": "none",
"customer_tax_ids": [],
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
"description": "",
"discount": null,
"due_date": null,
"ending_balance": null,
"finalized_at": null,
"footer": null,
"hosted_invoice_url": null,
"id": "in_NORMALIZED00000000000001",
@@ -43,6 +54,8 @@
"proration": false,
"quantity": 6,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
},
{
@@ -63,6 +76,8 @@
"proration": false,
"quantity": 1,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
}
],
@@ -77,16 +92,26 @@
"number": "NORMALI-0001",
"object": "invoice",
"paid": false,
"payment_intent": null,
"period_end": 1000000000,
"period_start": 1000000000,
"post_payment_credit_notes_amount": 0,
"pre_payment_credit_notes_amount": 0,
"receipt_number": null,
"starting_balance": 0,
"statement_descriptor": "Zulip Standard",
"status": "draft",
"status_transitions": {
"finalized_at": null,
"marked_uncollectible_at": null,
"paid_at": null,
"voided_at": null
},
"subscription": null,
"subtotal": 0,
"tax": 0,
"tax": null,
"tax_percent": null,
"total": 0,
"total_tax_amounts": [],
"webhooks_delivered_at": null
}

View File

@@ -1,24 +1,35 @@
{
"account_country": "US",
"account_name": "Dev account",
"amount_due": 0,
"amount_paid": 0,
"amount_remaining": 0,
"application_fee": null,
"application_fee_amount": null,
"attempt_count": 0,
"attempted": false,
"auto_advance": true,
"billing": "charge_automatically",
"billing_reason": "manual",
"charge": null,
"collection_method": "charge_automatically",
"created": 1000000000,
"currency": "usd",
"custom_fields": null,
"customer": "cus_NORMALIZED0001",
"date": 1000000000,
"customer_address": null,
"customer_email": "hamlet@zulip.com",
"customer_name": null,
"customer_phone": null,
"customer_shipping": null,
"customer_tax_exempt": "none",
"customer_tax_ids": [],
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
"description": "",
"discount": null,
"due_date": null,
"ending_balance": null,
"finalized_at": null,
"footer": null,
"hosted_invoice_url": null,
"id": "in_NORMALIZED00000000000002",
@@ -43,6 +54,8 @@
"proration": false,
"quantity": 6,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
},
{
@@ -63,6 +76,8 @@
"proration": false,
"quantity": 1,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
}
],
@@ -77,16 +92,26 @@
"number": "NORMALI-0002",
"object": "invoice",
"paid": false,
"payment_intent": null,
"period_end": 1000000000,
"period_start": 1000000000,
"post_payment_credit_notes_amount": 0,
"pre_payment_credit_notes_amount": 0,
"receipt_number": null,
"starting_balance": 0,
"statement_descriptor": "Zulip Standard",
"status": "draft",
"status_transitions": {
"finalized_at": null,
"marked_uncollectible_at": null,
"paid_at": null,
"voided_at": null
},
"subscription": null,
"subtotal": 0,
"tax": 0,
"tax": null,
"tax_percent": null,
"total": 0,
"total_tax_amounts": [],
"webhooks_delivered_at": null
}

View File

@@ -1,24 +1,35 @@
{
"account_country": "US",
"account_name": "Dev account",
"amount_due": 0,
"amount_paid": 0,
"amount_remaining": 0,
"application_fee": null,
"application_fee_amount": null,
"attempt_count": 0,
"attempted": true,
"auto_advance": false,
"billing": "charge_automatically",
"billing_reason": "manual",
"charge": null,
"collection_method": "charge_automatically",
"created": 1000000000,
"currency": "usd",
"custom_fields": null,
"customer": "cus_NORMALIZED0001",
"date": 1000000000,
"customer_address": null,
"customer_email": "hamlet@zulip.com",
"customer_name": null,
"customer_phone": null,
"customer_shipping": null,
"customer_tax_exempt": "none",
"customer_tax_ids": [],
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
"description": "",
"discount": null,
"due_date": 1000000000,
"ending_balance": 0,
"finalized_at": 1000000000,
"footer": null,
"hosted_invoice_url": "https://pay.stripe.com/invoice/invst_NORMALIZED0000000000000001",
"id": "in_NORMALIZED00000000000001",
@@ -43,6 +54,8 @@
"proration": false,
"quantity": 6,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
},
{
@@ -63,6 +76,8 @@
"proration": false,
"quantity": 1,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
}
],
@@ -77,16 +92,26 @@
"number": "NORMALI-0001",
"object": "invoice",
"paid": true,
"payment_intent": null,
"period_end": 1000000000,
"period_start": 1000000000,
"post_payment_credit_notes_amount": 0,
"pre_payment_credit_notes_amount": 0,
"receipt_number": null,
"starting_balance": 0,
"statement_descriptor": "Zulip Standard",
"status": "paid",
"status_transitions": {
"finalized_at": 1000000000,
"marked_uncollectible_at": null,
"paid_at": 1000000000,
"voided_at": null
},
"subscription": null,
"subtotal": 0,
"tax": 0,
"tax": null,
"tax_percent": null,
"total": 0,
"total_tax_amounts": [],
"webhooks_delivered_at": 1000000000
}

View File

@@ -1,24 +1,35 @@
{
"account_country": "US",
"account_name": "Dev account",
"amount_due": 0,
"amount_paid": 0,
"amount_remaining": 0,
"application_fee": null,
"application_fee_amount": null,
"attempt_count": 0,
"attempted": true,
"auto_advance": false,
"billing": "charge_automatically",
"billing_reason": "manual",
"charge": null,
"collection_method": "charge_automatically",
"created": 1000000000,
"currency": "usd",
"custom_fields": null,
"customer": "cus_NORMALIZED0001",
"date": 1000000000,
"customer_address": null,
"customer_email": "hamlet@zulip.com",
"customer_name": null,
"customer_phone": null,
"customer_shipping": null,
"customer_tax_exempt": "none",
"customer_tax_ids": [],
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
"description": "",
"discount": null,
"due_date": 1000000000,
"ending_balance": 0,
"finalized_at": 1000000000,
"footer": null,
"hosted_invoice_url": "https://pay.stripe.com/invoice/invst_NORMALIZED0000000000000002",
"id": "in_NORMALIZED00000000000002",
@@ -43,6 +54,8 @@
"proration": false,
"quantity": 6,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
},
{
@@ -63,6 +76,8 @@
"proration": false,
"quantity": 1,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
}
],
@@ -77,16 +92,26 @@
"number": "NORMALI-0002",
"object": "invoice",
"paid": true,
"payment_intent": null,
"period_end": 1000000000,
"period_start": 1000000000,
"post_payment_credit_notes_amount": 0,
"pre_payment_credit_notes_amount": 0,
"receipt_number": null,
"starting_balance": 0,
"statement_descriptor": "Zulip Standard",
"status": "paid",
"status_transitions": {
"finalized_at": 1000000000,
"marked_uncollectible_at": null,
"paid_at": 1000000000,
"voided_at": null
},
"subscription": null,
"subtotal": 0,
"tax": 0,
"tax": null,
"tax_percent": null,
"total": 0,
"total_tax_amounts": [],
"webhooks_delivered_at": 1000000000
}

View File

@@ -1,26 +1,37 @@
{
"data": [
{
"account_country": "US",
"account_name": "Dev account",
"amount_due": 0,
"amount_paid": 0,
"amount_remaining": 0,
"application_fee": null,
"application_fee_amount": null,
"attempt_count": 0,
"attempted": true,
"auto_advance": false,
"billing": "charge_automatically",
"billing_reason": "manual",
"charge": null,
"collection_method": "charge_automatically",
"created": 1000000000,
"currency": "usd",
"custom_fields": null,
"customer": "cus_NORMALIZED0001",
"date": 1000000000,
"customer_address": null,
"customer_email": "hamlet@zulip.com",
"customer_name": null,
"customer_phone": null,
"customer_shipping": null,
"customer_tax_exempt": "none",
"customer_tax_ids": [],
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
"description": "",
"discount": null,
"due_date": 1000000000,
"ending_balance": 0,
"finalized_at": 1000000000,
"footer": null,
"hosted_invoice_url": "https://pay.stripe.com/invoice/invst_NORMALIZED0000000000000001",
"id": "in_NORMALIZED00000000000001",
@@ -45,6 +56,8 @@
"proration": false,
"quantity": 6,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
},
{
@@ -65,6 +78,8 @@
"proration": false,
"quantity": 1,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
}
],
@@ -79,17 +94,27 @@
"number": "NORMALI-0001",
"object": "invoice",
"paid": true,
"payment_intent": null,
"period_end": 1000000000,
"period_start": 1000000000,
"post_payment_credit_notes_amount": 0,
"pre_payment_credit_notes_amount": 0,
"receipt_number": null,
"starting_balance": 0,
"statement_descriptor": "Zulip Standard",
"status": "paid",
"status_transitions": {
"finalized_at": 1000000000,
"marked_uncollectible_at": null,
"paid_at": 1000000000,
"voided_at": null
},
"subscription": null,
"subtotal": 0,
"tax": 0,
"tax": null,
"tax_percent": null,
"total": 0,
"total_tax_amounts": [],
"webhooks_delivered_at": 1000000000
}
],

View File

@@ -1,26 +1,37 @@
{
"data": [
{
"account_country": "US",
"account_name": "Dev account",
"amount_due": 0,
"amount_paid": 0,
"amount_remaining": 0,
"application_fee": null,
"application_fee_amount": null,
"attempt_count": 0,
"attempted": true,
"auto_advance": false,
"billing": "charge_automatically",
"billing_reason": "manual",
"charge": null,
"collection_method": "charge_automatically",
"created": 1000000000,
"currency": "usd",
"custom_fields": null,
"customer": "cus_NORMALIZED0001",
"date": 1000000000,
"customer_address": null,
"customer_email": "hamlet@zulip.com",
"customer_name": null,
"customer_phone": null,
"customer_shipping": null,
"customer_tax_exempt": "none",
"customer_tax_ids": [],
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
"description": "",
"discount": null,
"due_date": 1000000000,
"ending_balance": 0,
"finalized_at": 1000000000,
"footer": null,
"hosted_invoice_url": "https://pay.stripe.com/invoice/invst_NORMALIZED0000000000000002",
"id": "in_NORMALIZED00000000000002",
@@ -45,6 +56,8 @@
"proration": false,
"quantity": 6,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
},
{
@@ -65,6 +78,8 @@
"proration": false,
"quantity": 1,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
}
],
@@ -79,40 +94,61 @@
"number": "NORMALI-0002",
"object": "invoice",
"paid": true,
"payment_intent": null,
"period_end": 1000000000,
"period_start": 1000000000,
"post_payment_credit_notes_amount": 0,
"pre_payment_credit_notes_amount": 0,
"receipt_number": null,
"starting_balance": 0,
"statement_descriptor": "Zulip Standard",
"status": "paid",
"status_transitions": {
"finalized_at": 1000000000,
"marked_uncollectible_at": null,
"paid_at": 1000000000,
"voided_at": null
},
"subscription": null,
"subtotal": 0,
"tax": 0,
"tax": null,
"tax_percent": null,
"total": 0,
"total_tax_amounts": [],
"webhooks_delivered_at": 1000000000
},
{
"account_country": "US",
"account_name": "Dev account",
"amount_due": 0,
"amount_paid": 0,
"amount_remaining": 0,
"application_fee": null,
"application_fee_amount": null,
"attempt_count": 0,
"attempted": true,
"auto_advance": false,
"billing": "charge_automatically",
"billing_reason": "manual",
"charge": null,
"collection_method": "charge_automatically",
"created": 1000000000,
"currency": "usd",
"custom_fields": null,
"customer": "cus_NORMALIZED0001",
"date": 1000000000,
"customer_address": null,
"customer_email": "hamlet@zulip.com",
"customer_name": null,
"customer_phone": null,
"customer_shipping": null,
"customer_tax_exempt": "none",
"customer_tax_ids": [],
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
"description": "",
"discount": null,
"due_date": 1000000000,
"ending_balance": 0,
"finalized_at": 1000000000,
"footer": null,
"hosted_invoice_url": "https://pay.stripe.com/invoice/invst_NORMALIZED0000000000000001",
"id": "in_NORMALIZED00000000000001",
@@ -137,6 +173,8 @@
"proration": false,
"quantity": 6,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
},
{
@@ -157,6 +195,8 @@
"proration": false,
"quantity": 1,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
}
],
@@ -171,17 +211,27 @@
"number": "NORMALI-0001",
"object": "invoice",
"paid": true,
"payment_intent": null,
"period_end": 1000000000,
"period_start": 1000000000,
"post_payment_credit_notes_amount": 0,
"pre_payment_credit_notes_amount": 0,
"receipt_number": null,
"starting_balance": 0,
"statement_descriptor": "Zulip Standard",
"status": "paid",
"status_transitions": {
"finalized_at": 1000000000,
"marked_uncollectible_at": null,
"paid_at": 1000000000,
"voided_at": null
},
"subscription": null,
"subtotal": 0,
"tax": 0,
"tax": null,
"tax_percent": null,
"total": 0,
"total_tax_amounts": [],
"webhooks_delivered_at": 1000000000
}
],

View File

@@ -18,5 +18,6 @@
"proration": false,
"quantity": 1,
"subscription": null,
"tax_rates": [],
"unit_amount": -7200
}

View File

@@ -18,5 +18,6 @@
"proration": false,
"quantity": 6,
"subscription": null,
"tax_rates": [],
"unit_amount": 1200
}

View File

@@ -18,5 +18,6 @@
"proration": false,
"quantity": 1,
"subscription": null,
"tax_rates": [],
"unit_amount": -36000
}

View File

@@ -18,5 +18,6 @@
"proration": false,
"quantity": 6,
"subscription": null,
"tax_rates": [],
"unit_amount": 6000
}

View File

@@ -5,6 +5,19 @@
"application_fee": null,
"application_fee_amount": null,
"balance_transaction": "txn_NORMALIZED00000000000001",
"billing_details": {
"address": {
"city": "Pacific",
"country": "United States",
"line1": "Under the sea,",
"line2": null,
"postal_code": "33333",
"state": null
},
"email": null,
"name": "Ada Starr",
"phone": null
},
"captured": true,
"created": 1000000000,
"currency": "usd",
@@ -32,6 +45,26 @@
},
"paid": true,
"payment_intent": null,
"payment_method": "card_NORMALIZED00000000000001",
"payment_method_details": {
"card": {
"brand": "visa",
"checks": {
"address_line1_check": "pass",
"address_postal_code_check": "pass",
"cvc_check": "pass"
},
"country": "US",
"exp_month": 3,
"exp_year": 2033,
"fingerprint": "NORMALIZED000001",
"funding": "credit",
"last4": "4242",
"three_d_secure": null,
"wallet": null
},
"type": "card"
},
"receipt_email": "hamlet@zulip.com",
"receipt_number": null,
"receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000001/rcpt_NORMALIZED000000000000000000001",
@@ -72,6 +105,7 @@
},
"source_transfer": null,
"statement_descriptor": "Zulip Standard",
"statement_descriptor_suffix": "Zulip Standard",
"status": "succeeded",
"transfer_data": null,
"transfer_group": null

View File

@@ -1,5 +1,7 @@
{
"account_balance": 0,
"address": null,
"balance": 0,
"created": 1000000000,
"currency": null,
"default_source": "card_NORMALIZED00000000000001",
@@ -11,6 +13,7 @@
"invoice_prefix": "NORMA01",
"invoice_settings": {
"custom_fields": null,
"default_payment_method": null,
"footer": null
},
"livemode": false,
@@ -18,7 +21,10 @@
"realm_id": "1",
"realm_str": "zulip"
},
"name": null,
"object": "customer",
"phone": null,
"preferred_locales": [],
"shipping": null,
"sources": {
"data": [
@@ -60,6 +66,14 @@
"total_count": 0,
"url": "/v1/customers/cus_NORMALIZED0001/subscriptions"
},
"tax_exempt": "none",
"tax_ids": {
"data": [],
"has_more": false,
"object": "list",
"total_count": 0,
"url": "/v1/customers/cus_NORMALIZED0001/tax_ids"
},
"tax_info": null,
"tax_info_verification": null
}

View File

@@ -1,5 +1,7 @@
{
"account_balance": 0,
"address": null,
"balance": 0,
"created": 1000000000,
"currency": "usd",
"default_source": {
@@ -35,6 +37,7 @@
"invoice_prefix": "NORMA01",
"invoice_settings": {
"custom_fields": null,
"default_payment_method": null,
"footer": null
},
"livemode": false,
@@ -42,7 +45,10 @@
"realm_id": "1",
"realm_str": "zulip"
},
"name": null,
"object": "customer",
"phone": null,
"preferred_locales": [],
"shipping": null,
"sources": {
"data": [
@@ -84,6 +90,14 @@
"total_count": 0,
"url": "/v1/customers/cus_NORMALIZED0001/subscriptions"
},
"tax_exempt": "none",
"tax_ids": {
"data": [],
"has_more": false,
"object": "list",
"total_count": 0,
"url": "/v1/customers/cus_NORMALIZED0001/tax_ids"
},
"tax_info": null,
"tax_info_verification": null
}

View File

@@ -1,5 +1,7 @@
{
"account_balance": 0,
"address": null,
"balance": 0,
"created": 1000000000,
"currency": "usd",
"default_source": {
@@ -35,6 +37,7 @@
"invoice_prefix": "NORMA01",
"invoice_settings": {
"custom_fields": null,
"default_payment_method": null,
"footer": null
},
"livemode": false,
@@ -42,7 +45,10 @@
"realm_id": "1",
"realm_str": "zulip"
},
"name": null,
"object": "customer",
"phone": null,
"preferred_locales": [],
"shipping": null,
"sources": {
"data": [
@@ -84,6 +90,14 @@
"total_count": 0,
"url": "/v1/customers/cus_NORMALIZED0001/subscriptions"
},
"tax_exempt": "none",
"tax_ids": {
"data": [],
"has_more": false,
"object": "list",
"total_count": 0,
"url": "/v1/customers/cus_NORMALIZED0001/tax_ids"
},
"tax_info": null,
"tax_info_verification": null
}

View File

@@ -1,24 +1,35 @@
{
"account_country": "US",
"account_name": "Dev account",
"amount_due": 0,
"amount_paid": 0,
"amount_remaining": 0,
"application_fee": null,
"application_fee_amount": null,
"attempt_count": 0,
"attempted": false,
"auto_advance": true,
"billing": "charge_automatically",
"billing_reason": "manual",
"charge": null,
"collection_method": "charge_automatically",
"created": 1000000000,
"currency": "usd",
"custom_fields": null,
"customer": "cus_NORMALIZED0001",
"date": 1000000000,
"customer_address": null,
"customer_email": "hamlet@zulip.com",
"customer_name": null,
"customer_phone": null,
"customer_shipping": null,
"customer_tax_exempt": "none",
"customer_tax_ids": [],
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
"description": "",
"discount": null,
"due_date": null,
"ending_balance": null,
"finalized_at": null,
"footer": null,
"hosted_invoice_url": null,
"id": "in_NORMALIZED00000000000001",
@@ -43,6 +54,8 @@
"proration": false,
"quantity": 6,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
},
{
@@ -63,6 +76,8 @@
"proration": false,
"quantity": 1,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
}
],
@@ -77,16 +92,26 @@
"number": "NORMALI-0001",
"object": "invoice",
"paid": false,
"payment_intent": null,
"period_end": 1000000000,
"period_start": 1000000000,
"post_payment_credit_notes_amount": 0,
"pre_payment_credit_notes_amount": 0,
"receipt_number": null,
"starting_balance": 0,
"statement_descriptor": "Zulip Standard",
"status": "draft",
"status_transitions": {
"finalized_at": null,
"marked_uncollectible_at": null,
"paid_at": null,
"voided_at": null
},
"subscription": null,
"subtotal": 0,
"tax": 0,
"tax": null,
"tax_percent": null,
"total": 0,
"total_tax_amounts": [],
"webhooks_delivered_at": null
}

View File

@@ -1,24 +1,35 @@
{
"account_country": "US",
"account_name": "Dev account",
"amount_due": 0,
"amount_paid": 0,
"amount_remaining": 0,
"application_fee": null,
"application_fee_amount": null,
"attempt_count": 0,
"attempted": true,
"auto_advance": false,
"billing": "charge_automatically",
"billing_reason": "manual",
"charge": null,
"collection_method": "charge_automatically",
"created": 1000000000,
"currency": "usd",
"custom_fields": null,
"customer": "cus_NORMALIZED0001",
"date": 1000000000,
"customer_address": null,
"customer_email": "hamlet@zulip.com",
"customer_name": null,
"customer_phone": null,
"customer_shipping": null,
"customer_tax_exempt": "none",
"customer_tax_ids": [],
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
"description": "",
"discount": null,
"due_date": 1000000000,
"ending_balance": 0,
"finalized_at": 1000000000,
"footer": null,
"hosted_invoice_url": "https://pay.stripe.com/invoice/invst_NORMALIZED0000000000000001",
"id": "in_NORMALIZED00000000000001",
@@ -43,6 +54,8 @@
"proration": false,
"quantity": 6,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
},
{
@@ -63,6 +76,8 @@
"proration": false,
"quantity": 1,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
}
],
@@ -77,16 +92,26 @@
"number": "NORMALI-0001",
"object": "invoice",
"paid": true,
"payment_intent": null,
"period_end": 1000000000,
"period_start": 1000000000,
"post_payment_credit_notes_amount": 0,
"pre_payment_credit_notes_amount": 0,
"receipt_number": null,
"starting_balance": 0,
"statement_descriptor": "Zulip Standard",
"status": "paid",
"status_transitions": {
"finalized_at": 1000000000,
"marked_uncollectible_at": null,
"paid_at": 1000000000,
"voided_at": null
},
"subscription": null,
"subtotal": 0,
"tax": 0,
"tax": null,
"tax_percent": null,
"total": 0,
"total_tax_amounts": [],
"webhooks_delivered_at": 1000000000
}

View File

@@ -18,5 +18,6 @@
"proration": false,
"quantity": 1,
"subscription": null,
"tax_rates": [],
"unit_amount": -48000
}

View File

@@ -18,5 +18,6 @@
"proration": false,
"quantity": 6,
"subscription": null,
"tax_rates": [],
"unit_amount": 8000
}

View File

@@ -1,5 +1,7 @@
{
"account_balance": 0,
"address": null,
"balance": 0,
"created": 1000000000,
"currency": null,
"default_source": null,
@@ -11,6 +13,7 @@
"invoice_prefix": "NORMA01",
"invoice_settings": {
"custom_fields": null,
"default_payment_method": null,
"footer": null
},
"livemode": false,
@@ -18,7 +21,10 @@
"realm_id": "1",
"realm_str": "zulip"
},
"name": null,
"object": "customer",
"phone": null,
"preferred_locales": [],
"shipping": null,
"sources": {
"data": [],
@@ -34,6 +40,14 @@
"total_count": 0,
"url": "/v1/customers/cus_NORMALIZED0001/subscriptions"
},
"tax_exempt": "none",
"tax_ids": {
"data": [],
"has_more": false,
"object": "list",
"total_count": 0,
"url": "/v1/customers/cus_NORMALIZED0001/tax_ids"
},
"tax_info": null,
"tax_info_verification": null
}

View File

@@ -1,24 +1,35 @@
{
"account_country": "US",
"account_name": "Dev account",
"amount_due": 984000,
"amount_paid": 0,
"amount_remaining": 984000,
"application_fee": null,
"application_fee_amount": null,
"attempt_count": 0,
"attempted": false,
"auto_advance": true,
"billing": "send_invoice",
"billing_reason": "manual",
"charge": null,
"collection_method": "send_invoice",
"created": 1000000000,
"currency": "usd",
"custom_fields": null,
"customer": "cus_NORMALIZED0001",
"date": 1000000000,
"customer_address": null,
"customer_email": "hamlet@zulip.com",
"customer_name": null,
"customer_phone": null,
"customer_shipping": null,
"customer_tax_exempt": "none",
"customer_tax_ids": [],
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
"description": "",
"discount": null,
"due_date": 1000000000,
"ending_balance": null,
"finalized_at": null,
"footer": null,
"hosted_invoice_url": null,
"id": "in_NORMALIZED00000000000001",
@@ -43,6 +54,8 @@
"proration": false,
"quantity": 123,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
}
],
@@ -57,16 +70,26 @@
"number": "NORMALI-0001",
"object": "invoice",
"paid": false,
"payment_intent": null,
"period_end": 1000000000,
"period_start": 1000000000,
"post_payment_credit_notes_amount": 0,
"pre_payment_credit_notes_amount": 0,
"receipt_number": null,
"starting_balance": 0,
"statement_descriptor": "Zulip Standard",
"status": "draft",
"status_transitions": {
"finalized_at": null,
"marked_uncollectible_at": null,
"paid_at": null,
"voided_at": null
},
"subscription": null,
"subtotal": 984000,
"tax": 0,
"tax": null,
"tax_percent": null,
"total": 984000,
"total_tax_amounts": [],
"webhooks_delivered_at": null
}

View File

@@ -1,24 +1,35 @@
{
"account_country": "US",
"account_name": "Dev account",
"amount_due": 100,
"amount_paid": 0,
"amount_remaining": 100,
"application_fee": null,
"application_fee_amount": null,
"attempt_count": 0,
"attempted": false,
"auto_advance": true,
"billing": "send_invoice",
"billing_reason": "manual",
"charge": null,
"collection_method": "send_invoice",
"created": 1000000000,
"currency": "usd",
"custom_fields": null,
"customer": "cus_NORMALIZED0001",
"date": 1000000000,
"customer_address": null,
"customer_email": "hamlet@zulip.com",
"customer_name": null,
"customer_phone": null,
"customer_shipping": null,
"customer_tax_exempt": "none",
"customer_tax_ids": [],
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
"description": "",
"discount": null,
"due_date": 1000000000,
"ending_balance": null,
"finalized_at": null,
"footer": null,
"hosted_invoice_url": null,
"id": "in_NORMALIZED00000000000002",
@@ -43,6 +54,8 @@
"proration": false,
"quantity": 1,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
}
],
@@ -57,16 +70,26 @@
"number": "NORMALI-0002",
"object": "invoice",
"paid": false,
"payment_intent": null,
"period_end": 1000000000,
"period_start": 1000000000,
"post_payment_credit_notes_amount": 0,
"pre_payment_credit_notes_amount": 0,
"receipt_number": null,
"starting_balance": 0,
"statement_descriptor": "Zulip Standard",
"status": "draft",
"status_transitions": {
"finalized_at": null,
"marked_uncollectible_at": null,
"paid_at": null,
"voided_at": null
},
"subscription": null,
"subtotal": 100,
"tax": 0,
"tax": null,
"tax_percent": null,
"total": 100,
"total_tax_amounts": [],
"webhooks_delivered_at": null
}

View File

@@ -1,24 +1,35 @@
{
"account_country": "US",
"account_name": "Dev account",
"amount_due": 984000,
"amount_paid": 0,
"amount_remaining": 984000,
"application_fee": null,
"application_fee_amount": null,
"attempt_count": 0,
"attempted": false,
"auto_advance": true,
"billing": "send_invoice",
"billing_reason": "manual",
"charge": null,
"collection_method": "send_invoice",
"created": 1000000000,
"currency": "usd",
"custom_fields": null,
"customer": "cus_NORMALIZED0001",
"date": 1000000000,
"customer_address": null,
"customer_email": "hamlet@zulip.com",
"customer_name": null,
"customer_phone": null,
"customer_shipping": null,
"customer_tax_exempt": "none",
"customer_tax_ids": [],
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
"description": "",
"discount": null,
"due_date": 1000000000,
"ending_balance": 0,
"finalized_at": 1000000000,
"footer": null,
"hosted_invoice_url": "https://pay.stripe.com/invoice/invst_NORMALIZED0000000000000001",
"id": "in_NORMALIZED00000000000001",
@@ -43,6 +54,8 @@
"proration": false,
"quantity": 123,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
}
],
@@ -57,16 +70,26 @@
"number": "NORMALI-0001",
"object": "invoice",
"paid": false,
"payment_intent": "pi_1F96B0Gh0CmXqmnwFFVAGxWQ",
"period_end": 1000000000,
"period_start": 1000000000,
"post_payment_credit_notes_amount": 0,
"pre_payment_credit_notes_amount": 0,
"receipt_number": null,
"starting_balance": 0,
"statement_descriptor": "Zulip Standard",
"status": "open",
"status_transitions": {
"finalized_at": 1000000000,
"marked_uncollectible_at": null,
"paid_at": null,
"voided_at": null
},
"subscription": null,
"subtotal": 984000,
"tax": 0,
"tax": null,
"tax_percent": null,
"total": 984000,
"total_tax_amounts": [],
"webhooks_delivered_at": 1000000000
}

View File

@@ -1,24 +1,35 @@
{
"account_country": "US",
"account_name": "Dev account",
"amount_due": 100,
"amount_paid": 0,
"amount_remaining": 100,
"application_fee": null,
"application_fee_amount": null,
"attempt_count": 0,
"attempted": false,
"auto_advance": true,
"billing": "send_invoice",
"billing_reason": "manual",
"charge": null,
"collection_method": "send_invoice",
"created": 1000000000,
"currency": "usd",
"custom_fields": null,
"customer": "cus_NORMALIZED0001",
"date": 1000000000,
"customer_address": null,
"customer_email": "hamlet@zulip.com",
"customer_name": null,
"customer_phone": null,
"customer_shipping": null,
"customer_tax_exempt": "none",
"customer_tax_ids": [],
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
"description": "",
"discount": null,
"due_date": 1000000000,
"ending_balance": 0,
"finalized_at": 1000000000,
"footer": null,
"hosted_invoice_url": "https://pay.stripe.com/invoice/invst_NORMALIZED0000000000000002",
"id": "in_NORMALIZED00000000000002",
@@ -43,6 +54,8 @@
"proration": false,
"quantity": 1,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
}
],
@@ -57,16 +70,26 @@
"number": "NORMALI-0002",
"object": "invoice",
"paid": false,
"payment_intent": "pi_1F96B2Gh0CmXqmnwZLKqLOFy",
"period_end": 1000000000,
"period_start": 1000000000,
"post_payment_credit_notes_amount": 0,
"pre_payment_credit_notes_amount": 0,
"receipt_number": null,
"starting_balance": 0,
"statement_descriptor": "Zulip Standard",
"status": "open",
"status_transitions": {
"finalized_at": 1000000000,
"marked_uncollectible_at": null,
"paid_at": null,
"voided_at": null
},
"subscription": null,
"subtotal": 100,
"tax": 0,
"tax": null,
"tax_percent": null,
"total": 100,
"total_tax_amounts": [],
"webhooks_delivered_at": 1000000000
}

View File

@@ -1,26 +1,37 @@
{
"data": [
{
"account_country": "US",
"account_name": "Dev account",
"amount_due": 100,
"amount_paid": 0,
"amount_remaining": 100,
"application_fee": null,
"application_fee_amount": null,
"attempt_count": 0,
"attempted": false,
"auto_advance": true,
"billing": "send_invoice",
"billing_reason": "manual",
"charge": null,
"collection_method": "send_invoice",
"created": 1000000000,
"currency": "usd",
"custom_fields": null,
"customer": "cus_NORMALIZED0001",
"date": 1000000000,
"customer_address": null,
"customer_email": "hamlet@zulip.com",
"customer_name": null,
"customer_phone": null,
"customer_shipping": null,
"customer_tax_exempt": "none",
"customer_tax_ids": [],
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
"description": "",
"discount": null,
"due_date": 1000000000,
"ending_balance": 0,
"finalized_at": 1000000000,
"footer": null,
"hosted_invoice_url": "https://pay.stripe.com/invoice/invst_NORMALIZED0000000000000002",
"id": "in_NORMALIZED00000000000002",
@@ -45,6 +56,8 @@
"proration": false,
"quantity": 1,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
}
],
@@ -59,40 +72,61 @@
"number": "NORMALI-0002",
"object": "invoice",
"paid": false,
"payment_intent": "pi_1F96B2Gh0CmXqmnwZLKqLOFy",
"period_end": 1000000000,
"period_start": 1000000000,
"post_payment_credit_notes_amount": 0,
"pre_payment_credit_notes_amount": 0,
"receipt_number": null,
"starting_balance": 0,
"statement_descriptor": "Zulip Standard",
"status": "open",
"status_transitions": {
"finalized_at": 1000000000,
"marked_uncollectible_at": null,
"paid_at": null,
"voided_at": null
},
"subscription": null,
"subtotal": 100,
"tax": 0,
"tax": null,
"tax_percent": null,
"total": 100,
"total_tax_amounts": [],
"webhooks_delivered_at": 1000000000
},
{
"account_country": "US",
"account_name": "Dev account",
"amount_due": 984000,
"amount_paid": 0,
"amount_remaining": 984000,
"application_fee": null,
"application_fee_amount": null,
"attempt_count": 0,
"attempted": false,
"auto_advance": true,
"billing": "send_invoice",
"billing_reason": "manual",
"charge": null,
"collection_method": "send_invoice",
"created": 1000000000,
"currency": "usd",
"custom_fields": null,
"customer": "cus_NORMALIZED0001",
"date": 1000000000,
"customer_address": null,
"customer_email": "hamlet@zulip.com",
"customer_name": null,
"customer_phone": null,
"customer_shipping": null,
"customer_tax_exempt": "none",
"customer_tax_ids": [],
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
"description": "",
"discount": null,
"due_date": 1000000000,
"ending_balance": 0,
"finalized_at": 1000000000,
"footer": null,
"hosted_invoice_url": "https://pay.stripe.com/invoice/invst_NORMALIZED0000000000000001",
"id": "in_NORMALIZED00000000000001",
@@ -117,6 +151,8 @@
"proration": false,
"quantity": 123,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
}
],
@@ -131,17 +167,27 @@
"number": "NORMALI-0001",
"object": "invoice",
"paid": false,
"payment_intent": "pi_1F96B0Gh0CmXqmnwFFVAGxWQ",
"period_end": 1000000000,
"period_start": 1000000000,
"post_payment_credit_notes_amount": 0,
"pre_payment_credit_notes_amount": 0,
"receipt_number": null,
"starting_balance": 0,
"statement_descriptor": "Zulip Standard",
"status": "open",
"status_transitions": {
"finalized_at": 1000000000,
"marked_uncollectible_at": null,
"paid_at": null,
"voided_at": null
},
"subscription": null,
"subtotal": 984000,
"tax": 0,
"tax": null,
"tax_percent": null,
"total": 984000,
"total_tax_amounts": [],
"webhooks_delivered_at": 1000000000
}
],

View File

@@ -18,5 +18,6 @@
"proration": false,
"quantity": 123,
"subscription": null,
"tax_rates": [],
"unit_amount": 8000
}

View File

@@ -18,5 +18,6 @@
"proration": false,
"quantity": 1,
"subscription": null,
"tax_rates": [],
"unit_amount": 100
}

View File

@@ -5,6 +5,19 @@
"application_fee": null,
"application_fee_amount": null,
"balance_transaction": "txn_NORMALIZED00000000000001",
"billing_details": {
"address": {
"city": "Pacific",
"country": "United States",
"line1": "Under the sea,",
"line2": null,
"postal_code": "33333",
"state": null
},
"email": null,
"name": "Ada Starr",
"phone": null
},
"captured": true,
"created": 1000000000,
"currency": "usd",
@@ -32,6 +45,26 @@
},
"paid": true,
"payment_intent": null,
"payment_method": "card_NORMALIZED00000000000001",
"payment_method_details": {
"card": {
"brand": "visa",
"checks": {
"address_line1_check": "pass",
"address_postal_code_check": "pass",
"cvc_check": "pass"
},
"country": "US",
"exp_month": 3,
"exp_year": 2033,
"fingerprint": "NORMALIZED000001",
"funding": "credit",
"last4": "4242",
"three_d_secure": null,
"wallet": null
},
"type": "card"
},
"receipt_email": "hamlet@zulip.com",
"receipt_number": null,
"receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000001/rcpt_NORMALIZED000000000000000000001",
@@ -72,6 +105,7 @@
},
"source_transfer": null,
"statement_descriptor": "Zulip Standard",
"statement_descriptor_suffix": "Zulip Standard",
"status": "succeeded",
"transfer_data": null,
"transfer_group": null

View File

@@ -1,5 +1,7 @@
{
"account_balance": 0,
"address": null,
"balance": 0,
"created": 1000000000,
"currency": null,
"default_source": "card_NORMALIZED00000000000001",
@@ -11,6 +13,7 @@
"invoice_prefix": "NORMA01",
"invoice_settings": {
"custom_fields": null,
"default_payment_method": null,
"footer": null
},
"livemode": false,
@@ -18,7 +21,10 @@
"realm_id": "1",
"realm_str": "zulip"
},
"name": null,
"object": "customer",
"phone": null,
"preferred_locales": [],
"shipping": null,
"sources": {
"data": [
@@ -60,6 +66,14 @@
"total_count": 0,
"url": "/v1/customers/cus_NORMALIZED0001/subscriptions"
},
"tax_exempt": "none",
"tax_ids": {
"data": [],
"has_more": false,
"object": "list",
"total_count": 0,
"url": "/v1/customers/cus_NORMALIZED0001/tax_ids"
},
"tax_info": null,
"tax_info_verification": null
}

View File

@@ -1,24 +1,35 @@
{
"account_country": "US",
"account_name": "Dev account",
"amount_due": 0,
"amount_paid": 0,
"amount_remaining": 0,
"application_fee": null,
"application_fee_amount": null,
"attempt_count": 0,
"attempted": false,
"auto_advance": true,
"billing": "charge_automatically",
"billing_reason": "manual",
"charge": null,
"collection_method": "charge_automatically",
"created": 1000000000,
"currency": "usd",
"custom_fields": null,
"customer": "cus_NORMALIZED0001",
"date": 1000000000,
"customer_address": null,
"customer_email": "hamlet@zulip.com",
"customer_name": null,
"customer_phone": null,
"customer_shipping": null,
"customer_tax_exempt": "none",
"customer_tax_ids": [],
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
"description": "",
"discount": null,
"due_date": null,
"ending_balance": null,
"finalized_at": null,
"footer": null,
"hosted_invoice_url": null,
"id": "in_NORMALIZED00000000000001",
@@ -43,6 +54,8 @@
"proration": false,
"quantity": 6,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
},
{
@@ -63,6 +76,8 @@
"proration": false,
"quantity": 1,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
}
],
@@ -77,16 +92,26 @@
"number": "NORMALI-0001",
"object": "invoice",
"paid": false,
"payment_intent": null,
"period_end": 1000000000,
"period_start": 1000000000,
"post_payment_credit_notes_amount": 0,
"pre_payment_credit_notes_amount": 0,
"receipt_number": null,
"starting_balance": 0,
"statement_descriptor": "Zulip Standard",
"status": "draft",
"status_transitions": {
"finalized_at": null,
"marked_uncollectible_at": null,
"paid_at": null,
"voided_at": null
},
"subscription": null,
"subtotal": 0,
"tax": 0,
"tax": null,
"tax_percent": null,
"total": 0,
"total_tax_amounts": [],
"webhooks_delivered_at": null
}

View File

@@ -1,24 +1,35 @@
{
"account_country": "US",
"account_name": "Dev account",
"amount_due": 80697,
"amount_paid": 0,
"amount_remaining": 80697,
"application_fee": null,
"application_fee_amount": null,
"attempt_count": 0,
"attempted": false,
"auto_advance": true,
"billing": "charge_automatically",
"billing_reason": "manual",
"charge": null,
"collection_method": "charge_automatically",
"created": 1000000000,
"currency": "usd",
"custom_fields": null,
"customer": "cus_NORMALIZED0001",
"date": 1000000000,
"customer_address": null,
"customer_email": "hamlet@zulip.com",
"customer_name": null,
"customer_phone": null,
"customer_shipping": null,
"customer_tax_exempt": "none",
"customer_tax_ids": [],
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
"description": "",
"discount": null,
"due_date": null,
"ending_balance": null,
"finalized_at": null,
"footer": null,
"hosted_invoice_url": null,
"id": "in_NORMALIZED00000000000002",
@@ -43,6 +54,8 @@
"proration": false,
"quantity": 1,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
},
{
@@ -63,6 +76,8 @@
"proration": false,
"quantity": 7,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
},
{
@@ -83,6 +98,8 @@
"proration": false,
"quantity": 3,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
}
],
@@ -97,16 +114,26 @@
"number": "NORMALI-0002",
"object": "invoice",
"paid": false,
"payment_intent": null,
"period_end": 1000000000,
"period_start": 1000000000,
"post_payment_credit_notes_amount": 0,
"pre_payment_credit_notes_amount": 0,
"receipt_number": null,
"starting_balance": 0,
"statement_descriptor": "Zulip Standard",
"status": "draft",
"status_transitions": {
"finalized_at": null,
"marked_uncollectible_at": null,
"paid_at": null,
"voided_at": null
},
"subscription": null,
"subtotal": 80697,
"tax": 0,
"tax": null,
"tax_percent": null,
"total": 80697,
"total_tax_amounts": [],
"webhooks_delivered_at": null
}

View File

@@ -1,24 +1,35 @@
{
"account_country": "US",
"account_name": "Dev account",
"amount_due": 0,
"amount_paid": 0,
"amount_remaining": 0,
"application_fee": null,
"application_fee_amount": null,
"attempt_count": 0,
"attempted": true,
"auto_advance": false,
"billing": "charge_automatically",
"billing_reason": "manual",
"charge": null,
"collection_method": "charge_automatically",
"created": 1000000000,
"currency": "usd",
"custom_fields": null,
"customer": "cus_NORMALIZED0001",
"date": 1000000000,
"customer_address": null,
"customer_email": "hamlet@zulip.com",
"customer_name": null,
"customer_phone": null,
"customer_shipping": null,
"customer_tax_exempt": "none",
"customer_tax_ids": [],
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
"description": "",
"discount": null,
"due_date": 1000000000,
"ending_balance": 0,
"finalized_at": 1000000000,
"footer": null,
"hosted_invoice_url": "https://pay.stripe.com/invoice/invst_NORMALIZED0000000000000001",
"id": "in_NORMALIZED00000000000001",
@@ -43,6 +54,8 @@
"proration": false,
"quantity": 6,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
},
{
@@ -63,6 +76,8 @@
"proration": false,
"quantity": 1,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
}
],
@@ -77,16 +92,26 @@
"number": "NORMALI-0001",
"object": "invoice",
"paid": true,
"payment_intent": null,
"period_end": 1000000000,
"period_start": 1000000000,
"post_payment_credit_notes_amount": 0,
"pre_payment_credit_notes_amount": 0,
"receipt_number": null,
"starting_balance": 0,
"statement_descriptor": "Zulip Standard",
"status": "paid",
"status_transitions": {
"finalized_at": 1000000000,
"marked_uncollectible_at": null,
"paid_at": 1000000000,
"voided_at": null
},
"subscription": null,
"subtotal": 0,
"tax": 0,
"tax": null,
"tax_percent": null,
"total": 0,
"total_tax_amounts": [],
"webhooks_delivered_at": 1000000000
}

View File

@@ -1,24 +1,35 @@
{
"account_country": "US",
"account_name": "Dev account",
"amount_due": 80697,
"amount_paid": 0,
"amount_remaining": 80697,
"application_fee": null,
"application_fee_amount": null,
"attempt_count": 0,
"attempted": false,
"auto_advance": true,
"billing": "charge_automatically",
"billing_reason": "manual",
"charge": null,
"collection_method": "charge_automatically",
"created": 1000000000,
"currency": "usd",
"custom_fields": null,
"customer": "cus_NORMALIZED0001",
"date": 1000000000,
"customer_address": null,
"customer_email": "hamlet@zulip.com",
"customer_name": null,
"customer_phone": null,
"customer_shipping": null,
"customer_tax_exempt": "none",
"customer_tax_ids": [],
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
"description": "",
"discount": null,
"due_date": 1000000000,
"ending_balance": 0,
"finalized_at": 1000000000,
"footer": null,
"hosted_invoice_url": "https://pay.stripe.com/invoice/invst_NORMALIZED0000000000000002",
"id": "in_NORMALIZED00000000000002",
@@ -43,6 +54,8 @@
"proration": false,
"quantity": 1,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
},
{
@@ -63,6 +76,8 @@
"proration": false,
"quantity": 7,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
},
{
@@ -83,6 +98,8 @@
"proration": false,
"quantity": 3,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
}
],
@@ -97,16 +114,26 @@
"number": "NORMALI-0002",
"object": "invoice",
"paid": false,
"payment_intent": "pi_1F96BCGh0CmXqmnwfafGafrD",
"period_end": 1000000000,
"period_start": 1000000000,
"post_payment_credit_notes_amount": 0,
"pre_payment_credit_notes_amount": 0,
"receipt_number": null,
"starting_balance": 0,
"statement_descriptor": "Zulip Standard",
"status": "open",
"status_transitions": {
"finalized_at": 1000000000,
"marked_uncollectible_at": null,
"paid_at": null,
"voided_at": null
},
"subscription": null,
"subtotal": 80697,
"tax": 0,
"tax": null,
"tax_percent": null,
"total": 80697,
"total_tax_amounts": [],
"webhooks_delivered_at": 1000000000
}

View File

@@ -1,26 +1,37 @@
{
"data": [
{
"account_country": "US",
"account_name": "Dev account",
"amount_due": 80697,
"amount_paid": 0,
"amount_remaining": 80697,
"application_fee": null,
"application_fee_amount": null,
"attempt_count": 0,
"attempted": false,
"auto_advance": true,
"billing": "charge_automatically",
"billing_reason": "manual",
"charge": null,
"collection_method": "charge_automatically",
"created": 1000000000,
"currency": "usd",
"custom_fields": null,
"customer": "cus_NORMALIZED0001",
"date": 1000000000,
"customer_address": null,
"customer_email": "hamlet@zulip.com",
"customer_name": null,
"customer_phone": null,
"customer_shipping": null,
"customer_tax_exempt": "none",
"customer_tax_ids": [],
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
"description": "",
"discount": null,
"due_date": 1000000000,
"ending_balance": 0,
"finalized_at": 1000000000,
"footer": null,
"hosted_invoice_url": "https://pay.stripe.com/invoice/invst_NORMALIZED0000000000000002",
"id": "in_NORMALIZED00000000000002",
@@ -45,6 +56,8 @@
"proration": false,
"quantity": 1,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
},
{
@@ -65,6 +78,8 @@
"proration": false,
"quantity": 7,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
},
{
@@ -85,6 +100,8 @@
"proration": false,
"quantity": 3,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
}
],
@@ -99,40 +116,61 @@
"number": "NORMALI-0002",
"object": "invoice",
"paid": false,
"payment_intent": "pi_1F96BCGh0CmXqmnwfafGafrD",
"period_end": 1000000000,
"period_start": 1000000000,
"post_payment_credit_notes_amount": 0,
"pre_payment_credit_notes_amount": 0,
"receipt_number": null,
"starting_balance": 0,
"statement_descriptor": "Zulip Standard",
"status": "open",
"status_transitions": {
"finalized_at": 1000000000,
"marked_uncollectible_at": null,
"paid_at": null,
"voided_at": null
},
"subscription": null,
"subtotal": 80697,
"tax": 0,
"tax": null,
"tax_percent": null,
"total": 80697,
"total_tax_amounts": [],
"webhooks_delivered_at": 1000000000
},
{
"account_country": "US",
"account_name": "Dev account",
"amount_due": 0,
"amount_paid": 0,
"amount_remaining": 0,
"application_fee": null,
"application_fee_amount": null,
"attempt_count": 0,
"attempted": true,
"auto_advance": false,
"billing": "charge_automatically",
"billing_reason": "manual",
"charge": null,
"collection_method": "charge_automatically",
"created": 1000000000,
"currency": "usd",
"custom_fields": null,
"customer": "cus_NORMALIZED0001",
"date": 1000000000,
"customer_address": null,
"customer_email": "hamlet@zulip.com",
"customer_name": null,
"customer_phone": null,
"customer_shipping": null,
"customer_tax_exempt": "none",
"customer_tax_ids": [],
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
"description": "",
"discount": null,
"due_date": 1000000000,
"ending_balance": 0,
"finalized_at": 1000000000,
"footer": null,
"hosted_invoice_url": "https://pay.stripe.com/invoice/invst_NORMALIZED0000000000000001",
"id": "in_NORMALIZED00000000000001",
@@ -157,6 +195,8 @@
"proration": false,
"quantity": 6,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
},
{
@@ -177,6 +217,8 @@
"proration": false,
"quantity": 1,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
}
],
@@ -191,17 +233,27 @@
"number": "NORMALI-0001",
"object": "invoice",
"paid": true,
"payment_intent": null,
"period_end": 1000000000,
"period_start": 1000000000,
"post_payment_credit_notes_amount": 0,
"pre_payment_credit_notes_amount": 0,
"receipt_number": null,
"starting_balance": 0,
"statement_descriptor": "Zulip Standard",
"status": "paid",
"status_transitions": {
"finalized_at": 1000000000,
"marked_uncollectible_at": null,
"paid_at": 1000000000,
"voided_at": null
},
"subscription": null,
"subtotal": 0,
"tax": 0,
"tax": null,
"tax_percent": null,
"total": 0,
"total_tax_amounts": [],
"webhooks_delivered_at": 1000000000
}
],

View File

@@ -18,5 +18,6 @@
"proration": false,
"quantity": 1,
"subscription": null,
"tax_rates": [],
"unit_amount": -48000
}

View File

@@ -18,5 +18,6 @@
"proration": false,
"quantity": 6,
"subscription": null,
"tax_rates": [],
"unit_amount": 8000
}

View File

@@ -18,5 +18,6 @@
"proration": false,
"quantity": 3,
"subscription": null,
"tax_rates": [],
"unit_amount": 5814
}

View File

@@ -18,5 +18,6 @@
"proration": false,
"quantity": 7,
"subscription": null,
"tax_rates": [],
"unit_amount": 8000
}

View File

@@ -18,5 +18,6 @@
"proration": false,
"quantity": 1,
"subscription": null,
"tax_rates": [],
"unit_amount": 7255
}

View File

@@ -15,7 +15,7 @@
},
"livemode": false,
"metadata": {
"realm_id": "1",
"realm_id": "2",
"realm_str": "zulip"
},
"object": "customer",

View File

@@ -5,6 +5,19 @@
"application_fee": null,
"application_fee_amount": null,
"balance_transaction": "txn_NORMALIZED00000000000001",
"billing_details": {
"address": {
"city": "Pacific",
"country": "United States",
"line1": "Under the sea,",
"line2": null,
"postal_code": "33333",
"state": null
},
"email": null,
"name": "Ada Starr",
"phone": null
},
"captured": true,
"created": 1000000000,
"currency": "usd",
@@ -32,6 +45,26 @@
},
"paid": true,
"payment_intent": null,
"payment_method": "card_NORMALIZED00000000000001",
"payment_method_details": {
"card": {
"brand": "visa",
"checks": {
"address_line1_check": "pass",
"address_postal_code_check": "pass",
"cvc_check": "pass"
},
"country": "US",
"exp_month": 3,
"exp_year": 2033,
"fingerprint": "NORMALIZED000001",
"funding": "credit",
"last4": "4242",
"three_d_secure": null,
"wallet": null
},
"type": "card"
},
"receipt_email": "hamlet@zulip.com",
"receipt_number": null,
"receipt_url": "https://pay.stripe.com/receipts/acct_NORMALIZED000001/ch_NORMALIZED00000000000001/rcpt_NORMALIZED000000000000000000001",
@@ -72,6 +105,7 @@
},
"source_transfer": null,
"statement_descriptor": "Zulip Standard",
"statement_descriptor_suffix": "Zulip Standard",
"status": "succeeded",
"transfer_data": null,
"transfer_group": null

View File

@@ -1,5 +1,7 @@
{
"account_balance": 0,
"address": null,
"balance": 0,
"created": 1000000000,
"currency": null,
"default_source": "card_NORMALIZED00000000000001",
@@ -11,6 +13,7 @@
"invoice_prefix": "NORMA01",
"invoice_settings": {
"custom_fields": null,
"default_payment_method": null,
"footer": null
},
"livemode": false,
@@ -18,7 +21,10 @@
"realm_id": "1",
"realm_str": "zulip"
},
"name": null,
"object": "customer",
"phone": null,
"preferred_locales": [],
"shipping": null,
"sources": {
"data": [
@@ -60,6 +66,14 @@
"total_count": 0,
"url": "/v1/customers/cus_NORMALIZED0001/subscriptions"
},
"tax_exempt": "none",
"tax_ids": {
"data": [],
"has_more": false,
"object": "list",
"total_count": 0,
"url": "/v1/customers/cus_NORMALIZED0001/tax_ids"
},
"tax_info": null,
"tax_info_verification": null
}

View File

@@ -1,5 +1,7 @@
{
"account_balance": 0,
"address": null,
"balance": 0,
"created": 1000000000,
"currency": "usd",
"default_source": {
@@ -35,6 +37,7 @@
"invoice_prefix": "NORMA01",
"invoice_settings": {
"custom_fields": null,
"default_payment_method": null,
"footer": null
},
"livemode": false,
@@ -42,7 +45,10 @@
"realm_id": "1",
"realm_str": "zulip"
},
"name": null,
"object": "customer",
"phone": null,
"preferred_locales": [],
"shipping": null,
"sources": {
"data": [
@@ -84,6 +90,14 @@
"total_count": 0,
"url": "/v1/customers/cus_NORMALIZED0001/subscriptions"
},
"tax_exempt": "none",
"tax_ids": {
"data": [],
"has_more": false,
"object": "list",
"total_count": 0,
"url": "/v1/customers/cus_NORMALIZED0001/tax_ids"
},
"tax_info": null,
"tax_info_verification": null
}

View File

@@ -1,5 +1,7 @@
{
"account_balance": 0,
"address": null,
"balance": 0,
"created": 1000000000,
"currency": "usd",
"default_source": {
@@ -11,17 +13,17 @@
"address_state": null,
"address_zip": "33333",
"address_zip_check": "pass",
"brand": "MasterCard",
"brand": "Visa",
"country": "US",
"customer": "cus_NORMALIZED0001",
"cvc_check": "pass",
"dynamic_last4": null,
"exp_month": 3,
"exp_year": 2033,
"fingerprint": "NORMALIZED000002",
"fingerprint": "NORMALIZED000001",
"funding": "credit",
"id": "card_NORMALIZED00000000000002",
"last4": "4444",
"id": "card_NORMALIZED00000000000001",
"last4": "4242",
"metadata": {},
"name": "Ada Starr",
"object": "card",
@@ -35,6 +37,7 @@
"invoice_prefix": "NORMA01",
"invoice_settings": {
"custom_fields": null,
"default_payment_method": null,
"footer": null
},
"livemode": false,
@@ -42,7 +45,10 @@
"realm_id": "1",
"realm_str": "zulip"
},
"name": null,
"object": "customer",
"phone": null,
"preferred_locales": [],
"shipping": null,
"sources": {
"data": [
@@ -55,17 +61,17 @@
"address_state": null,
"address_zip": "33333",
"address_zip_check": "pass",
"brand": "MasterCard",
"brand": "Visa",
"country": "US",
"customer": "cus_NORMALIZED0001",
"cvc_check": "pass",
"dynamic_last4": null,
"exp_month": 3,
"exp_year": 2033,
"fingerprint": "NORMALIZED000002",
"fingerprint": "NORMALIZED000001",
"funding": "credit",
"id": "card_NORMALIZED00000000000002",
"last4": "4444",
"id": "card_NORMALIZED00000000000001",
"last4": "4242",
"metadata": {},
"name": "Ada Starr",
"object": "card",
@@ -84,6 +90,14 @@
"total_count": 0,
"url": "/v1/customers/cus_NORMALIZED0001/subscriptions"
},
"tax_exempt": "none",
"tax_ids": {
"data": [],
"has_more": false,
"object": "list",
"total_count": 0,
"url": "/v1/customers/cus_NORMALIZED0001/tax_ids"
},
"tax_info": null,
"tax_info_verification": null
}

View File

@@ -1,5 +1,7 @@
{
"account_balance": 0,
"address": null,
"balance": 0,
"created": 1000000000,
"currency": "usd",
"default_source": {
@@ -11,17 +13,17 @@
"address_state": null,
"address_zip": "33333",
"address_zip_check": "pass",
"brand": "MasterCard",
"brand": "Visa",
"country": "US",
"customer": "cus_NORMALIZED0001",
"cvc_check": "pass",
"dynamic_last4": null,
"exp_month": 3,
"exp_year": 2033,
"fingerprint": "NORMALIZED000002",
"fingerprint": "NORMALIZED000001",
"funding": "credit",
"id": "card_NORMALIZED00000000000002",
"last4": "4444",
"id": "card_NORMALIZED00000000000001",
"last4": "4242",
"metadata": {},
"name": "Ada Starr",
"object": "card",
@@ -35,6 +37,7 @@
"invoice_prefix": "NORMA01",
"invoice_settings": {
"custom_fields": null,
"default_payment_method": null,
"footer": null
},
"livemode": false,
@@ -42,7 +45,10 @@
"realm_id": "1",
"realm_str": "zulip"
},
"name": null,
"object": "customer",
"phone": null,
"preferred_locales": [],
"shipping": null,
"sources": {
"data": [
@@ -55,17 +61,17 @@
"address_state": null,
"address_zip": "33333",
"address_zip_check": "pass",
"brand": "MasterCard",
"brand": "Visa",
"country": "US",
"customer": "cus_NORMALIZED0001",
"cvc_check": "pass",
"dynamic_last4": null,
"exp_month": 3,
"exp_year": 2033,
"fingerprint": "NORMALIZED000002",
"fingerprint": "NORMALIZED000001",
"funding": "credit",
"id": "card_NORMALIZED00000000000002",
"last4": "4444",
"id": "card_NORMALIZED00000000000001",
"last4": "4242",
"metadata": {},
"name": "Ada Starr",
"object": "card",
@@ -84,6 +90,14 @@
"total_count": 0,
"url": "/v1/customers/cus_NORMALIZED0001/subscriptions"
},
"tax_exempt": "none",
"tax_ids": {
"data": [],
"has_more": false,
"object": "list",
"total_count": 0,
"url": "/v1/customers/cus_NORMALIZED0001/tax_ids"
},
"tax_info": null,
"tax_info_verification": null
}

View File

@@ -1,5 +1,7 @@
{
"account_balance": 0,
"address": null,
"balance": 0,
"created": 1000000000,
"currency": "usd",
"default_source": {
@@ -11,7 +13,7 @@
"address_state": null,
"address_zip": "33333",
"address_zip_check": "pass",
"brand": "MasterCard",
"brand": "Visa",
"country": "US",
"customer": "cus_NORMALIZED0001",
"cvc_check": "pass",
@@ -21,13 +23,13 @@
"fingerprint": "NORMALIZED000002",
"funding": "credit",
"id": "card_NORMALIZED00000000000002",
"last4": "4444",
"last4": "0341",
"metadata": {},
"name": "Ada Starr",
"object": "card",
"tokenization_method": null
},
"delinquent": false,
"delinquent": true,
"description": "zulip (Zulip Dev)",
"discount": null,
"email": "hamlet@zulip.com",
@@ -35,6 +37,7 @@
"invoice_prefix": "NORMA01",
"invoice_settings": {
"custom_fields": null,
"default_payment_method": null,
"footer": null
},
"livemode": false,
@@ -42,7 +45,10 @@
"realm_id": "1",
"realm_str": "zulip"
},
"name": null,
"object": "customer",
"phone": null,
"preferred_locales": [],
"shipping": null,
"sources": {
"data": [
@@ -55,7 +61,7 @@
"address_state": null,
"address_zip": "33333",
"address_zip_check": "pass",
"brand": "MasterCard",
"brand": "Visa",
"country": "US",
"customer": "cus_NORMALIZED0001",
"cvc_check": "pass",
@@ -65,7 +71,7 @@
"fingerprint": "NORMALIZED000002",
"funding": "credit",
"id": "card_NORMALIZED00000000000002",
"last4": "4444",
"last4": "0341",
"metadata": {},
"name": "Ada Starr",
"object": "card",
@@ -84,6 +90,14 @@
"total_count": 0,
"url": "/v1/customers/cus_NORMALIZED0001/subscriptions"
},
"tax_exempt": "none",
"tax_ids": {
"data": [],
"has_more": false,
"object": "list",
"total_count": 0,
"url": "/v1/customers/cus_NORMALIZED0001/tax_ids"
},
"tax_info": null,
"tax_info_verification": null
}

View File

@@ -0,0 +1,103 @@
{
"account_balance": 0,
"address": null,
"balance": 0,
"created": 1000000000,
"currency": "usd",
"default_source": {
"address_city": "Pacific",
"address_country": "United States",
"address_line1": "Under the sea,",
"address_line1_check": "pass",
"address_line2": null,
"address_state": null,
"address_zip": "33333",
"address_zip_check": "pass",
"brand": "Visa",
"country": "US",
"customer": "cus_NORMALIZED0001",
"cvc_check": "pass",
"dynamic_last4": null,
"exp_month": 3,
"exp_year": 2033,
"fingerprint": "NORMALIZED000002",
"funding": "credit",
"id": "card_NORMALIZED00000000000002",
"last4": "0341",
"metadata": {},
"name": "Ada Starr",
"object": "card",
"tokenization_method": null
},
"delinquent": true,
"description": "zulip (Zulip Dev)",
"discount": null,
"email": "hamlet@zulip.com",
"id": "cus_NORMALIZED0001",
"invoice_prefix": "NORMA01",
"invoice_settings": {
"custom_fields": null,
"default_payment_method": null,
"footer": null
},
"livemode": false,
"metadata": {
"realm_id": "1",
"realm_str": "zulip"
},
"name": null,
"object": "customer",
"phone": null,
"preferred_locales": [],
"shipping": null,
"sources": {
"data": [
{
"address_city": "Pacific",
"address_country": "United States",
"address_line1": "Under the sea,",
"address_line1_check": "pass",
"address_line2": null,
"address_state": null,
"address_zip": "33333",
"address_zip_check": "pass",
"brand": "Visa",
"country": "US",
"customer": "cus_NORMALIZED0001",
"cvc_check": "pass",
"dynamic_last4": null,
"exp_month": 3,
"exp_year": 2033,
"fingerprint": "NORMALIZED000002",
"funding": "credit",
"id": "card_NORMALIZED00000000000002",
"last4": "0341",
"metadata": {},
"name": "Ada Starr",
"object": "card",
"tokenization_method": null
}
],
"has_more": false,
"object": "list",
"total_count": 1,
"url": "/v1/customers/cus_NORMALIZED0001/sources"
},
"subscriptions": {
"data": [],
"has_more": false,
"object": "list",
"total_count": 0,
"url": "/v1/customers/cus_NORMALIZED0001/subscriptions"
},
"tax_exempt": "none",
"tax_ids": {
"data": [],
"has_more": false,
"object": "list",
"total_count": 0,
"url": "/v1/customers/cus_NORMALIZED0001/tax_ids"
},
"tax_info": null,
"tax_info_verification": null
}

View File

@@ -0,0 +1,103 @@
{
"account_balance": 0,
"address": null,
"balance": 0,
"created": 1000000000,
"currency": "usd",
"default_source": {
"address_city": "Pacific",
"address_country": "United States",
"address_line1": "Under the sea,",
"address_line1_check": "pass",
"address_line2": null,
"address_state": null,
"address_zip": "33333",
"address_zip_check": "pass",
"brand": "MasterCard",
"country": "US",
"customer": "cus_NORMALIZED0001",
"cvc_check": "pass",
"dynamic_last4": null,
"exp_month": 3,
"exp_year": 2033,
"fingerprint": "NORMALIZED000003",
"funding": "credit",
"id": "card_NORMALIZED00000000000003",
"last4": "4444",
"metadata": {},
"name": "Ada Starr",
"object": "card",
"tokenization_method": null
},
"delinquent": false,
"description": "zulip (Zulip Dev)",
"discount": null,
"email": "hamlet@zulip.com",
"id": "cus_NORMALIZED0001",
"invoice_prefix": "NORMA01",
"invoice_settings": {
"custom_fields": null,
"default_payment_method": null,
"footer": null
},
"livemode": false,
"metadata": {
"realm_id": "1",
"realm_str": "zulip"
},
"name": null,
"object": "customer",
"phone": null,
"preferred_locales": [],
"shipping": null,
"sources": {
"data": [
{
"address_city": "Pacific",
"address_country": "United States",
"address_line1": "Under the sea,",
"address_line1_check": "pass",
"address_line2": null,
"address_state": null,
"address_zip": "33333",
"address_zip_check": "pass",
"brand": "MasterCard",
"country": "US",
"customer": "cus_NORMALIZED0001",
"cvc_check": "pass",
"dynamic_last4": null,
"exp_month": 3,
"exp_year": 2033,
"fingerprint": "NORMALIZED000003",
"funding": "credit",
"id": "card_NORMALIZED00000000000003",
"last4": "4444",
"metadata": {},
"name": "Ada Starr",
"object": "card",
"tokenization_method": null
}
],
"has_more": false,
"object": "list",
"total_count": 1,
"url": "/v1/customers/cus_NORMALIZED0001/sources"
},
"subscriptions": {
"data": [],
"has_more": false,
"object": "list",
"total_count": 0,
"url": "/v1/customers/cus_NORMALIZED0001/subscriptions"
},
"tax_exempt": "none",
"tax_ids": {
"data": [],
"has_more": false,
"object": "list",
"total_count": 0,
"url": "/v1/customers/cus_NORMALIZED0001/tax_ids"
},
"tax_info": null,
"tax_info_verification": null
}

View File

@@ -1,65 +1,36 @@
{
"account_balance": 0,
"created": 1000000000,
"currency": "usd",
"default_source": "card_NORMALIZED00000000000002",
"delinquent": false,
"description": "zulip (Zulip Dev)",
"discount": null,
"email": "hamlet@zulip.com",
"id": "cus_NORMALIZED0001",
"invoice_prefix": "NORMA01",
"invoice_settings": {
"custom_fields": null,
"footer": null
"_message": "Your card was declined.",
"code": "card_declined",
"headers": {
"Connection": "keep-alive",
"Content-Length": "235",
"Content-Type": "application/json",
"Date": "NORMALIZED DATETIME",
"Server": "nginx",
"Strict-Transport-Security": "max-age=31556926; includeSubDomains; preload",
"access-control-allow-credentials": "true",
"access-control-allow-methods": "GET, POST, HEAD, OPTIONS, DELETE",
"access-control-allow-origin": "*",
"access-control-expose-headers": "Request-Id, Stripe-Manage-Version, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required",
"access-control-max-age": "300",
"cache-control": "no-cache, no-store",
"idempotency-key": "00000000-0000-0000-0000-000000000000",
"original-request": "req_NORMALIZED0001",
"request-id": "req_NORMALIZED0001",
"stripe-version": "2019-03-14"
},
"livemode": false,
"metadata": {
"realm_id": "1",
"realm_str": "zulip"
"http_body": "{\n \"error\": {\n \"code\": \"card_declined\",\n \"decline_code\": \"lost_card\",\n \"doc_url\": \"https://stripe.com/docs/error-codes/card-declined\",\n \"message\": \"Your card was declined.\",\n \"param\": \"\",\n \"type\": \"card_error\"\n }\n}\n",
"http_status": 402,
"json_body": {
"error": {
"code": "card_declined",
"decline_code": "lost_card",
"doc_url": "https://stripe.com/docs/error-codes/card-declined",
"message": "Your card was declined.",
"param": "",
"type": "card_error"
}
},
"object": "customer",
"shipping": null,
"sources": {
"data": [
{
"address_city": "Pacific",
"address_country": "United States",
"address_line1": "Under the sea,",
"address_line1_check": "pass",
"address_line2": null,
"address_state": null,
"address_zip": "33333",
"address_zip_check": "pass",
"brand": "MasterCard",
"country": "US",
"customer": "cus_NORMALIZED0001",
"cvc_check": "pass",
"dynamic_last4": null,
"exp_month": 3,
"exp_year": 2033,
"fingerprint": "NORMALIZED000002",
"funding": "credit",
"id": "card_NORMALIZED00000000000002",
"last4": "4444",
"metadata": {},
"name": "Ada Starr",
"object": "card",
"tokenization_method": null
}
],
"has_more": false,
"object": "list",
"total_count": 1,
"url": "/v1/customers/cus_NORMALIZED0001/sources"
},
"subscriptions": {
"data": [],
"has_more": false,
"object": "list",
"total_count": 0,
"url": "/v1/customers/cus_NORMALIZED0001/subscriptions"
},
"tax_info": null,
"tax_info_verification": null
"param": "",
"request_id": "req_NORMALIZED0001"
}

View File

@@ -1,36 +1,79 @@
{
"_message": "Your card was declined.",
"code": "card_declined",
"headers": {
"Access-Control-Allow-Credentials": "true",
"Access-Control-Allow-Methods": "GET, POST, HEAD, OPTIONS, DELETE",
"Access-Control-Allow-Origin": "*",
"Access-Control-Expose-Headers": "Request-Id, Stripe-Manage-Version, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required",
"Access-Control-Max-Age": "300",
"Cache-Control": "no-cache, no-store",
"Connection": "keep-alive",
"Content-Length": "235",
"Content-Type": "application/json",
"Date": "NORMALIZED DATETIME",
"Idempotency-Key": "7b90998a-36d2-459e-9fd7-8f6e442bda0e",
"Original-Request": "req_NORMALIZED0001",
"Request-Id": "req_NORMALIZED0001",
"Server": "nginx",
"Strict-Transport-Security": "max-age=31556926; includeSubDomains; preload",
"Stripe-Version": "2018-11-08"
"account_balance": 0,
"address": null,
"balance": 0,
"created": 1000000000,
"currency": "usd",
"default_source": "card_NORMALIZED00000000000002",
"delinquent": false,
"description": "zulip (Zulip Dev)",
"discount": null,
"email": "hamlet@zulip.com",
"id": "cus_NORMALIZED0001",
"invoice_prefix": "NORMA01",
"invoice_settings": {
"custom_fields": null,
"default_payment_method": null,
"footer": null
},
"http_body": "{\n \"error\": {\n \"code\": \"card_declined\",\n \"decline_code\": \"lost_card\",\n \"doc_url\": \"https://stripe.com/docs/error-codes/card-declined\",\n \"message\": \"Your card was declined.\",\n \"param\": \"\",\n \"type\": \"card_error\"\n }\n}\n",
"http_status": 402,
"json_body": {
"error": {
"code": "card_declined",
"decline_code": "lost_card",
"doc_url": "https://stripe.com/docs/error-codes/card-declined",
"message": "Your card was declined.",
"param": "",
"type": "card_error"
}
"livemode": false,
"metadata": {
"realm_id": "1",
"realm_str": "zulip"
},
"param": "",
"request_id": "req_NORMALIZED0001"
"name": null,
"object": "customer",
"phone": null,
"preferred_locales": [],
"shipping": null,
"sources": {
"data": [
{
"address_city": "Pacific",
"address_country": "United States",
"address_line1": "Under the sea,",
"address_line1_check": "pass",
"address_line2": null,
"address_state": null,
"address_zip": "33333",
"address_zip_check": "pass",
"brand": "Visa",
"country": "US",
"customer": "cus_NORMALIZED0001",
"cvc_check": "pass",
"dynamic_last4": null,
"exp_month": 3,
"exp_year": 2033,
"fingerprint": "NORMALIZED000002",
"funding": "credit",
"id": "card_NORMALIZED00000000000002",
"last4": "0341",
"metadata": {},
"name": "Ada Starr",
"object": "card",
"tokenization_method": null
}
],
"has_more": false,
"object": "list",
"total_count": 1,
"url": "/v1/customers/cus_NORMALIZED0001/sources"
},
"subscriptions": {
"data": [],
"has_more": false,
"object": "list",
"total_count": 0,
"url": "/v1/customers/cus_NORMALIZED0001/subscriptions"
},
"tax_exempt": "none",
"tax_ids": {
"data": [],
"has_more": false,
"object": "list",
"total_count": 0,
"url": "/v1/customers/cus_NORMALIZED0001/tax_ids"
},
"tax_info": null,
"tax_info_verification": null
}

View File

@@ -0,0 +1,79 @@
{
"account_balance": 0,
"address": null,
"balance": 0,
"created": 1000000000,
"currency": "usd",
"default_source": "card_NORMALIZED00000000000003",
"delinquent": true,
"description": "zulip (Zulip Dev)",
"discount": null,
"email": "hamlet@zulip.com",
"id": "cus_NORMALIZED0001",
"invoice_prefix": "NORMA01",
"invoice_settings": {
"custom_fields": null,
"default_payment_method": null,
"footer": null
},
"livemode": false,
"metadata": {
"realm_id": "1",
"realm_str": "zulip"
},
"name": null,
"object": "customer",
"phone": null,
"preferred_locales": [],
"shipping": null,
"sources": {
"data": [
{
"address_city": "Pacific",
"address_country": "United States",
"address_line1": "Under the sea,",
"address_line1_check": "pass",
"address_line2": null,
"address_state": null,
"address_zip": "33333",
"address_zip_check": "pass",
"brand": "MasterCard",
"country": "US",
"customer": "cus_NORMALIZED0001",
"cvc_check": "pass",
"dynamic_last4": null,
"exp_month": 3,
"exp_year": 2033,
"fingerprint": "NORMALIZED000003",
"funding": "credit",
"id": "card_NORMALIZED00000000000003",
"last4": "4444",
"metadata": {},
"name": "Ada Starr",
"object": "card",
"tokenization_method": null
}
],
"has_more": false,
"object": "list",
"total_count": 1,
"url": "/v1/customers/cus_NORMALIZED0001/sources"
},
"subscriptions": {
"data": [],
"has_more": false,
"object": "list",
"total_count": 0,
"url": "/v1/customers/cus_NORMALIZED0001/subscriptions"
},
"tax_exempt": "none",
"tax_ids": {
"data": [],
"has_more": false,
"object": "list",
"total_count": 0,
"url": "/v1/customers/cus_NORMALIZED0001/tax_ids"
},
"tax_info": null,
"tax_info_verification": null
}

View File

@@ -1,24 +1,35 @@
{
"account_country": "US",
"account_name": "Dev account",
"amount_due": 0,
"amount_paid": 0,
"amount_remaining": 0,
"application_fee": null,
"application_fee_amount": null,
"attempt_count": 0,
"attempted": false,
"auto_advance": true,
"billing": "charge_automatically",
"billing_reason": "manual",
"charge": null,
"collection_method": "charge_automatically",
"created": 1000000000,
"currency": "usd",
"custom_fields": null,
"customer": "cus_NORMALIZED0001",
"date": 1000000000,
"customer_address": null,
"customer_email": "hamlet@zulip.com",
"customer_name": null,
"customer_phone": null,
"customer_shipping": null,
"customer_tax_exempt": "none",
"customer_tax_ids": [],
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
"description": "",
"discount": null,
"due_date": null,
"ending_balance": null,
"finalized_at": null,
"footer": null,
"hosted_invoice_url": null,
"id": "in_NORMALIZED00000000000001",
@@ -43,6 +54,8 @@
"proration": false,
"quantity": 6,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
},
{
@@ -63,6 +76,8 @@
"proration": false,
"quantity": 1,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
}
],
@@ -77,16 +92,26 @@
"number": "NORMALI-0001",
"object": "invoice",
"paid": false,
"payment_intent": null,
"period_end": 1000000000,
"period_start": 1000000000,
"post_payment_credit_notes_amount": 0,
"pre_payment_credit_notes_amount": 0,
"receipt_number": null,
"starting_balance": 0,
"statement_descriptor": "Zulip Standard",
"status": "draft",
"status_transitions": {
"finalized_at": null,
"marked_uncollectible_at": null,
"paid_at": null,
"voided_at": null
},
"subscription": null,
"subtotal": 0,
"tax": 0,
"tax": null,
"tax_percent": null,
"total": 0,
"total_tax_amounts": [],
"webhooks_delivered_at": null
}

View File

@@ -0,0 +1,95 @@
{
"account_country": "US",
"account_name": "Dev account",
"amount_due": 5000,
"amount_paid": 0,
"amount_remaining": 5000,
"application_fee_amount": null,
"attempt_count": 0,
"attempted": false,
"auto_advance": false,
"billing": "charge_automatically",
"billing_reason": "manual",
"charge": null,
"collection_method": "charge_automatically",
"created": 1000000000,
"currency": "usd",
"custom_fields": null,
"customer": "cus_NORMALIZED0001",
"customer_address": null,
"customer_email": "hamlet@zulip.com",
"customer_name": null,
"customer_phone": null,
"customer_shipping": null,
"customer_tax_exempt": "none",
"customer_tax_ids": [],
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
"description": "",
"discount": null,
"due_date": null,
"ending_balance": null,
"footer": null,
"hosted_invoice_url": null,
"id": "in_NORMALIZED00000000000002",
"invoice_pdf": null,
"lines": {
"data": [
{
"amount": 5000,
"currency": "usd",
"description": null,
"discountable": true,
"id": "ii_NORMALIZED00000000000003",
"invoice_item": "ii_NORMALIZED00000000000003",
"livemode": false,
"metadata": {},
"object": "line_item",
"period": {
"end": 1000000000,
"start": 1000000000
},
"plan": null,
"proration": false,
"quantity": 1,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
}
],
"has_more": false,
"object": "list",
"total_count": 1,
"url": "/v1/invoices/in_NORMALIZED00000000000002/lines"
},
"livemode": false,
"metadata": {},
"next_payment_attempt": null,
"number": "NORMALI-0002",
"object": "invoice",
"paid": false,
"payment_intent": null,
"period_end": 1000000000,
"period_start": 1000000000,
"post_payment_credit_notes_amount": 0,
"pre_payment_credit_notes_amount": 0,
"receipt_number": null,
"starting_balance": 0,
"statement_descriptor": null,
"status": "draft",
"status_transitions": {
"finalized_at": null,
"marked_uncollectible_at": null,
"paid_at": null,
"voided_at": null
},
"subscription": null,
"subtotal": 5000,
"tax": null,
"tax_percent": null,
"total": 5000,
"total_tax_amounts": [],
"webhooks_delivered_at": null
}

View File

@@ -1,24 +1,35 @@
{
"account_country": "US",
"account_name": "Dev account",
"amount_due": 0,
"amount_paid": 0,
"amount_remaining": 0,
"application_fee": null,
"application_fee_amount": null,
"attempt_count": 0,
"attempted": true,
"auto_advance": false,
"billing": "charge_automatically",
"billing_reason": "manual",
"charge": null,
"collection_method": "charge_automatically",
"created": 1000000000,
"currency": "usd",
"custom_fields": null,
"customer": "cus_NORMALIZED0001",
"date": 1000000000,
"customer_address": null,
"customer_email": "hamlet@zulip.com",
"customer_name": null,
"customer_phone": null,
"customer_shipping": null,
"customer_tax_exempt": "none",
"customer_tax_ids": [],
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
"description": "",
"discount": null,
"due_date": 1000000000,
"ending_balance": 0,
"finalized_at": 1000000000,
"footer": null,
"hosted_invoice_url": "https://pay.stripe.com/invoice/invst_NORMALIZED0000000000000001",
"id": "in_NORMALIZED00000000000001",
@@ -43,6 +54,8 @@
"proration": false,
"quantity": 6,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
},
{
@@ -63,6 +76,8 @@
"proration": false,
"quantity": 1,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
}
],
@@ -77,16 +92,26 @@
"number": "NORMALI-0001",
"object": "invoice",
"paid": true,
"payment_intent": null,
"period_end": 1000000000,
"period_start": 1000000000,
"post_payment_credit_notes_amount": 0,
"pre_payment_credit_notes_amount": 0,
"receipt_number": null,
"starting_balance": 0,
"statement_descriptor": "Zulip Standard",
"status": "paid",
"status_transitions": {
"finalized_at": 1000000000,
"marked_uncollectible_at": null,
"paid_at": 1000000000,
"voided_at": null
},
"subscription": null,
"subtotal": 0,
"tax": 0,
"tax": null,
"tax_percent": null,
"total": 0,
"total_tax_amounts": [],
"webhooks_delivered_at": 1000000000
}

View File

@@ -0,0 +1,95 @@
{
"account_country": "US",
"account_name": "Dev account",
"amount_due": 5000,
"amount_paid": 0,
"amount_remaining": 5000,
"application_fee_amount": null,
"attempt_count": 0,
"attempted": false,
"auto_advance": false,
"billing": "charge_automatically",
"billing_reason": "manual",
"charge": null,
"collection_method": "charge_automatically",
"created": 1000000000,
"currency": "usd",
"custom_fields": null,
"customer": "cus_NORMALIZED0001",
"customer_address": null,
"customer_email": "hamlet@zulip.com",
"customer_name": null,
"customer_phone": null,
"customer_shipping": null,
"customer_tax_exempt": "none",
"customer_tax_ids": [],
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
"description": "",
"discount": null,
"due_date": 1000000000,
"ending_balance": 0,
"footer": null,
"hosted_invoice_url": "https://pay.stripe.com/invoice/invst_NORMALIZED0000000000000002",
"id": "in_NORMALIZED00000000000002",
"invoice_pdf": "https://pay.stripe.com/invoice/invst_NORMALIZED0000000000000002/pdf",
"lines": {
"data": [
{
"amount": 5000,
"currency": "usd",
"description": null,
"discountable": true,
"id": "ii_NORMALIZED00000000000003",
"invoice_item": "ii_NORMALIZED00000000000003",
"livemode": false,
"metadata": {},
"object": "line_item",
"period": {
"end": 1000000000,
"start": 1000000000
},
"plan": null,
"proration": false,
"quantity": 1,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
}
],
"has_more": false,
"object": "list",
"total_count": 1,
"url": "/v1/invoices/in_NORMALIZED00000000000002/lines"
},
"livemode": false,
"metadata": {},
"next_payment_attempt": null,
"number": "NORMALI-0002",
"object": "invoice",
"paid": false,
"payment_intent": "pi_1F96BhGh0CmXqmnwXdcsnxHY",
"period_end": 1000000000,
"period_start": 1000000000,
"post_payment_credit_notes_amount": 0,
"pre_payment_credit_notes_amount": 0,
"receipt_number": null,
"starting_balance": 0,
"statement_descriptor": null,
"status": "open",
"status_transitions": {
"finalized_at": 1000000000,
"marked_uncollectible_at": null,
"paid_at": null,
"voided_at": null
},
"subscription": null,
"subtotal": 5000,
"tax": null,
"tax_percent": null,
"total": 5000,
"total_tax_amounts": [],
"webhooks_delivered_at": 1000000000
}

View File

@@ -0,0 +1,102 @@
{
"data": [
{
"account_country": "US",
"account_name": "Dev account",
"amount_due": 5000,
"amount_paid": 0,
"amount_remaining": 5000,
"application_fee_amount": null,
"attempt_count": 0,
"attempted": false,
"auto_advance": false,
"billing": "charge_automatically",
"billing_reason": "manual",
"charge": null,
"collection_method": "charge_automatically",
"created": 1000000000,
"currency": "usd",
"custom_fields": null,
"customer": "cus_NORMALIZED0001",
"customer_address": null,
"customer_email": "hamlet@zulip.com",
"customer_name": null,
"customer_phone": null,
"customer_shipping": null,
"customer_tax_exempt": "none",
"customer_tax_ids": [],
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
"description": "",
"discount": null,
"due_date": 1000000000,
"ending_balance": 0,
"footer": null,
"hosted_invoice_url": "https://pay.stripe.com/invoice/invst_NORMALIZED0000000000000002",
"id": "in_NORMALIZED00000000000002",
"invoice_pdf": "https://pay.stripe.com/invoice/invst_NORMALIZED0000000000000002/pdf",
"lines": {
"data": [
{
"amount": 5000,
"currency": "usd",
"description": null,
"discountable": true,
"id": "ii_NORMALIZED00000000000003",
"invoice_item": "ii_NORMALIZED00000000000003",
"livemode": false,
"metadata": {},
"object": "line_item",
"period": {
"end": 1000000000,
"start": 1000000000
},
"plan": null,
"proration": false,
"quantity": 1,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
}
],
"has_more": false,
"object": "list",
"total_count": 1,
"url": "/v1/invoices/in_NORMALIZED00000000000002/lines"
},
"livemode": false,
"metadata": {},
"next_payment_attempt": null,
"number": "NORMALI-0002",
"object": "invoice",
"paid": false,
"payment_intent": "pi_1F96BhGh0CmXqmnwXdcsnxHY",
"period_end": 1000000000,
"period_start": 1000000000,
"post_payment_credit_notes_amount": 0,
"pre_payment_credit_notes_amount": 0,
"receipt_number": null,
"starting_balance": 0,
"statement_descriptor": null,
"status": "open",
"status_transitions": {
"finalized_at": 1000000000,
"marked_uncollectible_at": null,
"paid_at": null,
"voided_at": null
},
"subscription": null,
"subtotal": 5000,
"tax": null,
"tax_percent": null,
"total": 5000,
"total_tax_amounts": [],
"webhooks_delivered_at": 1000000000
}
],
"has_more": false,
"object": "list",
"url": "/v1/invoices"
}

View File

@@ -0,0 +1,102 @@
{
"data": [
{
"account_country": "US",
"account_name": "Dev account",
"amount_due": 5000,
"amount_paid": 0,
"amount_remaining": 5000,
"application_fee_amount": null,
"attempt_count": 1,
"attempted": true,
"auto_advance": false,
"billing": "charge_automatically",
"billing_reason": "manual",
"charge": "ch_NORMALIZED00000000000002",
"collection_method": "charge_automatically",
"created": 1000000000,
"currency": "usd",
"custom_fields": null,
"customer": "cus_NORMALIZED0001",
"customer_address": null,
"customer_email": "hamlet@zulip.com",
"customer_name": null,
"customer_phone": null,
"customer_shipping": null,
"customer_tax_exempt": "none",
"customer_tax_ids": [],
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
"description": "",
"discount": null,
"due_date": 1000000000,
"ending_balance": 0,
"footer": null,
"hosted_invoice_url": "https://pay.stripe.com/invoice/invst_NORMALIZED0000000000000002",
"id": "in_NORMALIZED00000000000002",
"invoice_pdf": "https://pay.stripe.com/invoice/invst_NORMALIZED0000000000000002/pdf",
"lines": {
"data": [
{
"amount": 5000,
"currency": "usd",
"description": null,
"discountable": true,
"id": "ii_NORMALIZED00000000000003",
"invoice_item": "ii_NORMALIZED00000000000003",
"livemode": false,
"metadata": {},
"object": "line_item",
"period": {
"end": 1000000000,
"start": 1000000000
},
"plan": null,
"proration": false,
"quantity": 1,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
}
],
"has_more": false,
"object": "list",
"total_count": 1,
"url": "/v1/invoices/in_NORMALIZED00000000000002/lines"
},
"livemode": false,
"metadata": {},
"next_payment_attempt": null,
"number": "NORMALI-0002",
"object": "invoice",
"paid": false,
"payment_intent": "pi_1F96BhGh0CmXqmnwXdcsnxHY",
"period_end": 1000000000,
"period_start": 1000000000,
"post_payment_credit_notes_amount": 0,
"pre_payment_credit_notes_amount": 0,
"receipt_number": null,
"starting_balance": 0,
"statement_descriptor": null,
"status": "open",
"status_transitions": {
"finalized_at": 1000000000,
"marked_uncollectible_at": null,
"paid_at": null,
"voided_at": null
},
"subscription": null,
"subtotal": 5000,
"tax": null,
"tax_percent": null,
"total": 5000,
"total_tax_amounts": [],
"webhooks_delivered_at": 1000000000
}
],
"has_more": false,
"object": "list",
"url": "/v1/invoices"
}

View File

@@ -0,0 +1,102 @@
{
"data": [
{
"account_country": "US",
"account_name": "Dev account",
"amount_due": 5000,
"amount_paid": 0,
"amount_remaining": 5000,
"application_fee_amount": null,
"attempt_count": 1,
"attempted": true,
"auto_advance": false,
"billing": "charge_automatically",
"billing_reason": "manual",
"charge": "ch_NORMALIZED00000000000002",
"collection_method": "charge_automatically",
"created": 1000000000,
"currency": "usd",
"custom_fields": null,
"customer": "cus_NORMALIZED0001",
"customer_address": null,
"customer_email": "hamlet@zulip.com",
"customer_name": null,
"customer_phone": null,
"customer_shipping": null,
"customer_tax_exempt": "none",
"customer_tax_ids": [],
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
"description": "",
"discount": null,
"due_date": 1000000000,
"ending_balance": 0,
"footer": null,
"hosted_invoice_url": "https://pay.stripe.com/invoice/invst_NORMALIZED0000000000000002",
"id": "in_NORMALIZED00000000000002",
"invoice_pdf": "https://pay.stripe.com/invoice/invst_NORMALIZED0000000000000002/pdf",
"lines": {
"data": [
{
"amount": 5000,
"currency": "usd",
"description": null,
"discountable": true,
"id": "ii_NORMALIZED00000000000003",
"invoice_item": "ii_NORMALIZED00000000000003",
"livemode": false,
"metadata": {},
"object": "line_item",
"period": {
"end": 1000000000,
"start": 1000000000
},
"plan": null,
"proration": false,
"quantity": 1,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
}
],
"has_more": false,
"object": "list",
"total_count": 1,
"url": "/v1/invoices/in_NORMALIZED00000000000002/lines"
},
"livemode": false,
"metadata": {},
"next_payment_attempt": null,
"number": "NORMALI-0002",
"object": "invoice",
"paid": false,
"payment_intent": "pi_1F96BhGh0CmXqmnwXdcsnxHY",
"period_end": 1000000000,
"period_start": 1000000000,
"post_payment_credit_notes_amount": 0,
"pre_payment_credit_notes_amount": 0,
"receipt_number": null,
"starting_balance": 0,
"statement_descriptor": null,
"status": "open",
"status_transitions": {
"finalized_at": 1000000000,
"marked_uncollectible_at": null,
"paid_at": null,
"voided_at": null
},
"subscription": null,
"subtotal": 5000,
"tax": null,
"tax_percent": null,
"total": 5000,
"total_tax_amounts": [],
"webhooks_delivered_at": 1000000000
}
],
"has_more": false,
"object": "list",
"url": "/v1/invoices"
}

View File

@@ -0,0 +1,219 @@
{
"data": [
{
"account_country": "US",
"account_name": "Dev account",
"amount_due": 5000,
"amount_paid": 5000,
"amount_remaining": 0,
"application_fee_amount": null,
"attempt_count": 1,
"attempted": true,
"auto_advance": false,
"billing": "charge_automatically",
"billing_reason": "manual",
"charge": "ch_NORMALIZED00000000000003",
"collection_method": "charge_automatically",
"created": 1000000000,
"currency": "usd",
"custom_fields": null,
"customer": "cus_NORMALIZED0001",
"customer_address": null,
"customer_email": "hamlet@zulip.com",
"customer_name": null,
"customer_phone": null,
"customer_shipping": null,
"customer_tax_exempt": "none",
"customer_tax_ids": [],
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
"description": "",
"discount": null,
"due_date": 1000000000,
"ending_balance": 0,
"footer": null,
"hosted_invoice_url": "https://pay.stripe.com/invoice/invst_NORMALIZED0000000000000002",
"id": "in_NORMALIZED00000000000002",
"invoice_pdf": "https://pay.stripe.com/invoice/invst_NORMALIZED0000000000000002/pdf",
"lines": {
"data": [
{
"amount": 5000,
"currency": "usd",
"description": null,
"discountable": true,
"id": "ii_NORMALIZED00000000000003",
"invoice_item": "ii_NORMALIZED00000000000003",
"livemode": false,
"metadata": {},
"object": "line_item",
"period": {
"end": 1000000000,
"start": 1000000000
},
"plan": null,
"proration": false,
"quantity": 1,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
}
],
"has_more": false,
"object": "list",
"total_count": 1,
"url": "/v1/invoices/in_NORMALIZED00000000000002/lines"
},
"livemode": false,
"metadata": {},
"next_payment_attempt": null,
"number": "NORMALI-0002",
"object": "invoice",
"paid": true,
"payment_intent": "pi_1F96BhGh0CmXqmnwXdcsnxHY",
"period_end": 1000000000,
"period_start": 1000000000,
"post_payment_credit_notes_amount": 0,
"pre_payment_credit_notes_amount": 0,
"receipt_number": null,
"starting_balance": 0,
"statement_descriptor": null,
"status": "paid",
"status_transitions": {
"finalized_at": 1000000000,
"marked_uncollectible_at": null,
"paid_at": 1000000000,
"voided_at": null
},
"subscription": null,
"subtotal": 5000,
"tax": null,
"tax_percent": null,
"total": 5000,
"total_tax_amounts": [],
"webhooks_delivered_at": 1000000000
},
{
"account_country": "US",
"account_name": "Dev account",
"amount_due": 0,
"amount_paid": 0,
"amount_remaining": 0,
"application_fee_amount": null,
"attempt_count": 0,
"attempted": true,
"auto_advance": false,
"billing": "charge_automatically",
"billing_reason": "manual",
"charge": null,
"collection_method": "charge_automatically",
"created": 1000000000,
"currency": "usd",
"custom_fields": null,
"customer": "cus_NORMALIZED0001",
"customer_address": null,
"customer_email": "hamlet@zulip.com",
"customer_name": null,
"customer_phone": null,
"customer_shipping": null,
"customer_tax_exempt": "none",
"customer_tax_ids": [],
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [],
"description": "",
"discount": null,
"due_date": 1000000000,
"ending_balance": 0,
"footer": null,
"hosted_invoice_url": "https://pay.stripe.com/invoice/invst_NORMALIZED0000000000000001",
"id": "in_NORMALIZED00000000000001",
"invoice_pdf": "https://pay.stripe.com/invoice/invst_NORMALIZED0000000000000001/pdf",
"lines": {
"data": [
{
"amount": 48000,
"currency": "usd",
"description": "Zulip Standard",
"discountable": false,
"id": "ii_NORMALIZED00000000000001",
"invoice_item": "ii_NORMALIZED00000000000001",
"livemode": false,
"metadata": {},
"object": "line_item",
"period": {
"end": 1000000000,
"start": 1000000000
},
"plan": null,
"proration": false,
"quantity": 6,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
},
{
"amount": -48000,
"currency": "usd",
"description": "Payment (Card ending in 4242)",
"discountable": false,
"id": "ii_NORMALIZED00000000000002",
"invoice_item": "ii_NORMALIZED00000000000002",
"livemode": false,
"metadata": {},
"object": "line_item",
"period": {
"end": 1000000000,
"start": 1000000000
},
"plan": null,
"proration": false,
"quantity": 1,
"subscription": null,
"tax_amounts": [],
"tax_rates": [],
"type": "invoiceitem"
}
],
"has_more": false,
"object": "list",
"total_count": 2,
"url": "/v1/invoices/in_NORMALIZED00000000000001/lines"
},
"livemode": false,
"metadata": {},
"next_payment_attempt": null,
"number": "NORMALI-0001",
"object": "invoice",
"paid": true,
"payment_intent": null,
"period_end": 1000000000,
"period_start": 1000000000,
"post_payment_credit_notes_amount": 0,
"pre_payment_credit_notes_amount": 0,
"receipt_number": null,
"starting_balance": 0,
"statement_descriptor": "Zulip Standard",
"status": "paid",
"status_transitions": {
"finalized_at": 1000000000,
"marked_uncollectible_at": null,
"paid_at": 1000000000,
"voided_at": null
},
"subscription": null,
"subtotal": 0,
"tax": null,
"tax_percent": null,
"total": 0,
"total_tax_amounts": [],
"webhooks_delivered_at": 1000000000
}
],
"has_more": false,
"object": "list",
"url": "/v1/invoices"
}

Some files were not shown because too many files have changed in this diff Show More