Commit Graph

60377 Commits

Author SHA1 Message Date
Lauryn Menard 44e73eecc1 support: Add basic information about realm.
Adds non-form section to Zulip Cloud support view with some basic
realm information: organization type, plan type, non-guest user
count and guest user count.

Uses a shared template for the basic realm data and adds a shared
support context dict for variables that are used in both remote
and Zulip Cloud support views.
2024-08-26 20:52:38 -07:00
Lauryn Menard 349954e4fc support: Add database query test of single realm and remote realm views.
Gives a baseline of current database queries for these single realm
or remote realm support views, so that as we add features to these
views, we can better manage how those changes impact the performance
of our support views in general.
2024-08-26 20:52:38 -07:00
Anders Kaseorg ed63a40184 install-transifex-cli: Upgrade Transifex CLI from 1.6.14 to 1.6.16.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-08-26 14:17:05 -07:00
Anders Kaseorg b0170fc306 install-shfmt: Upgrade shfmt from 3.8.0 to 3.9.0.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-08-26 14:17:05 -07:00
Anders Kaseorg 2f8734aee0 install-node: Upgrade Node.js from 20.15.1 to 20.17.0.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-08-26 14:17:05 -07:00
Kenneth Rodrigues 00a54099a2 analytics: Migrate to @typed_endpoint. 2024-08-26 08:57:49 -07:00
Aman Agrawal 3ea3f48338 test_stripe: Normalize fixtures for upgrade_by_card_to_plus_plan. 2024-08-26 08:37:27 -07:00
Lauryn Menard 7af87c7e14 realm-settings: Get max invites for realm plan type helper.
There are a few places where we want to set the max invites for a
realm to the default for a realm's plan type, so this creates a
helper function that can be used consistently to get that default
value.
2024-08-26 08:29:50 -07:00
evykassirer 3dd0ef6bf9 message_list_view: Calculate date divider variables before assignment.
This is part of a bigger refactor to calculate message container
attributes just from the message, so that we can create the message
container all at once instead of piecewise, to be able to convert
to typescript.
2024-08-26 08:14:57 -07:00
evykassirer fa4d5bec2c message_list_view: Use clearer variable name for clear_message_date_divider. 2024-08-26 08:14:57 -07:00
evykassirer 3266eda3e9 message_list_view: Calculate group display date with a pure function.
Where "pure function" means that the group's value isn't changed
in this function.

This commit also modifies the function to just take a message.

This is part of a bigger refactor to calculate message list group
attributes and creating the group all at once instead of piecewise.
This is necessary to convert this module to typescript, since a
partially formed group is hard to type.
2024-08-26 08:14:57 -07:00
evykassirer b8bda635b7 message_list_view: Only pass message to same_day.
This is part of a bigger refactor to calculate message container
attributes just from the message, so that we can create the message
container all at once instead of piecewise, to be able to convert
to typescript.
2024-08-26 08:14:57 -07:00
evykassirer e815fbb499 message_list_view: Only pass message to get_timestr.
This is part of a bigger refactor to calculate message container
attributes just from the message, so that we can create the message
container all at once instead of piecewise, to be able to convert
to typescript.
2024-08-26 08:14:57 -07:00
evykassirer 79f8d2ed79 message_list_view: Calculate _get_msg_timestring with only message.
This is part of a bigger refactor to calculate message container
attributes just from the message, so that we can create the message
container all at once instead of piecewise, to be able to convert
to typescript.
2024-08-26 08:14:57 -07:00
evykassirer 017bca56e4 message_list_view: Refactor me message calculation for typescript.
We're going to need to be able to build the message list view
in pieces and put it all together in the end, instead of assigning
values directly to a half-formed object (which is hard to type).

This is part of the work towards that.
2024-08-26 08:14:57 -07:00
evykassirer 1a204ff554 message_list_view: Use util.the for converting JQuery to HTMLElement. 2024-08-26 08:14:57 -07:00
evykassirer 2f77463864 util: Fix same_sender type signature to allow undefined messages. 2024-08-26 08:14:57 -07:00
evykassirer fc0367ff0d message_container: Remove two unused class variables. 2024-08-26 08:14:57 -07:00
evykassirer 44522a6244 message_list_view: Standardize type of dom_updates.html_updates.
When we convert this module to typescript, the type of `rendered_date`
will need to be a valid input to `$element.html`. Elsewhere in this
file, the date is a string. Here it's a JQuery object, which isn't
a valid input, but HTMLElement is, so this commit converts it to that.

