Commit Graph

4171 Commits

Author SHA1 Message Date
Aman Agrawal 402f589e76 user_topic_popover: Keep reference visible when popover is open.
In recent view and inbox view, we keep the topic visibility icon
visible when the topic visibility popover is visible.
2024-04-12 08:13:40 -07:00
Aman Agrawal 9a8ebf3a34 recent_view: Only normal show topic visibility indicator on focus.
This is now similar to how they behave in inbox view.
2024-04-12 08:13:40 -07:00
N-Shar-ma 633d814df9 upload: Rename variable `filename_url` to `syntax_to_insert`.
This variable holds the markdown syntax for a file that's to be inserted
into a message, hence the new name.
2024-04-11 16:52:33 -07:00
N-Shar-ma 7b7c52b7c9 copy_and_paste: Fix bug where an unlabelled image could be pasted twice.
This commit removes the unnecessary condition for a linked image to have
a label when checking whether to skip an image preview if its generating
link has already been copied.
2024-04-11 16:52:32 -07:00
N-Shar-ma 358bb6b342 message_view: For message sent by current user, always scroll into view.
Now whenever the bottom of the feed is visible, we always scroll to the
message/s just sent by the current user, updating the selected message
if necessary.

Scroll behaviour for messages sent by other users remains unchanged.

Fixes: #23298.
2024-04-11 16:39:58 -07:00
N-Shar-ma a7719184ad compose: Refactor code to combine 2 same if condition blocks into one.
The blocks were originally separated by some code for seemingly no
reason, so now the 2nd block is brought up and combined into the first.
An old irrelevant comment is also removed.
2024-04-11 16:34:33 -07:00
N-Shar-ma 94dc5723c6 compose: Scroll cursor at message's end into view when restoring draft.
When a long message is restored from a draft (or scheduled messages),
its end, and the cursor placed there, used to be out of view, giving the
impression that the message was not focused, when it actually was.

This is fixed by always scrolling the cursor into view.
2024-04-11 16:34:33 -07:00
Sayam Samal 610f46d74e actions_popover: Rename "View message source".
This commit renames "View message source" to "View original message".

The meaning of "original" in this context is very similar to what
source/source code means in software jargon, while being easier to
understand and translate for a non-tech savvy user.
2024-04-11 15:57:24 -07:00
Sayam Samal 27c85af6d9 message_controls: Remove view message source icon.
With this commit, if a user cannot edit or move his own message,
we no longer show the view message source icon.
2024-04-11 15:57:24 -07:00
Sayam Samal 7744c8b264 actions_popover: Fix content overflowing when the max-width is defined.
The simplebar core documentation, recommends to not style the element
initalising the simplebar at all and use an inner element instead.

Following the recommendation, we move the max-width property from the
popover tippy options, to the `.simplebar-content` element via the
`--popover-menu-max-width` custom property.

While doing so, we also simplify the max-width to `350px`, since the
responsiveness for smaller screen is already been taked care of in the
shared popover styling.

This prevents the issue where the content overflows and gets hidden
instead of wrapping, when the width of the popover reaches the set
max width (if any).
2024-04-11 15:57:24 -07:00
Sayam Samal f9ec17e78e popovers: Fix styling for multi-line menu options. 2024-04-11 15:57:24 -07:00
Sayam Samal 678a3eccab popovers: Fix width discrepancies in popover menus.
Following ca9b1060b7, we allow the content of popover menu items to
control the width of the popover.

While using `white-space: nowrap` works, we should instead use the
`max-content` intrinsic sizing so that, if necessary, we can still
provide a `max-width` to the popover which would then force the popover
menu content to wrap.
2024-04-11 15:57:24 -07:00
Sayam Samal ba64900373 popovers: Simplify popover menu top and bottom padding. 2024-04-11 15:57:24 -07:00
Sayam Samal f5bedd9501 hotkeys: Show Level 2 Shift key symbol for Shift key in popovers. 2024-04-11 15:57:24 -07:00
Sayam Samal 4105a38c1f popovers: Add minimum width to popover hotkey hints. 2024-04-11 15:57:24 -07:00
Sayam Samal dcb6252e57 popovers: Update popover hotkey hint colors. 2024-04-11 15:57:24 -07:00
Sayam Samal 19077fa1f6 actions_popover: Update icons for message actions menu options. 2024-04-11 15:57:24 -07:00
Sayam Samal 299aa7c39f popovers: Add hotkey hints support via a new handlebar template. 2024-04-11 15:57:24 -07:00
Sayam Samal 36e709c934 hotkeys: Rename adjust_mac_tooltip_keys to adjust_mac_hotkeys. 2024-04-11 15:57:24 -07:00
Sayam Samal 4b0e6ae3d8 actions_popover: Use the new "popover-menu" theme.
Fixes part of #28699.
2024-04-11 15:57:24 -07:00
Sayam Samal 422230e82d popovers: Add consistent tippy arrows which support all placements.
Added `tippy.js/dist/border.css` along with some custom CSS override,
to add arrows which inherit the border color and width of the popover,
while also supporting all placements.

