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.
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.
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.
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
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.
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.
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.
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.
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.
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.
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'.
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.
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.
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>
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>
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.
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.
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.
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
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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)
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.
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.
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.