I tested this manually and it still renders correctly.
2024-08-26 08:14:57 -07:00
evykassirer 1a47a2ccaa message_list_view: Remove unused parameter to _rerender_header.
This param was added in 7d8d9c1bf9 but
never added to _rerender_header itself.
2024-08-26 08:14:57 -07:00
evykassirer 6c063f4974 message_list_view: Remove unused return statement. 2024-08-26 08:14:57 -07:00
Anders Kaseorg 892f988404 dependencies: Upgrade JavaScript dependencies.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-08-26 07:44:14 -07:00
Anders Kaseorg 8196c4f63d eslint: Fix @typescript-eslint/prefer-regexp-exec.
https://typescript-eslint.io/rules/prefer-regexp-exec/

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-08-26 07:44:14 -07:00
Anders Kaseorg e6344bd1f5 debug-require-webpack-plugin: Add null check for TypeScript.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-08-26 07:44:14 -07:00
Alex Vandiver eef65d7e30 uwsgi: Force Django load before returning the uwsgi worker function.
Django lazy-loads much of its modules, including the application's.
This defers the time to during the first request it serves.  When
doing rolling-restarts, this means that the worker is marked "ready"
despite having multiple seconds more work to do.  With small numbers
of workers, this causes a significant capacity drop, since effectively
more than one worker can be still reloading at a time.  It also
results in poor user experience for the requests which are unlucky
enough to be served first.

Use the technique detailed in the uwsgi documentation[^1] to fake a
request during initial application load, which forces the application
to be loaded.

[^1]: https://uwsgi-docs.readthedocs.io/en/latest/articles/TheArtOfGracefulReloading.html#dealing-with-ultra-lazy-apps-like-django
2024-08-25 15:43:50 -07:00
Anders Kaseorg 8589becc48 requirements: Upgrade Python requirements.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-08-24 19:44:39 -07:00
Anders Kaseorg d67831ba4b run-dev: Remove unnecessary compress=False for aiohttp.
This seems to have been unnecessary since aiohttp 2, and now causes a
type error.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-08-24 19:44:38 -07:00
Anders Kaseorg 8c0b2d14aa mypy: Remove use of ValuesQuerySet and QuerySetAny.
This was made unnecessary in django-stubs 5.0.1 and mypy 1.10.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-08-24 17:30:41 -07:00
Tim Abbott f4d98b03d5 migrations: Squash zerver migrations.
This has the impact of making rebuilding the database in a Zulip
development environment, or initializing a new production database,
dramatically faster.

This was generated by merging the output of `manage.py makemigrations`
with an empty migration.

Tested using `tools/rebuild-test-database` before and after this
change, and comparing the output of `pg_dump -d zulip_test` using
Git's diff comparison algorithm. Differences in that SQL dump include:

- The actual generated table contents, due to timestamps and the like;
  this is expected and unrelated to schema.

- Orders of fields within tables, which is not significant in SQL.

- IDs assigned to tables in the ContentType table, which is expected
  and not a problem with how that Django table is designed.

- Names of generated indexes and constraints; modern Django seems to
  abbreviate long names differently for these, and it's not obviously
  possible to configure those used by the `db_index` property. If
  necessarily, likely this can be converged via a migration filled
  with `IF EXISTS` rename operations like the one done in
  zerver/migrations/0246_message_date_sent_finalize_part2.py.

- Names of the ~3 sequences related to renamed tables:
  usertopic/mutedtopic, botconfigdata/botuserconfigdata,
  realmdomain/realmalias. Probably there's no action required here,
  but we could do rename operations if desired.
2024-08-23 17:15:35 -07:00
Tim Abbott 029ceb2a48 migrations: Optimize initial zerver migration.
Generated using manage.py squashmigrations, with minimal manual
surgery to replace the original migration.

This should in theory produce the exact same database state as
previously.
2024-08-23 17:15:35 -07:00
Tim Abbott 7080c94245 migrations: Reorder initial zerver migration.
This has no functional changes, but it helps the squashmigrations tool
realize some squashing opportunities to not have models declared
before other models that they will gain a foreign key to.
2024-08-23 17:15:35 -07:00
Tim Abbott 525c3d4321 migrations: Squash corporate migrations.
Generated using manage.py squashmigrations, with some work:

- Used my patch to support squashing AddConstraint/RemoveConstraint
  operations.

- Manually removed the add/deletion of cloud_xor_self_hosted, since it
  didn't squash properly.

