Commit Graph

50084 Commits

Author SHA1 Message Date
Alex Vandiver 93e78ea72f spectators: Save a redirect to /register/. 2023-02-20 12:21:33 -08:00
Anders Kaseorg 64f0dcecb0 install-node: Upgrade Node.js to 18.14.1 security release.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-02-20 12:16:28 -08:00
Anders Kaseorg 99f1d08786 styles: Hoist @keyframes to top level.
This has always been in the global namespace.  Pretending that it’s
scoped when it isn’t and giving it a short name will lead to
confusion.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-02-20 12:10:18 -08:00
Anders Kaseorg f99cff0735 styles: Fix flatpickr dark theme in automatic mode.
Flatpickr had been unconditionally using the light theme in automatic
color scheme mode; this fixes it to follow the system preference like
the rest of the app.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-02-20 12:09:52 -08:00
Alex Vandiver d3403dde86 rabbitmq: Add a RABBITMQ_PORT setting. 2023-02-20 12:04:25 -08:00
Lauryn Menard 0463b0df7b api-docs: Update content parameter for `max_message_length`.
Updates the descriptions of content parameters (optional and
required) to note that the maximum size of the message content
should be based on the `max_message_length` value returned by
the register endpoint.

Previously these descriptions had a hardcoded value of 10000
bytes as the maximum message size.

Also, updates the description of `max_message_length` to clarify
that the value represents Unicode code points.
2023-02-20 12:03:12 -08:00
Lauryn Menard b25cba16a7 tests: Remove ignored parameter from `authenticated_json_view` test.
The password parameter being passed in the `_do_test` helper
function for `TestAuthenticatedJsonPostViewDecorator` tests was
being ignored, as the user needs to be logged in. Removes the
parameter from the helper function and updates the success test
to use `assert_json_success` instead of just checking the status
code.

Also adds a test case for when a user is not logged in to confirm
that it returns an UnauthorizedError.
2023-02-20 11:56:00 -08:00
Alex Vandiver 8998aa00cd Revert "create_user: Use transaction.atomic decorator for do_create_user."
This reverts commit 851d68e0fc.

That commit widened how long the transaction is open, which made it
much more likely that after the user was created in the transaction,
and the memcached caches were flushed, some other request will fill
the `get_realm_user_dicts` cache with data which did not include the
new user (because it had not been committed yet).

If a user creation request lost this race, the user would, upon first
request to `/`, get a blank page and a Javascript error:

    Unknown user_id in get_by_user_id: 12345

...where 12345 was their own user-id.  This error would persist until
the cache expired (in 7 days) or something else expunged it.

Reverting this does not prevent the race, as the post_save hook's call
to flush_user_profile is still in a transaction (and has been since
168f241ff0), and thus leaves the potential race window open.
However, it much shortens the potential window of opportunity, and is
a reasonable short-term stopgap.
2023-02-17 21:20:52 -05:00
Alex Vandiver 7feda75c5f populate_db: Temporarily remove post-delete signal on AlertWord.
The post-delete signal on AlertWord clears the realm cache; when it is
called repeatedly, this results in re-fetching the realm object O(n)
times, where n scales by number of users in the database.

Disconnect this cache-clearing signal before removing the AlertWord
entries, and reconnect it afterwards.  This is not thread-safe, but
this section is single-threaded.  It is also probably unnecessary to
re-connect the signal, as rest of `./manage.py populate_db` does not
delete AlertWord objects, but cleanliness dictates doing the
re-connection.

This drops the time to repeatedly run:
    python3 ./manage.py populate_db --num-messages=0 --extra-users=1000

...from 47 seconds to 36 seconds.
2023-02-17 13:59:11 -08:00
Anders Kaseorg 7cafbefdef ci: Reduce production suite tarball retention from 14 days to 1.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-02-16 10:15:11 -05:00
Anders Kaseorg bf7d3124ab openapi: Correct “we-public” typo.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-02-15 15:21:54 -08:00
Alex Vandiver 0d42abe1a8 puppet: wal-g is a tarball with a single file, not a directory.
5db55c38dc switched from `ensure => present` to the more specific
`ensure => directory` on the premise that tarballs would result in
more than one file being copied out of them.  However, we only extract
a single file from the wal-g tarball, and install it at the output
path.  The new rule attempts to replace it with an empty directory
after extraction.

Switch back to `ensure => present` for the tarball codepath.
2023-02-14 18:18:36 -05:00
Alex Vandiver f8a16fb9af model: Handle parsed user-agents longer than 30 characters.
The Client.name field is only 30 characters long, but there is no
limit to the length of parsed User-Agent value which we may attempt to
store in it.  This can cause requests with long user-agents to 500
when the creation of the Client row fails.