Also consolidates the CSS styling of the popovers to the `tippy-box`
element, which is the recommended way to theme the element according to
https://atomiks.github.io/tippyjs/v6/themes/#creating-a-theme.
This further helps in unifying the styling of the popover and the arrow,
and prevents inconsistencies such as shadow of the popover being casted
onto the arrows.
2024-04-11 15:57:24 -07:00
Sayam Samal 6bf9c2bdfc popovers: Rename "navbar-dropdown-menu" theme to "popover-menu" theme.
Also renames the navbar dropdown related CSS terms, to their equivalent
popover related terms to accompany the name change of the theme.
2024-04-11 15:57:24 -07:00
Shubham Padia c44450c054
settings_users: Reverse order of roles in role filters.
Fixes #29687.
2024-04-11 15:35:01 -07:00
tnmkr 536f2e09e2 invite_user_modal: Always show scrollbar.
We now always show the scrollbar in invite modal body if it is scrollable.
This avoids confusion and makes it clear that some options are out of view.

Fixes #29393.
2024-04-11 14:41:38 -07:00
roanster007 0be93b8519 stream_settings: Fix error on stream setting update when compose closed.
Previously, when stream settings were updated, without opening the
compose box, assertion error were thrown.

This error was a result of a regression in compose_recipient, due to an
extra assert statement added during its typescript migration in
25ff0d4418.

This is fixed by removing the statement.
2024-04-11 11:28:55 -07:00
Karl Stolley 7291f0a919 info_density: Set font size, line height vars in dev. 2024-04-11 10:25:03 -07:00
Varun Singh 9ad7a9f0be data: Restrict parameter type to not be undefined.
Since the type of request_method(AjaxRequestHandler) has
been extended in the previous commit.Consequently the 'data'
field of 'request_method' has to be typed such that it
satisfies this change.

Because request_method's type can also be 'typeof patch' which
does not accept undefined 'data' field, I haved 'omit'-ted
'undefined' from 'data's type in function signature to satisfy
TypeScript.

Now ,in support of the changes I have made to two different function
sign(namely setting_ui.do_settings_change,dialog_widget.submit_api_request)
I am stating some points about data field inside these respective
function signs.

1.settings_ui.do_settings_change: For this 'data' was actually never
undefined. Each function call has a 'data' object passed( with one
or more fields).

2.dialog_widget.submit_api_request: For this case many function calls
actually didn't have 'data' field (ie.'data' was undefined).
BUT,for those cases it was defaulted to '{}'(see function sign).
So effectively 'request_method' didn't recieve an undefined 'data' for
this case too. I have removed the defaulting and passed '{}' in the
function calls for those cases, which effectively does the some job,
but satisfies the type.

For both these cases 'data' field isn't undefined and hence an Omit,for me
makes sense.
2024-04-11 10:08:45 -07:00
Varun Singh 9b9ea01dfa channel: Use TypeScript unions for 'AjaxRequestHandler'.
Type AjaxRequestHandler is used for typing request methods
(like channel.get, channel.post etc.)Use cases include
'request_method' parameter in settings_ui.do_settings_change
and dialog_widget.submit_api_request.

Problem with the type definition:
The current type definition( ie. 'typeof call' ) satisfies every
'request_method' type EXCEPT channel.patch request.One can notice
the difference b/w 'call' and 'patch' function in channel.ts .

Hence,We need to expand the AjaxRequestHandler type.I have unioned it
with 'typeof patch' is account for the case when 'request_method'parameter
is of type channel.patch.

