Commit Graph

57320 Commits

Author SHA1 Message Date
evykassirer ba41eace94 composebox_typeahead: Use local `completing` instead of typeahead `this`. 2024-03-30 10:41:38 -07:00
evykassirer c7b12c996c typeahead: Convert module to typescript.
This contains two more complex changes:

- The default versions of sorter and matcher assume that ItemType is a
string. But the Typeahead class works on a generic ItemType and I'm
not aware of a way to assert that this function is only called for
typeaheads with string items. For `matcher`, we can assert that the
items are strings. `sorter` is now a required option instead of an
optional one that could fall back to the default.

- `element` can be either an `input` element or a `contenteditable`
`div`. We distinguish between them using `.is("[contenteditable]"))`
but TypeScript doesn't understand that. So we replaced `this.$element`
with `this.input_element` where `input_element` is an object with the
`$element` and also a `type` specifying which type of element it is
(input or contenteditable).
2024-03-30 10:41:38 -07:00
evykassirer 3f5be23854 typeahead: Clean up render function.
`final_items` is a list of `ItemType` so it doesn't
make sense to wrap it in `$()`. Intead of creating a
"jquery list of objects", we generate a list of JQuery
objects. I also removed the unused `_index` in the
`map` call.
2024-03-30 10:41:38 -07:00
evykassirer 6aee4f270e typeahead: Simplify call to `this.source`.
`this.source` will always be of type `function`,
so we can remove the ternary statement. And `source`
always takes one argument, so we can remove the
second argument.
2024-03-30 10:41:38 -07:00
evykassirer 954da81f4c typeahead: Replace this.options with direct fields on Typeahead. 2024-03-30 10:41:38 -07:00
Mateusz Mandera 374178903e remote_billing: Move stripe_customer_id from server to realm if needed.
As explained in the comment, when we're moving the server plan to the
remote realm's Customer object, the realm Customer may not have
stripe_customer_id set and therefore that value needs to get moved from
the server Customer.
2024-03-29 16:27:03 -07:00
Alex Vandiver f9805c9e1f kandra: rabbitmqctl may not exist when applying the initial catalog.
puppet hard-fails if it can't find the binary to run in `$PATH`, so we
need to make the `unless` short-circuit to false if puppet itself is
not installed yet (as during initial installation).
2024-03-29 16:25:37 -07:00
evykassirer 5bcb4e55d8 desktop_notifications: Convert module to typescript. 2024-03-29 16:16:47 -07:00
tnmkr 79cc7db315 tooltips: Fix incorrect "required" tooltip on custom profile fields.
Previously, "This profile field is required." tooltip was visible on
all custom profile fields, including those that were not required.
This commit fixes that by targeting only the required fields.
2024-03-29 12:35:01 -07:00
Alex Vandiver 3c2efd236c kandra: Skip prometheus database user creation. 2024-03-29 11:34:18 -07:00
Alex Vandiver da243e9fb7 kandra: Force disks to be set up before kernels are changed. 2024-03-29 11:34:18 -07:00
Alex Vandiver e4883cc2dc kandra: Move PostgreSQL data mountpoint to /srv/data.
We store a lot of other things in `/srv` now, and moving them mid-puppet
confuses things significantly.
2024-03-29 11:34:18 -07:00
Alex Vandiver 93c6fd4746 kandra: Pull instance storage device from nvme information. 2024-03-29 11:34:18 -07:00
adnan-td 87dee7a9b2 invite_user_modal: Replaced email text_area with input_pill.
This makes the widget considerably more attractive, and probably a bit
more usable.