Truncate the name at 30 characters for the cache key, and passing
`name` to `get_or_create`.
2023-02-14 14:58:15 -08:00
Alex Vandiver 6f8ce2d00a hooks: Fix shebang line to use /usr/bin/env bash. 2023-02-14 17:28:58 -05:00
Alex Vandiver 044ccdb334 chat.zulip.org: Enable Sentry hook. 2023-02-14 17:20:35 -05:00
Alex Vandiver 63de600451 backends: Use staticfilesfor social auth logos. 2023-02-14 17:17:06 -05:00
Alex Vandiver 3559bf416d settings: Allow customization of STATIC_URL.
Some requests will still be to `/static/`, either at the realm's
domain, or at the root domain.
2023-02-14 17:17:06 -05:00
Alex Vandiver dd21e472e7 subdomains: Extend tests for for same-host when STATIC_URL has domain. 2023-02-14 17:17:06 -05:00
Alex Vandiver a1967a7f2d markdown: Rewrite /static/ images to use staticfiles_storage.url. 2023-02-14 17:17:06 -05:00
Alex Vandiver ccecc8eb84 markdown: Comment why we do not hash or use STATIC_URL for :zulip:. 2023-02-14 17:17:06 -05:00
Alex Vandiver 6806bec2e9 email_notifications: Use stable, unhashed, URLs for emoji in emails. 2023-02-14 17:17:06 -05:00
Alex Vandiver 72ac38eff8 send_email: Use STATIC_URL as base for images in emails. 2023-02-14 17:17:06 -05:00
Alex Vandiver e31767dda4 settings: Make DEFAULT_LOGO_URI/DEFAULT_AVATAR_URI use staticfiles. 2023-02-14 17:17:06 -05:00
Alex Vandiver 5d0d0ba4a9 static: Replace handlebars static images with their require'd versions. 2023-02-14 17:17:06 -05:00
Alex Vandiver e0a7658db7 ts: Pull in static assets via import. 2023-02-14 17:17:06 -05:00
Alex Vandiver ea2a0a7632 js: Pull in static assets via import. 2023-02-14 17:17:06 -05:00
Alex Vandiver 1f47d7793d landing-page: Stop relying on image paths. 2023-02-14 17:17:06 -05:00
Alex Vandiver c24bd07b76 templates: Use static() helper to generate /static/ URLs. 2023-02-14 17:17:06 -05:00
Alex Vandiver 10b1e11410 styles: Remove unnecessary ../static/ in image path. 2023-02-14 17:17:06 -05:00
Alex Vandiver ede0ae9069 unminify: Do not assume /static/ exists in the stacktrace. 2023-02-14 17:17:06 -05:00
Alex Vandiver ab9f974f48 emoji_settings: Stop using the avatar as placeholder; it is never seen.
The design of this element was changed midway through #22504, and
despite a separate placeholder icon using used, the preview was still
reset to the default avatar -- but is always hidden when so set.
2023-02-14 17:17:06 -05:00
Alex Vandiver 25b97c2872 storage: Skip hashing markdown files. 2023-02-14 17:17:06 -05:00
Alex Vandiver d9af7f25e8 storage: Fix extension logic to not hash other resource files. 2023-02-14 17:17:06 -05:00
Anders Kaseorg e0e17d2391 docs: Update frontend_tests/puppeteer_lib/common.ts path.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-02-14 13:39:41 -08:00
Anders Kaseorg 4cd847ac44 styles: Fix horizontal SimpleBar height for SimpleBar 6.
030b89b94e

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-02-13 15:45:12 -08:00
Abhijeet Prasad Bodas 9bc49ea4be message_send: Extract out stream notification user-set calculation logic.
This will allow us to re-use this logic later, when we add support for
re-checking notification settings just before sending email/push
notifications to the user.

Also, since this is essentially part of the notifiability logic,
this better belongs to `notification_data.py` and this change will
hopefully reduce the reading complexity of the message-send codepath.
2023-02-10 22:47:30 -08:00
Abhijeet Prasad Bodas 167ea63c1f message_send: Add comment on wildcard_mention_user_ids optimization.
The earlier commit explained the code, and not why we have this
optimization in the first place.
2023-02-10 22:47:30 -08:00
David Rosa 2b9b0acaa4 help: Update URL references to new "Configure email visibility" page. 2023-02-10 18:15:56 -08:00
Alya Abbott 9ea3572017 help: Document new user setting for configuring email visibility.
- Adds a URL redirect from the old page to the new page.
2023-02-10 18:15:56 -08:00
Sahil Batra 9d1dc20e6e settings: Remove realm-level email_address_visibility setting.
This was replaced by the new user-level version in recent commits.