Discussion:
https://chat.zulip.org/#narrow/stream/6-frontend/topic/setting_ui.20do_settings_change/near/1754557
2024-04-11 10:08:45 -07:00
Varun Singh b6473deca0 zod: Consistently use named imports. 2024-04-11 09:47:28 -07:00
Varun Singh 4985363bd7 poll_widget: Rename type to be more relevant. 2024-04-11 09:47:28 -07:00
Varun Singh 2d4bed4ab4 state_data: Fix alphabetical order. 2024-04-11 09:47:28 -07:00
evykassirer a8d261a68f dropdown_widget: Fix DropdownWidgetOptions.
Addresses this comment
https://github.com/zulip/zulip/pull/29611/files#r1559751399
2024-04-11 09:32:19 -07:00
Shubham Padia 3f6ceba39a settings_users: Add role filter to user list.
Fixes #18617.
- The role filter is added to both active and deactivated user
list. The original plan was to introduce a multi select checkbox
dropdown for the roles, but since that component is not ready yet,
we will use the dropdown component for the first iteration.
- To accomodate multiple filters, we have used an approach
similar to the one in recent_view_ui.js where we use dropdown
callback function and on("input") event on text search to set the
filter value in memory. The predicate functions uses these filters.
- We have also changed the default message when there are no
users to show to reflect `filters` instead of `current filter`.
2024-04-10 13:45:06 -07:00
Mahhheshh 68646cacfc message_edit_history: Add loading spinner.
Adds a loading spinner to the message history overlay,
improving the user experience by providing visual feedback while the
message edit history is loading.
2024-04-10 13:10:12 -07:00
evykassirer 16bf8d3df6 views_util: Convert module to typescript. 2024-04-10 12:19:52 -07:00
evykassirer 9366d42f14 dropdown_widget: Pass current value to get_options to avoid hacky this. 2024-04-10 12:19:52 -07:00
evykassirer c449bb35e2 narrow_title: Fix filter type. 2024-04-10 12:19:52 -07:00
Mahhheshh 619f85fac7 message_edit_history: Set cursor to default on hover. 2024-04-10 11:25:31 -07:00
N-Shar-ma 30b68214d3 settings: Do not scroll to save button when typing in textarea / input.
In an unsaved state, when focus is in a textarea or an input of type
text, we don't yet scroll the save button into view to not interrupt the
user's typing. When the input / textarea loses focus, we scroll then if
needed, triggered via the `change` event.
2024-04-10 11:18:17 -07:00
afeefuddin 61966e9d6e compose_tooltips: Convert module to TypeScript. 2024-04-10 11:17:20 -07:00
Lauryn Menard 39c5855b88 hash-util: Use NarrowTerm type from state_data.
Replaces the Term type in hash_util.ts with the NarrowTerm type
that is defined in state_data.
2024-04-10 11:15:27 -07:00
N-Shar-ma 7072794871 css: Make pills' content collapse according to width available.
We set `min-width: 0` on all nested flex containers for pills, not just
the pills label, which allows the label content to collapse as much as
needed with ellipsis when overflowing.

Fixes: #27205.
2024-04-05 09:14:37 -07:00
Aman Agrawal 4812c81968 click_handlers: Don't handle clicks with meta / ctrl keypress.
Fixes #17935

This allows users to ctrl + click a link to open it in new tab
without changing the state in the current tab.
2024-04-05 09:12:03 -07:00
Anders Kaseorg 64cabae46d web: Fix usage of .replace with variable replacement.
String.prototype.replace and String.prototype.replaceAll interpret
certain sequences such as $$ within a string provided as the
replacement argument.  Avoid this interpretation by providing a
function.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-04-05 09:11:23 -07:00
evykassirer d6f4424102 compose_actions: Convert module to typescript. 2024-04-04 16:34:42 -07:00
evykassirer 55cf08c4e6 compose: Allow stream_id of ComposeTriggeredOptions to be undefined. 2024-04-04 16:34:42 -07:00
evykassirer 5e0343816f page_params: Add narrow_topic. 2024-04-04 16:34:42 -07:00
evykassirer 85c5fe635e compose_actions: Include message type in opts for `fill_in_opts_from_current_narrowed_view`. 2024-04-04 16:34:42 -07:00
evykassirer 9cea1c0ee1 compose_actions: Include message type in opts for `complete_starting_tasks`. 2024-04-04 16:34:42 -07:00
evykassirer 2014c25cb4 compose_actions: Include message type in opts for `start`. 2024-04-04 16:34:42 -07:00
evykassirer 3ea46542ce compose_actions: Include message type in same_recipient_as_before opts. 2024-04-04 16:34:42 -07:00
evykassirer 1f7e419cee compose_actions: Include message type in show_compose_box opts. 2024-04-04 16:34:41 -07:00
evykassirer 5934081801 resize: Let bottom_whitespace_height be optional.
This aligns with the comment below of "Compute bottom_whitespace_height
if not provided by caller." I'd change this to do a check for if it's
undefined, instead of checking the type, but I don't understand
enough about `ResizeObserver` to feel confident that this would be
equivalent.
2024-04-04 16:34:41 -07:00
evykassirer d05c7a64c8 stream_data: Remove unused code branch. 2024-04-04 16:34:41 -07:00
Evy Kassirer 466560faa1
compose_actions: Fix automated scroll when resizing compose.
This code has been inoperative since 86073588be
upgraded the autosize library without migrating this event.
2024-04-04 16:33:05 -07:00
N-Shar-ma a3ed41efa0 typeahead: Redesign the function `compare_people_for_relevance`.
We make the following changes:

