Commit Graph

4004 Commits

Author SHA1 Message Date
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
afeefuddin 6f81fe1b5b info_overlay: Convert module to TypeScript. 2024-03-21 09:00:33 -07:00
evykassirer f1b8e11e8b narrow: Remove stale comment about deactivate(). 2024-03-20 19:11:25 -07:00
evykassirer ba215e3e80 buddy_list: Ensure users are visible when hide_headers is true. 2024-03-20 18:47:24 -07:00
evykassirer 1defce3172 composebox_typeahead: Don't use typeahead to store `completions`.
It wasn't being used in the typeahead, just hackily being
referenced within composebox_typahead.
2024-03-20 13:08:26 -07:00
evykassirer d5d505a561 typeahead: Remove unneeded eventSupported.
It will always be true.
2024-03-20 13:08:26 -07:00
evykassirer 596233e14d typeahead: Default options to undefined instead of null. 2024-03-20 13:08:26 -07:00
Prakhar Pratyush 6484532830 help: Migrate configure-notification-bot help page to a new URL.
This commit migrates the 'help/configure-notification-bot' help
page to a new URL i.e. 'help/configure-automated-notices'.
2024-03-20 11:48:06 -07:00
roanster007 3d152296f6 message_view: Fix error thrown on deleting stream and searching for it.
Previously, when a stream is deleted and the deleted stream is looked
up in the search bar, then an error is thrown.

This is because, when the StreamSubscription object of the deleted
stream is fetched we try to access its properties - invite_only and
is_web_public, despite it being undefined.