Fixes #20035.
Fixes #18149.
2023-02-10 17:40:33 -08:00
Sahil Batra 1b110552ec settings: Migrate to use user-level email_address_visibility setting. 2023-02-10 17:35:50 -08:00
Sahil Batra f4065b587b settings: Add dropdown for email_address_visibility setting.
This commit adds dropdown for user-level and realm-level
default of email address visibility setting.
2023-02-10 17:35:50 -08:00
Sahil Batra b84885184e settings: Use user-level email_address_visibility setting in UI.
This commit basically updates the frontend code to directly use
delivery_email field instead of functions like show_email or
email_for_user_settings at places where we want to show email.
We can do this change since we recently updated the server code
to always pass "delivery_email" code in the user objects with its
value being null if the real email is not accessible.

Showing email or "hidden" or nothing at various places in UI like
in users list, subscriber list, user profile popover and modal is
same as before.

Major points -

- Removed show_email and email_for_user_settings functions since we
directly use delivery_email field now as explained above.

- While sorting by emails in the users list, users with real emails
hidden are always shown in last when sorting alphabetically and at
the top when sorting reverse alphabetically. Also, those users with
real emails hidden, are sorted by name among themselves. As we did
before, we do not allow sorting by email when all emails are hidden.

- There is no change in typeahead behavior at this point. We either
hide the email completely or show the real or fake email based on
user level setting.

- Added code to handle delivery_email events and appropriately add/remove
delivery_email field from person objects.
2023-02-10 17:35:50 -08:00
Sahil Batra 0ed5f76063 settings: Add backend code for using user email_address_visibility setting.
This commits update the code to use user-level email_address_visibility
setting instead of realm-level to set or update the value of UserProfile.email
field and to send the emails to clients.

Major changes are -

- UserProfile.email field is set while creating the user according to
RealmUserDefault.email_address_visbility.

- UserProfile.email field is updated according to change in the setting.

- 'email_address_visibility' is added to person objects in user add event
and in avatar change event.

- client_gravatar can be different for different users when computing
avatar_url for messages and user objects since email available to clients
is dependent on user-level setting.

- For bots, email_address_visibility is set to EVERYONE while creating
them irrespective of realm-default value.

- Test changes are basically setting user-level setting instead of realm
setting and modifying the checks accordingly.
2023-02-10 17:35:49 -08:00
Sahil Batra ea0b2286e0 settings: Add email_address_visbility user setting. 2023-02-10 17:35:49 -08:00
Sahil Batra 2396e6858f users: Always pass "delivery_email" field in user objects.
Previously, user objects contained delivery_email field
only when user had access to real email. Also, delivery_email
was not present if visibility setting is set to "everyone"
as email field was itself set to real email.

This commit changes the code to pass "delivery_email" field
always in the user objects with its value being "None" if
user does not have access to real email and real email otherwise.
The "delivery_email" field value is None for logged-out users.
For bots, the "delivery_email" is always set to real email
irrespective of email_address_visibility setting.

Also, since user has access to real email if visibility is set
to "everyone", "delivery_email" field is passed in that case
too.

There is no change in email field and it is same as before.

This commit also adds code to send event to update delivery_email
field when email_address_visibility setting changes to all the
users whose access to emails changes and also changes the code to
send event on changing delivery_email to users who have access
to email.
2023-02-10 17:35:49 -08:00
Ujjawal Modi a2bcf3a77c css: Use span rather than div for status_emoji elements.
These being possibly `display: block` in some settings resulted in
them taking up visible space oddly if the asset failed to load.

tabbott could not reproduce the original bug, perhaps because changes
in the emoji CSS do `display: inline-block` on div.emoji, but the
logical intent for this component suggests it should be a span in any
case.

Fixes #23516.
2023-02-10 17:29:24 -08:00
Tim Abbott 29c6b4b9f2 recent topics: Fix exception displaying PMs with 5+ senders.
The previous logic incorrectly tried to map elements of the list of
user IDs beyond 4 senders to their `.id` fields, which were undefined;
the correct thing to do is just use the list of user IDs that we
already have.
2023-02-10 17:16:20 -08:00
Aman Agrawal 39255a5ed0 portico_signin: Fix content wrapping too much.
Due to `max-width: min-content` being used and `min-width: max-content`
not being applied since it is not present outside of development
environment, the text wrapped after every word.

The intention of this CSS was to restrict the max-width of the
`white-box` and I think 800px is a good max-width after which
content should wrap.
2023-02-10 15:58:04 -08:00
David Rosa 8c047275a4 help: Update URLs to match "Restrict moving messages" title.
Updates all references to the new URL and adds a URL redirect.

Follow up to #24329.
2023-02-10 15:56:16 -08:00