- Remove the dm partnership check before calling the comparator passed
by the caller, and instead have the more thorough `compare_by_pms` be
the final tie breaker. This deprioritization of dms fixes the bug where
dm partners would be prioritized even if they had not participated in
a stream conversation over recent senders who are not dm partners.

- Make the passed comparator optional, since the tie breaker is same as
the comparator that was passed so far for dms, and only pass it in case
of a stream conversation.
2024-04-04 13:13:11 -07:00
N-Shar-ma a8954ad00e tests: Add missing setup to typeahead_helper tests passing as a fluke. 2024-04-04 13:13:11 -07:00
N-Shar-ma 7c2772022b typeahead: Add check for all time dm partners to `compare_by_pms`.
For the rare case where there is no recent recipient count for a pair of
users when sorting, we now check if either has been a dm conversation
partner ever before.
2024-04-04 13:13:11 -07:00
Aman Agrawal 0a90a13bec popover_menus: Fix event handler trying to hide a hidden popover.
When user is trying to open a modal after clicking on a button
in a popover, we call popovers.hide_all() before opening the modal
which hides the popover but since the event handler call isn't
finished running yet, we call instance.hide() again resulting in
tippy throwing errors that this could be a memory leak.

We introduce a wrapper function for `instance.hide` which if
the popover/tooltip is visible before hiding it to fix it.
2024-04-04 12:51:35 -07:00
Lauryn Menard 80d4a704fe mentions: Replace "channel" wildcard when selected via typeahead.
Until "stream" is renamed to "channel" in user facing strings,
when "channel" is selected from the composebox typeahead options,
the "stream" wildcard syntax will be inserted in the message
content instead.

Adds some helper functions to util.ts to initially be used to
check/convert "channel" to "stream" during the rename process,
with the intention of then converting those helpers for the
reverse (check/convert "stream" to "channel") in the final part
of the rename process.

Part of project to rename "stream" to "channel".
2024-04-04 11:16:07 -07:00
Lauryn Menard e700e818e5 mentions: Add "channel" as a wildcard mention.
Adds "channel" to the `stream_wildcards` frozenset for stream
wildcard notifications on the backend/server.

Updates frontend/web-app to handle "channel" as the other stream
wildcards are handled in the typeahead and composebox modules.

Updates the API version and documentation for the addition of
"channel" as a wildcard mention. But does not change any of the
functionailty of (or deprecate) the "stream" wildcard at this
point.

Part of project to rename "stream" to "channel".
2024-04-04 11:16:07 -07:00
afeefuddin b32c837c6b settings_playgrounds: Convert module to TypeScript. 2024-04-04 10:45:53 -07:00
afeefuddin 50f35a22b3 state_data: Update realm properties. 2024-04-04 10:45:53 -07:00
afeefuddin af0a31f0e4 bootstrap_typeahead: Make updater property optional in TypeaheadOptions. 2024-04-04 10:45:53 -07:00
Prathamesh Kurve f9bc21f4bf
keyboard ui: Fix vim keyboard navigation from inbox view filter.
Fixes #29509.
2024-04-04 10:17:09 -07:00
Anders Kaseorg b9e55f2c4d eslint: Enable no-jquery/no-append-html.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-04-04 10:11:57 -07:00
Anders Kaseorg 8fb1117cef eslint: Fix no-jquery/no-append-html errors that need test changes.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-04-04 10:11:57 -07:00
Anders Kaseorg 382af5f79f eslint: Fix no-jquery/no-append-html errors that need no test changes.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-04-04 10:11:57 -07:00
Alex Vandiver 01860422af util: Do not use look-behind in wildcard mention checks.
92fa9ee78c switched this regex to match the server-side regex, but
Safari < 16.4 does not support look-behind in regexes.

