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.
This is essential for converting to typescript, because
we can't create half a clean reaction and then calculate
vote_text afterwards. Instead, we should calculate it
with the information we already have, and create the
clean reaction object afterwards, all at once.
When we move to typescript, we want to be able to calculate
this value *before* creating the clean reactions, so that
we can generate the clean reactions in one go instead of
having some half-created object.
On chromium browsers, the scroll position is not restored when the text
in a textarea is replaced. So instead of directly replacing the text,
we call the `insert_and_scroll_into_view` function with `replace_all`
set to true.
We refactor the `insert_and_scroll_into_view` function to accept a new
parameter, `replace_all`, defaulting to false, that when set to `true`,
will replace all existing content of the textarea with the new content,
instead of inserting the new content at the current cursor position.
This is a prep commit for the next commit, which will set this new flag.
We want to make the default stream listing more relevant. To do this,
we always show "All streams" tab when stream is opened from another
user's profile. From other places, we show "Subscribed" if the user
is subscribed to the stream they are trying to edit otherwise
"All streams" are shown.
We want to make default group listing in left panel more relevant.
Thus "All groups" are shown when group is opened from another user's
profile. From other places, "Your groups" are shown if the user is in
the group they are trying to edit otherwise "All groups" are shown.
This commit adds links to open group settings from "User groups" tab
of user profile. These links are not shown to guests as they cannot
view `#groups` urls.
Fixes#25214.
We no longer show the 'default' visibility policy in
the inbox view. 'Unmute', 'Follow', and "Mute' are
still shown.
For topics with 'default' visibility policy, it is
still possible to change the visibility policy via the
three-dot menu.
The motivation is not to have the default state so
prominently called out.
The function 'emoji_status_fields_changed' separates the conditional
logic into two parts. Now, we compare 'selected_emoji_info' and
'old_emoji_info' only when both of them have the fields necessary for
comparison.This helps with upcoming type inference and we no longer have
to write same conditional logic twice.
While || targets null, undefined, false, NaN, 0, -0, 0n, "",
and document.all, ??(null coalescing) specifically targets
null and undefined,which we are looking for here.
Instead of partially creating it and then adding
more attributes, this commit creates the return
value (formatted draft) in a single assignment.
This is needed for typescript work, in an upcoming
commit.
It was always being set after the fact, and it will
be easier to manage types for the conversion to
Typescript if we just set this when setting the
rest of the data for the draft message.