Commit Graph

60464 Commits

Author SHA1 Message Date
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
afeefuddin 8741fe92be message_list_data: Update callback parameter types.
Correct the type annotations for the callback function parameter in
set_add_messages_callback.
2024-08-23 13:34:13 -07:00
afeefuddin 17e2d46760 message_store: Rewrite RawMessage type using Zod.
This commit rework RawMessage and it's related type to use
Zod for parsing the data received from the server.
2024-08-23 13:34:13 -07:00
Varun Singh f148a7a3ed popover_menus_data: Convert module to TypeScript. 2024-08-23 13:10:50 -07:00
Varun Singh d86e5eab78 user_topics: Add `AllVisibilityPolicies` to type. 2024-08-23 13:10:50 -07:00
Varun Singh 118c53dfc3 state_data: Type `realm_enable_read_receipts` field. 2024-08-23 13:10:50 -07:00
Varun Singh df395e99eb settings_config: Add type ColorSchemeDetails. 2024-08-23 13:10:50 -07:00
Varun Singh 1ce76e5fbd message_lists: Add field `message_containers` to `MessageListView` type. 2024-08-23 13:10:50 -07:00
Varun Singh 79dbb8dc79 base_page_params: Add `show_remote_billing` field to schema. 2024-08-23 13:10:50 -07:00
Varun Singh fcb9c7be26 widgetize: Fix type of `data` field. 2024-08-23 12:30:27 -07:00
Varun Singh 2cf09602df todo_widget: Convert module to TypeScript. 2024-08-23 12:30:27 -07:00
Varun Singh 9cd41e1c5b poll_widget: Amalgamate 'outbound_data' types for poll-widgets.
This will help in migration of downstream JS code.
2024-08-23 12:30:27 -07:00
roanster007 c6a06d4684 direct_message_group: Add new `group_size` field.
This commit adds a new `group_size` field to the `DirectMessageGroup`
model, and backfills its value to each of the existing direct message
groups.

Fixes part of #25713
2024-08-23 11:09:41 -07:00
Alya Abbott 8b7d9edecc portico: Update organized conversations image on /for/business. 2024-08-23 10:20:24 -07:00