Switch to matching on start-of-string or a positive character class.
2024-04-03 17:39:26 -07:00
Karl Stolley 6d5243148a timestamps: Calculate the maximum timestamp width in use.
Fixes: #26970
2024-04-03 17:38:43 -07:00
Karl Stolley 82d0eec0bc timestamps: Consolidate and simplify message-time properties.
This is better form, and also sets things up to render sample
timestamps for calculating their max width.
2024-04-03 17:38:43 -07:00
Karl Stolley 09d7105747 timestamps: Consolidate variable-based timestamp width. 2024-04-03 17:38:43 -07:00
Karl Stolley 1425d2f71f message_body: Hyphenate message-time class. 2024-04-03 17:38:43 -07:00
Karl Stolley c25975642a message_body: Remove status-time references.
The `.status-time` class was used only for setting a `top` value,
but that's made moot by the use of grid in the message area.
2024-04-03 17:38:43 -07:00
Anders Kaseorg 1e4427caf5 tests: Fix incorrect uses of .indexOf(…) > 0.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-04-03 15:13:33 -07:00
Anders Kaseorg 1188a0f26d stream_settings_ui: Add missing $ prefix to jQuery object variable.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-04-03 14:10:21 -07:00
Anders Kaseorg 191345f9d6 ui_util: Fix HTML injection bug in replace_emoji_with_text.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-04-03 13:11:47 -07:00
Anders Kaseorg 4dc27216f4 rendered_markdown: Fix HTML injection bug in update_elements.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-04-03 13:11:47 -07:00
Anders Kaseorg e1029b59ed copy_and_paste: Fix HTML injection bug in construct_copy_div.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-04-03 13:11:47 -07:00
Temidayo32 25ff0d4418 compose_recipient: Convert module to TypeScript. 2024-04-03 13:08:10 -07:00
Tim Abbott f16c32e3a4 compose_ui: Fix incorrect ComposePlaceholderOptions type.
When opening compose without a stream prefilled from say the inbox
view, stream_id will be undefined here.
2024-04-03 13:08:10 -07:00
Tim Abbott d5422fe7c8 compose_recipient: Simplify update_compose_for_message_type.
At least one of the callers already passes the field in the opts
parameter, and the other can easily include it in the object.

(It might have it already, but that'll be easily checked while
converting compose_actions).
2024-04-03 13:08:10 -07:00
Temidayo32 80a3cadf4e compose_recipient: Fix missing argument. 2024-04-03 13:08:10 -07:00
Lauryn Menard 48a486a584 people: Update get_mention_syntax to better account for wildcards.
In `composebox_typeahead`, it is completely possible to call
`people.get_mention_syntax` for a wildcard mention, which will not
have a `user_id`.

Updates `get_mention_syntax` to not raise a blueslip error if the
mention syntax is for a wildcard mention.

Adds "topic" to the array of possible wildcard mention strings.

Tightens the types for the parameters for `get_mention_syntax`, by
setting `user_id` to be number or undefined, and by setting `silent`
to default to false (which is expected in a number of modules where
this function is called).
2024-04-03 12:19:27 -07:00
Pratik 6b31823c23 right_sidebar: Update invite modal label.
This commit updates the user invitation terminology in the right
sidebar, user invitation modal, and settings, to clarify exactly what
sort of invitation this is.

Fixes #29582.
2024-04-03 11:45:33 -07:00
roanster007 acc7444575 organization-permissions: Add help page link for User Identity section.
This commit adds the /help link to the User Identity section heading
of the Organization Permissions, linking to /help/restrict-name-and-
email-changes.
2024-04-03 11:01:52 -07:00
Anders Kaseorg 8f00ed4178 settings_components: Rename weirdly named type.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-04-02 22:35:28 -07:00
Anders Kaseorg 919f24a60d state_data: Accept null for realm_*_limit_seconds fields.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-04-02 22:35:28 -07:00
evykassirer c083d7c126 compose_ui: Split ComposePlaceholderOptions by message type. 2024-04-02 17:26:12 -07:00
evykassirer 249a3935ac compose_ui: Add message_type to ComposeTriggeredOptions. 2024-04-02 17:26:12 -07:00
evykassirer 86979b98c7 compose_ui: Rename message type to have correct casing. 2024-04-02 17:26:12 -07:00
Sahil Batra e595b9d611 settings: Remove template for group creation modal.
We no longer use this file as we have removed the old groups
UI from "#settings" overlay and instead now use the new
"#groups" overlay UI.
2024-04-02 17:21:36 -07:00
roanster007 c7a08f3b77 settings: Add permission to enforce unique names in realm.
Previously, users were allowed to signup or change their names to
those which already existed in the realm.

This commit adds an Organization Permission, that shall enforce
users to use unique names while signing up or changing their
names. If a same or normalized full name is found in realm,
then a validation error is thrown.

Fixes #7830.
2024-04-02 14:55:59 -07:00
afeefuddin a283a19c9f stream_color_events: Convert module to TypeScript. 2024-04-02 14:55:30 -07:00
Lauryn Menard 6f8d23b759 portico-styles: Updates some CSS rules used in the integrations docs.
Removes the extra side margin on tip, warning and keyboard tips when
they are in ordered lists.

Removes the extra bottom margin for h3 elements in the integrations
docs.

Removes the unordered list style for the integrations docs.
2024-04-02 09:30:48 -07:00
Aman Agrawal 329eda74a9 settings_overlay: Fix browser back not working as expected.
Closing overlay before switching narrow takes sets the previous
hash of the new narrow incorrectly, which results in browser
back taking user the previous narrow instead of opening the overlay
again.