This is fixed by accessing the properties only when the object is not
undefined.
2024-03-20 09:59:10 -07:00
afeefuddin 69fbd81a73 integration_url_modal: Fix input selector for runtime safety. 2024-03-19 16:05:34 -07:00
Aman Agrawal c3488bfe76 css: Merge common media queries. 2024-03-19 15:15:23 -07:00
Aman Agrawal 93373d1c12 css: Merge common media queries. 2024-03-19 15:15:23 -07:00
Aman Agrawal ac77d9e42a css: Wrap common media queries under `default-sidebar-behaviour`. 2024-03-19 15:15:23 -07:00
Aman Agrawal 1f89eec5ba css: Move media queries in scheduled_messages to zulip.css. 2024-03-19 15:15:23 -07:00
Aman Agrawal 5f1f0f9eb0 compose: Move related media queries to zulip.css. 2024-03-19 15:15:23 -07:00
Aman Agrawal af25709e30 css: Wrap more selectors under `.default-sidebar-behaviour`. 2024-03-19 15:15:23 -07:00
Aman Agrawal 4740485a13 css: Use better selector names for typeahead. 2024-03-19 15:15:23 -07:00
Aman Agrawal 66bc77cf61 css: Remove unused property.
`zulip.css` applies the same style to this so there is no need
for this.
2024-03-19 15:15:23 -07:00
Aman Agrawal 79565b4e90 css: Remove unused properties of dropdown-menu.
They are always overriden by the same properties set in compose.
2024-03-19 15:15:23 -07:00
Aman Agrawal fc48919a8b css: Remove invalid property applied to search icon.
Since `.zulip-icon-search` has `position: static` which is set
by default, setting `right` here makes no difference to its
position.
2024-03-19 15:15:23 -07:00
Aman Agrawal afe420dcd3 css: Hide left column in both navbar and app.
This was a regression in #29331 with no visual effects.
2024-03-19 15:15:23 -07:00
Anders Kaseorg 85d5669a4a web: Fix selectors to correspond with annotated types.
TypeScript does not check that these annotations are consistent with
the given selector strings.  We need to ensure that ourselves for
runtime safety.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-19 13:14:27 -07:00
Anders Kaseorg 548805dff9 realm_logo: Fix selector for image_upload_widget.hbs migration.
Commit 548107632c (#15333) should have
updated this but didn’t.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-19 13:14:27 -07:00
Joydeep Bhattacharjee d99238526d widgetize: Convert module to typescript. 2024-03-19 12:12:23 -07:00
Joydeep Bhattacharjee 94cd67b90f poll_widget: Fix ExtraData type. 2024-03-19 12:12:23 -07:00
Joydeep Bhattacharjee 2842945e6d ts: Replace all occurance of widgetize.js with widgetize.ts. 2024-03-19 12:12:23 -07:00
Anders Kaseorg f530f6749c sentry: Delay reading current_user and realm until they’re available.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-19 11:57:05 -07:00
shashank-23002 b74dabfaa4 alert_words: Highlight overlapping alert words more accurately.
This fixes a bug where alert words that are contained in another alert
word would have only the smaller alert word highlighted.

Note that it does not handle weirder cases, like "one two" and "two
three" being alert words; "two three" will always be highlighted, and
not "one"; this is probably fine in practice.

Fixes: #28415
Co-Authored-By: danieldotcomcoder <daniel_shdeed@hotmail.com>
2024-03-19 11:20:16 -07:00
shashank-23002 ebafe4d08f alert_words: Reuse set_alert_words to better share code. 2024-03-19 11:20:16 -07:00
afeefuddin 417d4b3a8a integration_url_modal: Convert module to TypeScript. 2024-03-19 09:38:22 -07:00
Prakhar Pratyush ad3603c0aa onboarding: Show one-time modal to introduce recent conversations view.
To improve onboarding experience, this commit adds a
one-time modal which introduces the recent conversations view.

Users see this one-time modal on visiting the recent
conversations view.

Fixes #29073.
2024-03-19 09:32:59 -07:00
Prakhar Pratyush 9a7634d527 onboarding: Show one-time modal to introduce inbox view.
To improve onboarding experience, this commit adds
a one-time modal which introduces the inbox view.

Users see this one-time modal on visiting the inbox view.

Fixes part of #29073.
2024-03-19 09:32:59 -07:00
Tim Abbott a33c68026c message_edit_history: Fix display of unknown private streams.
Previously, if such a stream were in certain positions in message edit
history, it would incorrectly be displayed as the empty string.
2024-03-18 17:26:28 -07:00
Mahhheshh e7adde96e0 message_edit: Reimplement message history modal as an overlay.
We redesign the message history modal to make it look similar to the
drafts and scheduled messages, using the shared styling/rendering
logic for that those existing elements to have a less goofy widget.

Fixes #28695.
2024-03-18 17:26:28 -07:00
Tudor Stefan Pagu 3324721eb7 tooltip: Hide scroll button tooltip on transition.
Fix a bug where the tooltip for the scroll
to bottom button would remain visible after the
button disapeared, if the user was hovering over
the button as it was dissapearing, without moving
their mouse. Now, the tooltip dissapears when
the button finishes the visibility transition.

Fixes #28656
2024-03-18 16:46:57 -07:00
Aman Agrawal 631aa1aac5 css: Wrap CSS related to hiding columns in `default-sidebar-behaviour`.
We might wrap more elements in future but this this is enough for
testing that nothing breaks right now.

Use `git show -w` for the real changes.
2024-03-18 15:28:03 -07:00
Aman Agrawal c643d0c0ae css: Specify for columns where it is located.
Navbar and app share same class for sidebar, so it is important
that we specify which one we are referring to if we are not referring
to both of them.
2024-03-18 15:28:03 -07:00
Aman Agrawal 803092f9f0 ui_init: Add a class to `body` to specify the current sidebar state. 2024-03-18 15:28:03 -07:00
Aman Agrawal ea85e526fb css: Specify to which `.column-middle` the styles is applied.
We use `#navbar-middle` and `.app-main .column-middle` specifically
to apply styles to those elements.
2024-03-18 15:28:03 -07:00
Aman Agrawal 4c6164ad49 ui_init: Remove unused dropdown menu code.
We migrated from bootstrap dropdown to use tippy. This change should
have been removed as part of that change.
2024-03-18 15:28:03 -07:00
Aman Agrawal 9ee11afb7e css: Remove min-width styles on app.
We always want to render Zulip at maximum available width with a
max-width.
2024-03-18 15:28:03 -07:00
Aman Agrawal df50c305ae css: Merge media queries. 2024-03-18 15:28:03 -07:00
Aman Agrawal 47acfc0bae css: Remove unused classes.
While they might be useful, it create a potential for elements
that we want to display on wide widths for a setting like
hide user list but was bugged due to a css class like this.
2024-03-18 15:28:03 -07:00
Aman Agrawal 341c25d087 css: Use variables for border colors in sidebars.
This is important step to fix a bug related to making sure css
for `.column-right` doesn't apply in navbar but only `.app-main`.
2024-03-18 15:28:03 -07:00
Sohaib-Ahmed21 d145aba3a5 hotkeys: Shift + M work in recent conversations and inbox.
Earlier, the Shift + M shortcut only functioned in messages to
mute/unmute topics in the messages section.

This commit enables the Shift + M shortcut to work in recent
conversations and the inbox. It achieves this by utilizing the
existing function toggle_topic_visibility_policy in user_topics_ui.
The focused row message of the recent_view_ui is passed to mute/unmute the
selected topic in the recent_view_ui, and the same process
is applied to the inbox_ui but the logic of muting/unmuting the topic
is kept in inbox_ui which uses function toggle_topic_visibility_policy
in user_topics_ui.

The function toggle_topic_visibility_policy is called in both
cases based on specific conditions to prevent the shortcut from
affecting other parts of the page, thus avoiding errors.

Fixes #27741.
2024-03-18 10:42:17 -07:00
Kislay Verma 454f2f2d95 compose: Fix unresolve button for empty topics.
When composing to an empty topic, only the compose box topic is
changed to remove the tick-prefix from it.

Fixes #29182.
2024-03-15 18:00:10 -07:00
Pratik Chanda 0c8845cec5 group_settings: Fix group settings panel title not updating.
Earlier in group settings, clicking a non participating group from
"all groups" and then clicking "your group" would reset the right
panel but the panel title would remain same as that of the non
participating group.

This commit fixes the behaviour and resets the panel title to
default.
2024-03-15 17:22:10 -07:00
Pratik Chanda a504753961 stream-settings: Fix right panel resetting on filter change.
Earlier in stream settings, filtering for streams by search stream
name would reset the right panel to default if a stream was selected
from stream row.

This commit fixes the behaviour by keeping the stream open in right
panel in stream settings even on any filter change.
2024-03-15 17:22:10 -07:00
Pratik Chanda f96ad02454 stream-settings: Fix stream settings panel title not updating.
Earlier in stream settings, clicking an unsubscribed stream in "all
streams" tab and then clicking subscribed tab, the right panel would
reset but the panel title and url hash would remain same as that of
the unsubscribed stream.

This commit fixes the behaviour and resets the panel title and url
hash to default.

Fixes zulip#28465.
2024-03-15 17:22:10 -07:00
Alex Vandiver bfe4017663 katex_server: Add Prometheus metrics. 2024-03-15 15:34:12 -07:00
Alex Vandiver c13e3dee24 katex: Replace subprocess call with minimal external service.
Replace a separate call to subprocess, starting `node` from scratch,
with an optional standalone node Express service which performs the
rendering.  In benchmarking, this reduces the overhead of a KaTeX call
from 120ms to 2.8ms.  This is notable because enough calls to KaTeX in
a single message would previously time out the whole message
rendering.

The service is optional because he majority of deployments do not use
enough LaTeX to merit the additional memory usage (60Mb).

Fixes: #17425.
2024-03-15 15:34:12 -07:00
Anders Kaseorg 959e51fe58 tests: Replace unneeded override_rewire uses by whole-module mocks.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-15 17:29:47 -04:00
afeefuddin 15db564246 search_suggestion: Convert module to TypeScript. 2024-03-15 13:10:34 -07:00
afeefuddin 611b28e308 search_suggestion: Rename invalid to incompatible_patterns. 2024-03-15 13:10:34 -07:00
afeefuddin 089e363313 search_suggestion: Rename huddle to huddle_emails. 2024-03-15 13:10:34 -07:00
Roshan Jagadish 20e44997e2
types: Migrated add_stream_options_popover to TypeScript.
The migration requires some new assert statements as well as a change
in how the `return undefined` case is spelled to match the types declared by 
Tippy upstream.
2024-03-15 13:02:20 -07:00
Anders Kaseorg 45cfa42469 tests: Avoid override_rewire for bootstrap_typeahead.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-15 12:56:03 -07:00
Mahhheshh 1c48ed0a1c stream picker: Remove stream colorblock.
To achive this the `stream_header_colorblock` div was removed from
`dropdown_widget_with_stream_colorblock.hbs` template. this change made
the file name irelevenet so it was necessary to rename the file to
`dropdown_widget_wrapper.hbs`. After removing the html strcuture for
colorblock from templates the css for colorblock was also removed.
followed by the javascript which was used to add colorblock to the
stream picker. After removing javascript tests were updated.
Fixes: #28796.
2024-03-15 11:11:04 -07:00
evykassirer db24df488c typeahead: Convert from a jQuery plugin to a normal exported function. 2024-03-15 10:05:44 -07:00
Karl Stolley bb114ed525 settings: Set light- and dark-mode color on field hints. 2024-03-15 09:58:33 -07:00
N-Shar-ma ef5cdff9d9 settings: Scroll save button into view when a change made needs saving.
Whenever a setting that needs confirmation to save is tweaked, and the
save button is not visible, we scroll it into view, to ensure the user
does not mistake it for an automatically saved change and misses saving
their change.

Fixes: #29290.
2024-03-14 17:31:39 -07:00
Tim Abbott 252a03790a condense: Fix accidentally deleted function call.
42dd55df42 incorrectly deleted this.
2024-03-14 17:12:14 -07:00
Aman Agrawal c84b9cbc97 upgrade: Allow payment by invoice. 2024-03-14 16:43:52 -07:00
Sahil Batra 12e298dd4c settings: Add description below name field.
This commit adds description text below the name field in
profile settings panel mentioning how the field will be used.

Fixes #29226.
2024-03-14 10:53:36 -07:00
Sahil Batra 0ac0f95ee8 register: Add description below name field.
This commit adds description text below the name field
mentioning where the field will be used.

Fixes part of #29226.
2024-03-14 10:53:36 -07:00
Sahil Batra 74ab3d2cbe webapp: Rename "Full name" field to "Name".
This commit renames "Full name" field in profile settings,
"Edit user" form and in the email modal for demo orgs to
"Name".

Fixes part of #29226.
2024-03-14 10:53:36 -07:00
Aman Agrawal 9846c4c476 inbox_row: Don't show topic visibility toggle button by default.
We emulate the same behaviour of hiding topic visibility button
by using opacity if for default topic visibility state.
2024-03-14 10:15:49 -07:00
N-Shar-ma f4d58f1ba6 compose: Show counter inside Drafts button for the current recipient.
Now we show the number of drafts that are addressed to the current
recipient selected in the compose box, if any, in the Drafts button
within parentheses (whether it is next to the Send button, or in the
Send options popover), and explain that it is the number of drafts for
this conversation in the tooltip.

Fixes: #28696.
2024-03-13 16:53:45 -07:00
N-Shar-ma 6ec04c2469 drafts: Refactor function to have a default value for its 1 parameter.
For function `filter_drafts_by_compose_box_and_recipient` since the set
of drafts to filter from is almost definitely going to always be all
drafts, we make the required drafts parameter optional with the default
value of all drafts.

This is a prep commit for the next commit which will use this function.
2024-03-13 16:53:45 -07:00
N-Shar-ma d491c7d53c typeahead: Fix bug where change event was not triggered post selection.
This fixes a regression introduced in the commit making typeahead undo
friendly, d88ce61801.

This fixes the bug where selecting a topic via keyboard in the compose
recipient area did not update the fade.
2024-03-13 16:53:45 -07:00
Sahil Batra 2296c0b717 settings: Do not pass JQuery object to check_property_changed.
The function check_property_changed is called at two places - we
pass elem as HTML object in one call and JQuery object in another.

We should make it consistent and we now pass HTML object in both
the calls as that would be better when we would convert
settings_components file to typescript.
2024-03-13 13:34:57 -07:00
Sahil Batra 67074e7dcc settings_components: Fix enclosing jquery object by "$".
There is no need to enclose a jquery object by "$".
2024-03-13 13:34:57 -07:00
Sahil Batra 75c297b5d4 settings: Pass HTML element not jquery object to get_input_element_value.
We now pass HTML element to get_input_element_value instead of JQuery
object so that we can easily assert types later when we migrate the
file to typescript.
2024-03-13 13:34:57 -07:00
Sahil Batra a6cc9acb22 settings_components: Refactor code in check_property_changed.
This commit updates code in check_property_changed to handle
all time limit settings in the same switch case.
2024-03-13 13:34:57 -07:00
Sahil Batra 40ce7d3df5 settings_components: Do not pass unnecessary parameter.
"Number.parseFloat" only accepts one string parameter and
no other parameter like radix passed in Number.parseInt.
2024-03-13 13:34:57 -07:00
Sahil Batra 517da47da7 settings: Return empty string for "Anytime" case.
We use 'get_realm_time_limits_in_minutes' function to get the
value to be put in the custom input element. Previously, we
returned "null" for the case when the setting was set to
"Anytime", but now we instead return an empty string as returning
null created some issues while converting the file to typescript.

There is no change in behavior due to this as in both cases the
input will be empty.
2024-03-13 13:34:57 -07:00
Sohaib-Ahmed21 7e99c90190 typeahead: Improve compose topic typeahead behaviour.
Fixes: #29006

We make the following changes:
* Do not show the typeahead menu when there are no matching topics.
* When the typeahead is not shown, pressing Tab in the topic field
should move the cursor to the compose box.
* When the typeahead is shown, pressing Tab should select the
currently focused option (as it does now), but put the cursor at
the end of the topic, rather than at the beginning.
2024-03-13 10:00:56 -07:00
N-Shar-ma f16208d9f1 message_view: Allow quoting selected message text, via hotkey and menu.
Whenever the user has text selected within a single message, and uses
the hotkey to quote and reply, this selection will be quoted. In case of
no selection or selection not within a single message, the entirety of
the currently focused message will be quoted like before.

Similarly, when the user selects text within a single message, opens
that message's actions menu, and clicks the "Quote and reply" option,
the selected text will be quoted. In case of no selection or selection
containing any other message/s, the entirety of the message whose menu
was opened will be quoted like before.

When partially quoting a message, it is the markdown version of the
selection that is quoted, hence preserving any formatting. Any other
elements of the message, outside of the content, selected presumably by
accident (like the timestamp or sender name), are ignored.

Fixes: #19712.
2024-03-12 12:29:30 -07:00
Tim Abbott f5505ace89 right-sidebar: Remove duplicate search people tooltip.
The buddy list redesign introduced a new, more detailed tooltip, and
neglected to remove the previous one.
2024-03-12 11:31:42 -07:00
Aman Agrawal d10d72e6a9 narrow_state: Change source of truth for is_message_feed_visible. 2024-03-12 11:31:23 -07:00
Aman Agrawal 374e09b2da message_fetch: Check filter instead of message list.
Reduces use of `message_lists.home`.
2024-03-12 11:31:23 -07:00
Aman Agrawal 1f6625168a message_scroll: Fix scroll to bottom button visible in Inbox view. 2024-03-12 11:31:23 -07:00
Sahil Batra 11c9ec925b stream-settings: Add code to live update email UI on changing privacy.
This commit adds code to live update the stream email address UI
when changing stream privacy.
2024-03-12 10:49:54 -07:00
Sahil Batra ded5fa75b5 stream-settings: Remove unnecessary code for live update.
There is no element with class ".personal" and so this code
is unnecessary. This should have been removed in 87e824d43e
when we changed the code to handle tabs to us
data-stream-section attribute instead of class.
2024-03-12 10:49:54 -07:00
Sahil Batra 749da8ab2f stream-settings: Fix handling live update for stream email UI.
This commit fixes code for live updating the stream email UI
when user subscribes or unsubscribes from the stream.
2024-03-12 10:49:54 -07:00
Tim Abbott d98580ab14 compose_state: Remove incorrect recipient_has_topics helper.
This function was introduced in
99d1c5a1f3 and always has the opposite
value from what its name suggests. It worked OK because the caller
also expected it to have an incorrect value.

It's cleaner in this context to just use the `stream_id` helper, so
just delete the bad code and use that.

Fix the docstring comment having been incorrectly pushed down while
we're addressing this.
2024-03-11 16:31:58 -07:00
Karl Stolley 3a0621fb66 rendered_markdown: Blur code content behind REPL and copy buttons. 2024-03-11 15:38:03 -07:00
Karl Stolley 2df6b6c02a rendered_markdown: Present REPL and Copy buttons with modern techniques.
This also removes the `.btn` class and interference from Bootstrap
on the code Copy buttons.

Fixes: #29165
2024-03-11 15:38:03 -07:00
Karl Stolley 2cf726c53b rendered_markdown: Refine templates and logic for REPL, copy buttons.
Co-Authored-By: shashank-23002 <21bec103@iiitdmj.ac.in>
2024-03-11 15:38:03 -07:00
Aman Agrawal 73370087ed message_feed_top_notices: Simplify check for all message view. 2024-03-11 14:14:36 -07:00
Aman Agrawal fa8b7d898b stream_muting: Refactor to not use message_lists.home. 2024-03-11 14:14:34 -07:00
Aman Agrawal 233bbbaa5f reload: Remove redundant parameter.
`save_narrow` is always true right now and it makes sense
to always save the current narrow when reloading the app.
2024-03-11 14:13:26 -07:00
Aman Agrawal 19af746ce4 reload: Avoid using message_lists.home. 2024-03-11 14:13:26 -07:00
Aman Agrawal 5548a28980 message_fetch: Allow spectators to access all messages view. 2024-03-11 14:13:26 -07:00
Aman Agrawal 8204abf1ce unread_ops: Minor refactor. 2024-03-11 14:13:26 -07:00
evykassirer 03ec788a91 typeahead: Move module to web/src. 2024-03-11 09:56:18 -07:00
evykassirer a55979ebf8 typeahead: Fix buggy advanceKeyCodes code.
The `advanceKeyCodes` option was introduced in #10092.
It included a buggy check for `$.inArray` that returned
a falsey value only when the keycode was the first
element of `advanceKeyCodes`.

Because the only instance of `advanceKeyCodes` right now
is for search and contains only one element, this change
is functionally equivalent.
2024-03-11 09:56:18 -07:00
evykassirer 99c119b01b typeahead: Add missing option to lookup call. 2024-03-11 09:56:18 -07:00
evykassirer 593784b35f typeahead: Remove unused on_move option. 2024-03-11 09:56:18 -07:00
evykassirer aa4e92ee18 typeahead: Stop using html() to set value from updater().
I confirmed that updater() only returns a string or undefined.

composebox_typeahead.js

- compsebox calls `content_typeahead_selected` which returns the composebox
  text content
- stream and PM: implicitly returns undefined

pill_typeahead.js

- implicitly returns undefined

search.js

- narrow_or_search_for_term — returns `get_search_bar_text` or empty string

custom_profile_fields.js, settings_playground.js

- no updater function

If no updater function is provided, then updater returns the
value passed to it, which is
`this.$menu.find(".active").data("typeahead-value")`, which is a string.
2024-03-11 09:56:18 -07:00
evykassirer 30ecf6fafd typeahead: Don't call html with a jquery object.
This is helpful beyond appeasing the linter, because TypeScript only
[permits](https://unpkg.com/browse/@types/jquery@3.5.29/JQuery.d.ts#L5287)
`.html(…)` to accept a `string` or `HTMLElement` argument (or
function returning those), not JQuery. The behavior with a JQuery
argument is also [undocumented](https://api.jquery.com/html/#html2).
2024-03-11 09:56:18 -07:00
evykassirer 2140138f5e typeahead: Confirm that highlighter text is safe html.
All existing typeaheads have values for highlighter that are one
of the following:

* render_search_list_item (a handlebars render function)
* render_typeahead_item which calls a handlebars render function
* another function in typeahead_helper which eventually calls
  typeahead_helper
2024-03-11 09:56:18 -07:00
evykassirer 7219e3835d typeahead: Confirm that header text is safe html.
All current definitions of header(), which is renamed to
header_text() in this commit:

composebox_typeahead.js
- `get_header_html` uses `_.escape`
- `render_topic_typeahead_hint` — is a handlebars function
- third typeahead doesn’t have a header function

custom_profile_fields.js, pill_typeahead.js, search.js,
and settings_playground.js have typeaheads, but none of them
have header functions.
2024-03-11 09:56:18 -07:00
evykassirer 135395e8ce typeahead: Remove unused header_html option. 2024-03-11 09:56:18 -07:00
evykassirer 60018dfd12 typeahead: Use text() instead of html() in set_value.
This particular codepath is never reached right now,
because set_value is only called when `naturalSearch`
is `true`, and the only instance of `naturalSearch`
isn't for a `contenteditable` field.

But we don't need to use `html()` here because it's
displaying a plain string typeahead option.
2024-03-11 09:56:18 -07:00
evykassirer 099810e80f typeahead: Import jquery instead of passing it to a wrapper function. 2024-03-11 09:56:18 -07:00
evykassirer 827b42dd9f typeahead: Replace substring with slice.
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-string-slice.md
2024-03-11 09:56:18 -07:00
evykassirer d131f4119f typeahead: Remove unused `hideOnEmpty` option. 2024-03-11 09:56:18 -07:00
evykassirer dc4244b9d8 typeahead: Rename e to event for legibility. 2024-03-11 09:56:18 -07:00
evykassirer 6d30e3e01c typeahead: Stop using deprecated window.event.
See https://developer.mozilla.org/en-US/docs/Web/API/Window/event
for more about this.
2024-03-11 09:56:18 -07:00
evykassirer 8986846436 typeahead: Remove unnecessary that = this.
This isn't needed with arrow functions.
2024-03-11 09:56:18 -07:00
evykassirer 331efb0def typeahead: Refactor to avoid no-case-declarations issue. 2024-03-11 09:56:18 -07:00
evykassirer e12543f957 typeahead: Use const instead of let when not reassigned. 2024-03-11 09:56:18 -07:00
evykassirer 0a321f5e16 typeahead: Fix no-jquery/variable-pattern. 2024-03-11 09:56:18 -07:00
evykassirer 40b4db3323 typeahead: Refactor switch statements to avoid fallthrough. 2024-03-11 09:56:18 -07:00
evykassirer ff1f62bc56 typeahead: Use ?? instead of ||. 2024-03-11 09:56:18 -07:00
evykassirer 64b262d514 typeahead: Replace empty backup functions with inline functions. 2024-03-11 09:56:18 -07:00
evykassirer bb68dde1da typeahead: Use `startsWith` instead of a falsey index check. 2024-03-11 09:56:18 -07:00
evykassirer b034875216 typeahead: Replace ~ operator with includes().
Before ES2016, `indexOf` and jQuery's `inArray`
were used more often. They return -1 for a missing
element, and 0 is the only integer that’s falsy, so
-1 is the only integer whose bitwise complement is
falsy. Using bitwise not (~) like this is no longer
common practice and is a lot more confusing to read.
Now that we have `includes` we can use that instead.
2024-03-11 09:56:18 -07:00
evykassirer 2085d90736 typeahead: Change unused expression to just function calls. 2024-03-11 09:56:18 -07:00
evykassirer 624a879b4e typeahead: Remove unused variables. 2024-03-11 09:56:18 -07:00
evykassirer bcdde201ec typeahead: Use !== instead of !=. 2024-03-11 09:56:18 -07:00
evykassirer 7ccb833b35 typeahead: Run prettier for automatic format cleanup. 2024-03-11 09:56:18 -07:00
evykassirer 99ee72860e typeahead: Run eslint for automatic format cleanup. 2024-03-11 09:56:18 -07:00
sujal 29ca4ba662 stream_settings: Convert name to pills.
Convert anchor tag to pills containing an image/avatar
and username within both existing and new stream
subscriber member lists and group member lists
using the new user_display_only_pill.hbs template.
If user has long username that breaks the UI,
overflow is handled with ellipsis.
add a context class (panel_subscriber_member_list)
to add 'padding 5px'to 'pill_value' for stream
subscriber member list and group member list.

To retrieve  an avatar of a user add a
'img_src: people.small_avatar_url_for_person(user/person)'
field in 'stream_editsubscriber.js', 'user_group_edit_members.js',
'stream_create_subscribers.js' and 'user_group_create_members.js'.

Fixes: #25724.
2024-03-08 17:33:14 -08:00
N-Shar-ma 90cf911e89 typeahead: Update activity score computation algorithm for streams.
Earlier, streams were prioritised like this: pinned streams > subscribed
streams > other streams, with message volume serving as the tie breaker.

Now we prioritise them like: stream being composed to > pinned unmuted
streams > unpinned unmuted streams > pinned muted streams > unpinned
muted streams > unsubscribed streams, with the same tie breaker.

Fixes: #20618.
2024-03-08 16:11:17 -08:00
Temidayo32 11e498f937 resize_handler: Convert module to Typescript. 2024-03-08 10:49:52 -08:00
Lauryn Menard 4d470a52f8 remote-support: Highlight if audit log data is stale or current.
Includes has_stale_audit_log boolean in the remote support view
data so that we can style the last audit log data for the remote
server to visually highlight if it is stale or current.
2024-03-08 09:40:43 -08:00
Lauryn Menard c9caad20d0 support: Have distinct labels for remote vs Cloud support views. 2024-03-08 09:40:43 -08:00
Lauryn Menard 3fe15e048e remote-support: Make approve sponsorship button stand out more.
Adds some color to the approve sponsorship button so that it is
more visible in the support sponsorship forms.
2024-03-08 09:40:43 -08:00
Lauryn Menard b421f3c7ca remote-support: Add class to form for removing a CustomerPlanOffer.
Adds a class to the form for removing a configured CustomerPlanOffer
so that we can add some margin between the form and the information
about the plan offer.
2024-03-08 09:40:43 -08:00
Alya Abbott 736070ca2e portico: Align plans on /for/education with /plans. 2024-03-07 17:31:20 -08:00
nimishmedatwal 8e0518d777 user_profile: Navigate tabs by arrow keys.
Left/right keys arrows in User Profile now navigates
between tabs when it's first opened.
Fixes #28615
2024-03-07 16:48:04 -08:00
Alya Abbott e4cf5ba0c5 bookends: Add periods to stream status bookends.
Also change "deactivated"->"archived" for consistency.
2024-03-07 16:16:02 -08:00
Temidayo32 42dd55df42 condense: Convert module to Typescript. 2024-03-07 16:15:30 -08:00
evykassirer c0bce2c4bf state_data: Fix alphabetical sorting. 2024-03-07 13:25:20 -08:00
evykassirer 3622bff379 activity_ui: Convert module to typescript. 2024-03-07 12:46:37 -08:00
evykassirer c78de3cbc1 state_data: Add realm properties. 2024-03-07 12:46:37 -08:00
Lauryn Menard f3906f4a2f remote-support: Add ability to deactivate and reactivate remote servers. 2024-03-07 11:51:00 -08:00
evykassirer 33484e7ac3 people: Cache results of remove_diacritics. 2024-03-07 11:46:54 -08:00
evykassirer 1db2d0fd0f people: Move comments above fields. 2024-03-07 11:46:54 -08:00
Varun Singh 1fb03a27d8 compose_fade: Convert module to TypeScript. 2024-03-06 14:47:47 -08:00
Varun Singh d60848bb81 compose_fade: Refactor 'set_focused_recipient' function.
Previously we  declared the 'focused_recipient' object
with an initial field of 'msg_type' and progressively added
fields by mutating the object(depending on the 'msg_type' ie. 'stream'
or 'private'). This was not TypeScript friendly and the compiler threw.

Now, we first fetch those fields and then create the 'focused_recipient'
object depending on the value of 'msg_type' field.
2024-03-06 14:47:47 -08:00
Varun Singh c67b38fa7d message_viewport: Consistently use 'row_to_output' for callback.
This callback(initially named 'row_to_id') is part of two different
code paths.For one it refers to 'get_row' function local to
'visible_groups' and for other it refers to 'row_to_id' function
local to 'visible_messages'(same namings cause a confusion and is
also inconsistent).

Here I have renamed the callback to 'row_to_output', this is
more explanatory and consistent with name '_divisible_divs' uses
for the same callback.
2024-03-06 14:47:47 -08:00
Varun Singh 99ea6ae3fc rows: Fix type of 'message_group'. 2024-03-06 14:47:47 -08:00
Varun Singh ead68e731b compose_fade: Fix argument to be a jQuery object. 2024-03-06 14:47:47 -08:00
Tim Abbott 242c5cbb1d condense: Pass message objects to collapse functions.
This creates a much cleaner API and types for these functions. Since
the callers already had the message objects, this avoids extra work
both in the most callers and in these functions.

We also loop through all_rendered_message_lists rather than hardcoding
logic for message_lists.home.
2024-03-06 14:40:47 -08:00
Sayam Samal 70013d0f28 navbar: Add navigate to home view tooltip to the organization logo.
The organization logo in the upper left navigates to the user's home
view. We add a tooltip to make this easier to discover.

We show `Esc` as the keyboard shortcut here, unless the user has
disabled it, in which case we show the alt shortcut `Ctrl` + `[`.

Fixes #29185.
2024-03-06 13:58:36 -08:00
afeefuddin 5e18bd762f left_sidebar_navigation_area: Convert module to TypeScript. 2024-03-06 13:57:33 -08:00
Karl Stolley b20beda905 emoji_picker: Express colors as CSS variables.
This also adds a previously missing dark-mode background color for
reacted emoji's :focus state in the picker.
2024-03-05 14:58:58 -08:00
Karl Stolley 11fcd4091c emoji_picker: Reorder CSS to match template structure. 2024-03-05 14:58:58 -08:00
Karl Stolley e22666f116 emoji_picker: Remove selectors not used with Tippy. 2024-03-05 14:58:58 -08:00
Sayam Samal a60e3d93e9 compose: Fix topics required banner closing on enter to send.
We were updating the compose banners on every `keyup` event on the
topic input. Since, `keyup` also gets triggered for the modifier and
non-printing keys such as "Enter", this lead to banner for topic
required being closed via the `check_posting_policy_for_compose_box`
when pressing "Enter" to send a message with no topic.

This bug was probably introduced in 5c993f0, which moved additional
logic into `update_on_recipient_change`.

To solve this issue, we use the `input` event instead of the `keyup`
event to update the compose banners only when the value inside the
input element changes.

This change also prevents the the compose banner from being closed
when we only press modifier keys - such as Shift.
2024-03-05 14:57:02 -08:00
Karl Stolley a5a6afb0ab portico: Remove All plans tab at mobile scale. 2024-03-05 14:55:43 -08:00
evykassirer 0062d3f999 reactions: Deduplicate shared code.
Creates a function for code shared by update_user_fields
and make_clean_reaction.
2024-03-05 14:54:45 -08:00
evykassirer 2de1486719 reactions: Send full message object to update_ui_and_send_reaction_ajax. 2024-03-05 14:54:45 -08:00
evykassirer 3d854771a2 reactions: Make count non-optional on ReactionUserIdAndCount. 2024-03-05 14:54:45 -08:00
Lauryn Menard bd1450f7b0 markdown-css: Wrap longer code elements in documentation.
Add a word-wrap rule so that longer code elements, such as example
URLs or long return value names in the API documentation, do not
overflow out of the view in narrowed browsers or mobile views.
2024-03-05 12:23:16 -08:00
Mateusz Mandera 898e47fbdd config_error: Change the look of the page.
Replaces the green theme with the old Zulip octopus with a plain, white
page.
2024-03-05 11:53:51 -08:00
Mateusz Mandera 1ede8da46c events: Change format of authentication_methods realm_update_dict event.
Makes the event in line with state_data.realm_authentication_methods.
2024-03-05 11:48:58 -08:00
Mateusz Mandera da9e4e6e54 backends: Implementation of restricting certain backends by plan.
Only affects zulipchat, by being based on the BILLING_ENABLED setting.

The restricted backends in this commit are
- AzureAD - restricted to Standard plan
- SAML - restricted to Plus plan, although it was already practically
  restricted due to requiring server-side configuration to be done by us

This restriction is placed upon **enabling** a backend - so
organizations that already have a backend enabled, will continue to be
able to use it. This allows us to make exceptions and enable a backend
for an org manually via the shell, and to grandfather organizations into
keeping the backend they have been relying on.
2024-03-05 11:48:58 -08:00
N-Shar-ma bff750e825 copy_and_paste: Fix formatting of code pasted from VS Code.
Since the html copied from VS Code is not structured as code but as
styled divs for each line, any code copied from it would be pasted
unformatted with blank lines between each line of code.

This has now been fixed, by detecting VS Code style code blocks by the
CSS property `white-space: pre` and pasting the text within as is, as
code.
2024-03-05 11:34:22 -08:00
evykassirer af8263fb87 people: Don't refetch user when we already have it. 2024-03-05 11:27:34 -08:00
Sahil Batra e965ed2eb8 stream_settings: Show banner on successful stream creation.
This commit adds banner which is shown on successful stream
creation which contains a link to stream narrow. This banner
makes it more clear that stream was created successfully and
also makes it easy to navigate to the new stream.

Fixes #29171.
2024-03-05 10:56:30 -08:00
Sayam Samal 24e5004a54 compose_tooltips: Rename "non-stream" to "non-specific" type/view.
We want to name types/views that are not Stream or Direct related to be
"non-specific". The previously used term "non-stream" could be confusing
since it would literally mean any type/view which is not a stream type/
view, which would encapsulate the Direct type/view also.

Thus, we finally use the following terms to describe the type of
conversation:
1. Stream type (Streams or Topics)
2. Direct type (A)
3. Non specific type (Inbox, Recent conversation, All messages)
2024-03-05 10:55:20 -08:00
Sayam Samal 1091938252 compose_tooltips: Fix compose buttons not updating for inbox view.
This commit fixes the bug, where navigating to inbox view does not
update the closed compose buttons. Due to this the tooltip over the
"Start new conversation" button also showed the wrong content.
2024-03-05 10:55:20 -08:00
Sayam Samal a0411e32b6 compose_tooltips: Fix tooltips for disabled conversation button.
In the situation where the DMs are disabled in an organization, we
disable the new conversation button. But due to this, the tooltip
hinting towards the same, was also being disabled because it was
attached to a disabled element which does not fire any events.

This commit fixes this bug, by wrapping the new conversation button
inside a div, and attaching the tooltip to this wrapper instead.
2024-03-05 10:55:20 -08:00
Sayam Samal f00d79399e compose_tooltips: Change new conversation button tooltip logic.
As reported on CZO, the new conversation button sometimes had stale
tooltip content rendered on it. In this commit, we change the logic
used to render this tooltip, to now render the tooltip content on the
fly via `instance.setContent()` which should eliminate any such bug.

Fixes #27158.
2024-03-05 10:55:20 -08:00