Fixes #29391.
2024-03-29 11:13:03 -07:00
adnan-td 97cbf4e075 input_pill: Renamed removePillFunction to onPillRemove. 2024-03-29 11:13:03 -07:00
Tim Abbott 6be511ed48 invite: Use error status for failed invitation attempts. 2024-03-29 11:13:03 -07:00
Anders Kaseorg 8a7f61fcad test_decorators: Replace some deleted tests.
Commit 807a4428f6 (#29485) deleted the
corresponding tests in TestAuthenticatedJsonPostViewDecorator.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-29 09:39:34 -07:00
Anders Kaseorg 416cba8746 install-shellcheck: Upgrade ShellCheck from 0.9.0 to 0.10.0.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-29 09:37:38 -07:00
Anders Kaseorg da984d0ab3 install-node: Upgrade Node.js from 20.11.1 to 20.12.0.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-29 09:37:38 -07:00
Anders Kaseorg 328ac38b0d dependencies: Upgrade JavaScript dependencies.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-29 09:37:38 -07:00
Anders Kaseorg 708c3e7182 node_cache: Invoke pnpm via corepack.
This avoids prompting the user that corepack is about to download
pnpm.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-29 09:37:38 -07:00
Anders Kaseorg 2c13d0e43d eslint: Fix @typescript-eslint/no-unnecessary-type-assertion.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-29 09:37:38 -07:00
Anders Kaseorg 26ae533985 eslint: Fix @typescript-eslint/prefer-optional-chain.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-29 09:37:38 -07:00
Anders Kaseorg 4935276aa4 eslint: Fix @typescript-eslint/use-unknown-in-catch-callback-variable.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-29 09:37:38 -07:00
Anders Kaseorg 8f07d830f2 narrow_state: Remove unused narrowed_to_search, narrowed_to_starred.
They’re unused as of commit de0db7ad1a
(#28636).

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-29 09:37:38 -07:00
Alya Abbott b11bf32f8f help: Document user list in the right sidebar. 2024-03-28 17:33:11 -07:00
Alya Abbott 3a51ac349c help: Add instructions for how to search for messages. 2024-03-28 17:33:11 -07:00
Anders Kaseorg 44e38e8ea7 apt-repos: Disallow libmagic1 1:5.45-2 (Ubuntu 24.04).
This package is replaced by libmagic1t64 1:5.45-3 for the Ubuntu
64-bit time_t transition, but hasn’t been deleted from the archive
yet.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-28 16:47:30 -07:00
Pratik Chanda 0708505acb left_sidebar: Fix DM row highlight linger on narrowing away.
Earlier, DM row remained highlighted when narrowed to different
part of left sidebar other than recent and inbox since on narrow
event, `handle_narrow_activate` wasn't properly handling unnarrow
events. It wasn't calling `update_private_messages` to update the
state of the DM list.

This commit fixes the behaviour by updating the state on narrowing
away from DM rows.

Fixes: zulip#27698.

Co-authored-by: Rinwaoluwa <peterodejobi9@gmail.com>
2024-03-28 14:09:04 -07:00
Pratik Chanda 8c89725fcc views: Fix message_list.current not updating to undefined on narrow.
Earlier when users narrowed to recents or inbox, message_list.current
was updating to last dm row selected for first few filter checks in
'narrow_state' which in turn would set active_user_ids to last dm
row selected. This resulted in DM highlight lingering.
The narrow_state.filter is supposed to return undefined when narrowed
to recents or inbox.

This commit fixes the behaviour by setting 'current' undefined before
filter checks on narrow.

Fixes part of #27698.
2024-03-28 14:09:04 -07:00
afeefuddin da80afd6f4 lightbox: Convert module to TypeScript. 2024-03-28 13:56:56 -07:00
afeefuddin 59c761fe32 lightbox: Pass HTMLElement consistently to parse_media_data. 2024-03-28 13:56:56 -07:00
afeefuddin 97d372c837 lightbox: Use ".append" to append nodes instead of ".html". 2024-03-28 13:56:56 -07:00
afeefuddin ce3e609d90 lightbox: Remove unneeded unit test. 2024-03-28 13:56:56 -07:00
N-Shar-ma 46147cd13c copy_and_paste: Add documentation for keyboard shortcuts for pasting.
Fixes: #29209.
2024-03-28 13:07:34 -07:00
N-Shar-ma 7895b05284 turndown: Enable turndown in production. 2024-03-28 13:07:34 -07:00
Varun Singh c29fbeca94 widgetize: Refactor type for 'extra_data'. 2024-03-28 12:59:58 -07:00
Varun Singh 894756addc submessage: Replace bogus test data with valid objects.
The test data was not the correct representation of submessage's
content field. This caused the zod schema to throw error.

This is a temporary solution and eventually we have to move to an
efficient approach making the test data more representative and
accurate.

Discussion:
https://chat.zulip.org/#narrow/stream/6-frontend/topic/TypeScript.20migration/near/1766122
2024-03-28 12:59:12 -07:00
Varun Singh f1db30418b submessage: Convert module to TypeScript. 2024-03-28 12:59:12 -07:00
Varun Singh a101e161dc submessage: Parse 'events' array data with zod.
The 'events' array in 'get_message_events' is made of objects.
Each object has 'data' field which is of type 'any' because
'JSON.parse' returns 'any'. We need to parse it using zod
to add type-safety.

The reason I am parsing the entire array at once is because,
'events' array is made of objects of two different schema; and
the order matters. The first element is of different schema than
the rest.(.tuple().rest() used is for that purpose).

This validates the entire submessage content before it is passed to
'widgetize.ts'.
2024-03-28 12:59:12 -07:00
Varun Singh 195bb4d13b zform: Move zod schema to avoid dependency cycle.
We need to validate the events array in 'submessage.js' using
zod. One of the schema needed is 'zform_widget_extra_data_schema'
in zform. If we import it inside 'submessage', it creates a
dependency cycle ; zform.js=>transmit.js=>server_events.js=>server_events_dispatch.js.
server_events_dispatch.js=>submessage.js=>zform.js

Hence I have moved the schema inside 'submessage' and imported it
inside 'zform.js'.
2024-03-28 12:59:12 -07:00
Varun Singh 3eb1a11725 zform: Add missing field in zod schema. 2024-03-28 12:59:12 -07:00
Varun Singh 7329100dc7 submessage: Send only relevant 'event' array data.
We sent entire 'events' array to 'widgetize.activate' and then
removed its first element(using .shift()); instead we should
send only relevant data ie. the entire array after the first element.

This also helps us avoid an extra check in node tests.
2024-03-28 12:59:12 -07:00
Varun Singh 2e8b950022 submessage: Remove redundant 'parseInt' statements.
As per 'Submessage' type in 'types.ts' , 'id' field is of type 'number'.
Hence we don't need to parse it.
2024-03-28 12:59:12 -07:00
Sahil Batra 85d0c0d7dd settings: Refactor code to handle authentication methods.
This commit refactors code to handle authentication methods
so that we need not update the type returned for
"realm_authentication_methods" by get_property_value
to be something different than what is the type for
realm object.

This change essentially means that we do not use the value
returned by get_property_value for authentication methods and
directly call realm_authentication_methods_to_boolean_dict.

Follow up to #29264.
2024-03-28 12:12:52 -07:00
Prakhar Pratyush a0cec2c378 stripe: Skip invoice overdue mail for free plans with no next plan.
Earlier, if a free plan (say legacy plan) with no next plan scheduled
was invoiced, we used to send an invoice overdue email if the last
audit log update is stale.

Actually, we don't need this data as the invoice step is just going
to downgrade the current plan. We should not wait for customer to
start uploading data in this case. Skip the email sending step and
invoice the plan to downgrade.
2024-03-28 09:29:23 -07:00
Anders Kaseorg 36b8462796 status_emoji: Remove extra space with Handlebars whitespace control.
This gets rendered into a comma-separated list, and the extra space
was ending up before the comma.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-28 09:11:09 -07:00
Anders Kaseorg f0945518ba inbox: Remove flexbox nonsense from user rows.
There was no reason for this to be a flexbox, and it was interfering
with wrapping of long names.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-28 09:11:09 -07:00
Mateusz Mandera c3caa3ecc8 stripe: Rename @error_handler decorator.
This decorator, among other things, transforms the "event" argument
passed when calling the decorated functions into actually passing
event.content_object.

So e.g. despite having a (before the decorator is applied) signature:

```
def handle_invoice_paid_event(stripe_invoice: stripe.Invoice, invoice: Invoice) -> None:
```

these are called passing an `Event` in the second arg when calling
`handle_invoice_paid_event`:

```
handle_invoice_paid_event(stripe_invoice, event)
```

I found that kind of confusing because the @error_handler decorator
didn't sound like something that would intervene in the arguments like
that. So it feels helpful to rename it something with a less modest
name, that makes it sound like it does more than just pure
error-handling.
2024-03-28 09:10:09 -07:00
Anders Kaseorg db1f69e72f compose_validate: Simplify away extra stream_data lookups.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-28 09:06:48 -07:00