Fixed by switching narrow before closing the overlay.
2024-04-01 18:33:08 -07:00
afeefuddin fd970e0520 user_group_components: Convert module to TypeScript. 2024-04-01 17:32:48 -07:00
afeefuddin ab14b2e04a settings_components: Fix check_property_changed types.
The group/subscription parameters are optional, as they're only used
in those settings panes.
2024-04-01 17:32:48 -07:00
Kenneth Rodrigues faccfb9bdc organization settings: Add links to manage deactivated users.
Display manage this user in the three-dot menu on the user card
regardless of is_active.
Similarly, display edit user icon in deactivated users list.
Do not hide edit button when user is deactivated.

Fixes #29486.
2024-04-01 15:43:16 -07:00
evykassirer bedbaa3a41 message_view_header: Convert module to typescript. 2024-04-01 13:22:39 -07:00
Afonso Azaruja e217d35ccd link_preview: Fix extraneous shadow.
Fix extraneous shadow at bottom of link preview
in stream messages in dark theme, in private
messages for both themes and in mentions, group
mentions and direct mentions.

This is done by applying the same color, used
in the background, to the shadow. There are CSS
variables that hold the values of the background
color.

Fixes #28853.
2024-04-01 13:06:42 -07:00
Aman Agrawal d21f5c9b75 registration: Ask user how they found Zulip. 2024-04-01 12:44:12 -07:00
Aman Agrawal 293992fe60 portico: Enable tippy tooltips for all portico pages with common style. 2024-04-01 12:44:12 -07:00
sujal 6ee354ddd6 bot-url: Reset to blank state when integration type is changed.
If the integration type is changed in the modal, resets the values
for the stream, topic and events parameters to a blank state.
2024-04-01 11:39:03 -07:00
sujal fbcf31c9e0 bot-url: Add event filtering UI to generate bot URL modal.
Adds an option to the generate bot URL modal to filter for events
that will trigger notifications. This option is conditionally
displayed when only `all_event_types` is defined for the selected
integration.

If selected, the URL will display all events by default. There
are "check all" and "uncheck all" buttons to easily include or
remove all the events from the URL.

Fixes #27628.
2024-04-01 11:39:03 -07:00
sujal a61c06c425 bot-url: Disable stream dropdown widget when no integration is selected.
Previously, the stream dropdown remained active regardless of whether
an integration type was selected.
This commit addresses the issue by disabling
the stream dropdown widget when no integration type is selected
2024-04-01 11:39:03 -07:00
sujal 030fbfc3b7 bot-url: Remove topic if include topic option unchecked.
Previously, when a topic name was included in the URL
and the user unchecked the button for including a
topic, the URL was not being updated accordingly.

Expands the check for setting the topic parameter for
the topic not being an empty string and having the
include topic option checked.
2024-04-01 11:39:03 -07:00
N-Shar-ma 6f7e030eb2 compose: Increase gap between Draft button's text and the counter. 2024-04-01 13:31:15 -05:00
N-Shar-ma 13df423ae1 compose: Adjust alignment and size of Drafts button at smaller widths.
The padding on the sides of the Drafts button is reduced from 5 to 3px
at smaller width, so that it's not right up against the textareas when
hovered.

The text is also aligned to the Send button's edge, like at larger
widths.
2024-04-01 13:31:15 -05:00
Aman Agrawal 0b589ac70d emojisets: Retry fetch for emojiset in case of network failure.
Fixes #25964

We can fail to load emojiset if browser is unable to connect to
internet or fetch failed midway due to a network error. We simply
wait for browser to come back online and retry.
2024-04-01 10:18:58 -07:00
evykassirer 9c055df695 settings_user_topics: Convert module to typescript. 2024-03-30 16:25:34 -07:00
evykassirer 741b8c308a user_topics: Always store stream name in UserTopic. 2024-03-30 16:25:34 -07:00
abdelrahman725 b0a4b8e439 passwords: Add keyboard accessibility for show/hide password icons.
Tweaked by tabbott to add the required tabindex configuration in the
password reset, password change, and registration forms as well.
2024-03-30 16:16:27 -07:00
evykassirer a43e9140f2 search: Convert module to typescript. 2024-03-30 15:27:02 -07:00
evykassirer c118d66943 typeahead: Rename input element type to be more specific.
This will be exported in an upcoming commit and a more
specific name will make more sense when using this type
in other files.
2024-03-30 15:27:02 -07:00
evykassirer 5cb32fe733 pill_typeahead: Simplify fake this objects. 2024-03-30 10:41:38 -07:00
evykassirer fc3ab45b46 typeahead: Pass input element to source instead of using hacky this. 2024-03-30 10:41:38 -07:00
evykassirer bdf4449ebf typeahead: Pass input element to updater instead of using hacky this. 2024-03-30 10:41:38 -07:00
evykassirer 9f83d14fb7 pill_typeahead: Use query passed to source instead hacky this. 2024-03-30 10:41:38 -07:00
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
Prakhar Pratyush 8d868ec149 send_message: Fix 'sent_by_this_client' incorrectly set.
Messages that are not delivered locally like slash command messages,
messages with backend only syntax, etc are processed by
'echo.process_from_server' function.