- Temporarily removed a couple operations from their migration files,
  and added them back manually both to the original file and the
  squash file, to allow later operations to squash
  properly. Specifically, these are the two unsquashed operations
  documented with comments at the end of the squash migration file.
2024-08-23 17:15:35 -07:00
Tim Abbott 54ea20cc5b migrations: Squash analytics migrations.
Created using manage.py squashmigrations, with my patch to the Django
migration optimizer to correctly collapse
AddConstraints/RemoveConstraints operations.
2024-08-23 17:15:35 -07:00
Tim Abbott a56e5079fd migrations: Squash zilencer migrations.
Created using manage.py squashmigrations with a couple changes:
- Patched Django to optimize AddConstraints/RemoveConstraints properly.
- Used the StateOperations from the
  migrations.SeparateDatabaseAndState section in migration 0060, so
  that the constraint changes could be optimized properly.
- Removed dependencies on zerver, since this project does not actually
  have any dependencies on zerver migrations.
2024-08-23 17:15:35 -07:00
Tim Abbott eaa02a10a4 migrations: Squash most confirmation migrations.
Generated using the squashmigrations tool, with:

- A tiny Django patch to avoid special handling of the temporary
  EmailChangeStatus proxy model.
- Switching AddIndexConcurrently to AddIndex to help squashing. This
  may not have been necessary.

Migration 0015 was not squashed because of its dependency on newer
zerver migrations.
2024-08-23 17:15:35 -07:00
Tim Abbott 6cdf938602 migrations: Tweak realm foreign key dependency.
As best I can tell, this dependency is important only to ensure that
we have a Realm table to link to.
2024-08-23 17:15:35 -07:00
Tim Abbott d71742b7fe confirmation: Move zerver dependency to correct migration.
It's the foreign key relationship that needs to be synchronized with
the BigInt state of the releavnt zerver tables.
2024-08-23 17:15:35 -07:00
Tim Abbott afecb2eca6 migrations: Add missing elidable tags on RunPython/RunSQL steps.
This helps the squashmigrations tool know that it can squash these.
2024-08-23 17:15:35 -07:00
Tim Abbott 5188cf3d8e migrations: Remove RunPython block from initial migration.
Since it's the initial migration, this can't have any useful effect.

I'm pretty sure the backstory is we did a manual squash of migrations
during the process of open-sourcing Zulip, and incorrectly didn't
remove this code.
2024-08-23 17:15:35 -07:00
Tim Abbott 547377a295 zerver: Remove now-unnecessary dependency in migration 0383.
It's not possible to directly upgrade from pre-5.3 versions to main,
since they do not have any supported OSes in common. Thus, this
dependency on the confirmation model, which risks creating a circular
dependency if we squash migrations, can be removed.
2024-08-23 17:15:35 -07:00
Alex Vandiver 73e5364838 import: Use inspection to determine sequence names. 2024-08-23 17:15:35 -07:00
Tim Abbott 31623911d1 test_message_fetch: Avoid assumptions about fixture data set. 2024-08-23 17:15:35 -07:00
Lauryn Menard d708c3c039 support: Add ability to update max daily invitations for realm.
Adds some validation for changing the realm's max invites via the
support view so that it is not set below the default max for the
realm's plan type, and so that if it's currently set to the default
max it's not reset to that same value.
2024-08-23 16:08:30 -07:00
opmkumar 8911347cdb hotkey: Add keyboard shortcut to navigate to starred messages view.
This commit adds '*' as a keyboard shortcut to navigate to the starred messages view and the shortcut is documented in various required locations accordingly.
Fixes #31397.
2024-08-23 15:49:31 -07:00
Aman Agrawal 5f6045c878 typeahead: Change icon for wildcard mentions. 2024-08-23 15:43:44 -07:00
Anders Kaseorg 62e8261e63 Merge tag '10.0-dev'
The 10.0-dev tag was created on the wrong commit, and force-pushing
it would break upgrade-zulip-from-git.  Merge it into main so that
cache-zulip-git-version detects the right version.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2024-08-23 14:06:27 -07:00
afeefuddin f013eb1037 message_fetch: Convert module to TypeScript. 2024-08-23 13:34:13 -07:00
afeefuddin ec19a34089 message_fetch: Pass msg_list_data explicitly to load_messages. 2024-08-23 13:34:13 -07:00
afeefuddin afe405e0ab message_fetch: Avoid variable reuse in narrow transformation logic. 2024-08-23 13:34:13 -07:00
afeefuddin b41a17a1d0 message_lists: Add is_combined_feed_view to MessageList type. 2024-08-23 13:34:13 -07:00