Commit Graph

3902 Commits

Author SHA1 Message Date
evykassirer b4299d99fd typeahead: Pass query to updater instead of using hacky this. 2024-03-30 10:41:38 -07:00
evykassirer f0578c318c typeahead: Pass query to sorter instead of using hacky this. 2024-03-30 10:41:38 -07:00
evykassirer 9fc6793809 typeahead: Pass query to highlighter_html instead of using hacky this. 2024-03-30 10:41:38 -07:00
evykassirer cf9cf14dde typeahead: Pass query to matcher instead of using hacky this. 2024-03-30 10:41:38 -07:00
evykassirer 1f059f5906 composebox_typeahead: Use local `token` instead of typeahead `this`. 2024-03-30 10:41:38 -07:00
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
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
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 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
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
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
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
Anders Kaseorg 48e836f01c compose_validate: Explode validation_error into individual functions.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-28 09:06:48 -07:00
Anders Kaseorg 807a4428f6 compose_validate: Remove autosubscribe feature.
This was only used in the undocumented narrow_stream mode, and relied
on a deprecated synchronous XHR request.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-28 09:06:48 -07:00
Anders Kaseorg bd4a095fc3 inbox_ui: Sort names, not HTML.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-27 14:22:24 -07:00
Aman Agrawal bec8fccf75 right_sidebar: Hide underline from user-list toggle button in navbar. 2024-03-27 13:29:16 -07:00
Tim Abbott 3847740a2a settings: Sort various enumerations of settings fields. 2024-03-27 12:58:32 -07:00
Karl Stolley 286d44bf33 settings: Add new web information density settings.
Note that these settings are not operative at present, and are only
visible in the settings UI in the development environment.
2024-03-27 12:58:32 -07:00
Sahil Batra 2c73590088 settings_components: Fix assert in get_input_element_value.
This commit fixes an assert statement in get_input_element_value
to also include the textarea elements, which is used for realm
description. After updating, the assert statement now checks
the input_elem to be having one of the following types -
HTMLInputElement, HTMLSelectElement and HTMLTextAreaElement,
as these cover all the possible input elements with input_type
set to "string".

Follow-up to #29264.
2024-03-27 08:29:04 -07:00
nimishmedatwal 35c5231fe6 left-sidebar: Change recent conversation icon.
Fixes #29180
2024-03-26 12:55:34 -07:00
shashank-23002 246441bdcc tooltips: Hide scroll button tooltip under transition.
Fix a bug where scroll to bottom tooltip remains
visible even after the button dissapeared.
This was fixed in #29253 but the fix does not work
for the updated jquery event handling.
This updated fix bypasses the jquery wrapper to
access the exact propertyName.

Fixes: #28656
2024-03-26 12:53:33 -07:00
Aman Agrawal 9515dd45ee right_sidebar: Show underline on user-toggle icon when sidebar visisble.
This syncs the behaviour of userlist-toggle button to always show an
underline when sidebar is visible.
2024-03-26 11:10:04 -07:00
Aman Agrawal cc54a7caa8 sidebar_ui: Allow user to hide right sidebar on any screen width. 2024-03-26 11:10:04 -07:00