Earlier, in 'echo.process_from_server' we were clearing out
the local IDs of non-echoed messages and then a check to
set 'sent_by_this_client' based on local_id.

This led to 'sent_by_this_client' incorrectly set to False
as the local_id is already deleted.

This commit fixes the incorrect behavior. We first determine
the 'sent_by_this_client' on the basis of local_id and then
we delete.
2024-03-26 10:58:02 -07:00
Sahil Batra 19a7c75400 settings_components: Convert to typescript. 2024-03-26 10:32:15 -07:00
Sahil Batra b088f56bf7 settings_components: Fix code for parsing to numbers.
This commit updates the code for parsing strings to
numbers to use correct types -
- Number.parseInt and Number.parseFloat take strings
as inputs but we were passing Number objects.
- We were using string as an operator for "*" arithmetic
operation, which is incorrect.

This commit fixes the above mentioned things and would
be helpful when we convert settings_components file to
typescript.
2024-03-26 10:27:53 -07:00
Sahil Batra bb2a574aa8 settings: Refactor get_realm_time_limits_in_minutes.
THis commit refactors get_realm_time_limits_in_minutes
code to not convert the setting value to integer and just
keep it string. This change will help us in not defining
the type of the variable as "number | string" when we can
easily use the string values.
2024-03-26 10:27:53 -07:00
Aditya Bajaj 484ef17afc subscriptions: Fix broken UI for subscriber and member search.
Fix overlapping UI layout for stream subscribers search
on screens smaller than 320px. Break the search field
to a new row in the layout. Also fix the same issue in
the group settings > members panel.

Fixes #29368
2024-03-26 09:05:19 -07:00
Vector73 ea5b6be433 navbar_alert: Fix wierd closing of profile-missing-required alert.
This is a follow-up for #28924 to fix weird closing behavior of navbar alert which
is used to show the presence of empty required profile fields.
2024-03-26 09:03:16 -07:00
evykassirer 38b2988e0f buddy list: Fix issue where unread marker overlaps triple-dot.
Screenshot and original bug report here:
https://chat.zulip.org/#narrow/stream/9-issues/topic/Right.20sidebar.20bugs/near/1765231
2024-03-25 16:57:50 -07:00
evykassirer ad35d2a487 buddy_list: Use hide classname instead of user-with-count.
There seem to be two different ways of making the unread
marker visible:

(1) `user-with-count` classname on the `user_sidebar_entry`
element, which is added on render and not modified after
render at all.

(2) `hide` classname, which is toggled on the `unread_count`
element in `update_unread_count_in_dom`.

This creates a bug where sometimes the buddy list doesn't
update when messages are marked unread. This actually
doesn't always happen, since if there was an unread marker
that was there on the original render (and then removed
and put back) it will display again.

This commit keeps the `hide` class and removes the
`user-with-count` strategy.
2024-03-25 16:57:50 -07:00
Sayam Samal 51ed6a4d7b popover_menus: Extend arrow based navigation to tabbable components.
Instead of only checking for visible `a` tags, we should also check
for visible elements with the `tabindex=0` attribute defined. This
allows us to support navigation for other components which we
explicitly set to be tabbable.
2024-03-25 16:31:55 -07:00
Sayam Samal d469d37d14 personal_menu: Add theme switcher to personal menu popover.
This commit introduces a theme switcher feature within the personal
menu popover. The implementation begins with the development of a
tab picker, which has the following features:

* Utilization of radio buttons to emulate the tab picker.
    Radio input buttons provides the native way in HTML to select one
    value out of a set.

* Support for both horizontal (default) and vertical orientations.
    Vertical orientation can be achieved by appending the
    `.tab-picker-vertical` class.

* Respects the `prefers-reduced-motion` option set by the user.
    Disables the sliding tab animation to improve accessibility.

Additionally, the theme switcher component incorporates error handling
mechanisms. In the event of a server/network error, the tab slider
reverts to the previous theme option after a delay of 500ms. This
behavior visually communicates the occurrence of an error to the user,
improving the UX.

Fixes: #22803.
2024-03-25 16:31:55 -07:00
N-Shar-ma 9cedf0e8bc compose: Trigger language typeahead on using code formatting button.
To increase the discoverability of the possibility of specifying the
language for a code block, we trigger the language typeahead when code
syntax is added using the code formatting button. A blank option is
shown preselected in the typeahead, so that pressing enter will not
mistakenly add a language to the code block.

We only trigger the typeahead on empty opening fences when added by the
button, by setting a state variable to true when adding the syntax using
the button, checking for this state when sourcing languages for the code
typeahead, and then resetting the state variable to false.

Fixes: #29150.
2024-03-25 16:30:03 -07:00
N-Shar-ma 4f051d653c typeahead: Don't hide typeahead on blur if focus is back in the input.
Now we don't hide the typeahead if the focus is back in the input within
150 ms. This is common when using the compose formatting buttons, which
only momentarily take the focus away from the input.

This is a prep commit for the next, to show typeahead on adding code
syntax with the code formatting button.
2024-03-25 16:30:03 -07:00
N-Shar-ma fb25027cfb compose: Refactor `format` function to return a boolean.
The inline `format` function defined in `format_text` function` now
returns true if formatting was added rather than removed, else false.

This is a prep commit for the upcoming change to show typeahead on using
the code formatting button to add code formatting to any selected text.
2024-03-25 16:30:03 -07:00
N-Shar-ma f800d4404e compose: Redesign the arrow between stream and topic.
The icon is now bigger, slimmer in stroke width, lighter in color, and
has less horizontal spacing around it.

Fixes: part of #28792.
2024-03-25 16:12:32 -07:00
Kislay de8d664830
templates: Add missing translation tags.
Several of these were found via an audit by Tim Abbott.
2024-03-25 13:26:11 -07:00
Vector73 7bd893915d css: Fix css styling in "profile-settings-form".
This is a follow-up for #28924 to fix css issues related to border around
required custom-profile-fields.
2024-03-25 13:23:19 -07:00
Prakhar Pratyush e5d50d9787 message_list_tooltips: Fix code style issue.
frontend-lint was failing due to code style issue
in 'message_list_tooltips'.

This was introduced in fd3c7728fc.
2024-03-22 22:35:15 -07:00
Temidayo32 533a6153b2 compose_validate: Convert module to TypeScript. 2024-03-22 15:59:37 -07:00
Varun Singh fd3c7728fc message_list_tooltips: Convert module to TypeScript. 2024-03-22 15:37:57 -07:00
Varun Singh b0377d5d6d message_list_tooltips: Create '$template' conditionally.
We only expect 'data-tooltip-template-id' to be present if 'tippy_content'
is not valid.Hence, only when 'tippy_content' is undefined, should we create
'$template'.
2024-03-22 15:37:57 -07:00
Varun Singh 92ba149f5f message_list_tooltips: Consistently pass 'target' as 'string' argument. 2024-03-22 15:37:31 -07:00
Varun Singh 92c8b89ce2 message_list_tooltips: Return 'undefined' to satisfy tippy upstream. 2024-03-22 15:35:49 -07:00
N-Shar-ma b6a04aaa83 typeahead: Add option for word order not mattering for query matching.
Uptil now, the `query_matches_string_in_order` function would respect
the order of words in the query string when matching a source string.
This meant that for query "two one", the source string "one two three"
would not be matched.

For more flexibility, a new function, `query_matches_string_in_any_order`,
has been added., which returns true if each word in the query string matches
the prefix of a distinct word in the source string, else it returns false.

The algorithm for computing this is quadratic in terms of the source word
count so can be a little expensive, but it is only currently used for
searching topics in Recent Conversations, where the strings' length is
limited by the max stream / topic name length allowed, so this should be
performant enough for this use case.
2024-03-22 15:20:40 -07:00
N-Shar-ma c503a846ba refactor: Rename `query_matches_string` to `query_matches_string_in_order`.
The function is renamed for clarity.

Prep commit for next commit which adds a similar function where order
does not matter.
2024-03-22 15:20:40 -07:00
N-Shar-ma 5d83e53ca5 typeahead: Treat query and source string in the same way before matching.
Like the source string, now the query too is converted into lower case
and has diacritics removed, before trying to determine a match.
2024-03-22 15:20:40 -07:00
Alex Vandiver 92fa9ee78c util: Use the same regex as the backend for wildcard mentions. 2024-03-22 09:36:12 -07:00
Varun Singh 1aaedf89ee poll_modal: Convert module to TypeScript. 2024-03-21 16:33:24 -07:00
Vector73 f758ca596b custom_profile_fields: Add "required" parameter to the profile fields.
Fixes #28512.
2024-03-21 10:48:54 -07:00
Tim Abbott ac0673e0b5 settings: Rename overly generic field and field_hint classes. 2024-03-21 10:48:54 -07:00
Tim Abbott 9786a16680 bot_avatar_row: Rename extremely generic CSS classes.
I fixed one apparent typo, `$row.find("api_key_error").hide();`, while
doing this.
2024-03-21 10:48:54 -07:00
Tim Abbott e436aea917 change_password: Avoid super generic CSS classes. 2024-03-21 10:48:54 -07:00