This function takes the stream name (a string) and using numbers
makes it seem like it's actually using a stream id, which is
confusing. This change adjusts `stream` to always be a string.
Updates the realm field `default_code_block_language` to have a default
value of an empty string instead of None. Also updates the web-app to
check for the empty string and not `null` to indicate no default is set.
This means that both new realms and existing realms that have no default
set will have the same value for this setting: an empty string.
Previously, new realms would have None if no default was set, while realms
that had set and then unset a value for this field would have an empty
string when no default was set.
Expands support for the message ID operand for id" operator to be either
a string or an integer. Previously, this operand was always validated as
a string.
This commit adds support for triggering audible desktop
notifications when:
* A message is sent to a followed topic with the global user setting
'enable_followed_topic_audible_notifications' enabled.
* A message with wildcard mentions is sent to a followed topic with
the global user setting
'enable_followed_topic_wildcard_mentions_notify' enabled.
This commit adds support for triggering visual desktop
notifications when:
* A message is sent to a followed topic with the global user setting
'enable_followed_topic_desktop_notifications' enabled.
* A message with wildcard mentions is sent to a followed topic with
the global user setting
'enable_followed_topic_wildcard_mentions_notify' enabled.
This commit adds support for following a topic from the topic
three-dot menu in the left sidebar.
Three options, i.e., 'Mute topic', 'Unmute topic', and 'Follow topic',
are shown at the top of the menu (in the mentioned order), regardless
of whether the stream is muted or unmuted.
We can no longer set the topic's visibility_policy to INHERIT
(the default value) from this menu.
The changes are visible in the development environment only.
Fixes#25917.
Co-authored-by: Prakhar Pratyush <prakhar841301@gmail.com>
Co-authored-by: Hardik Dharmani <Ddharmani99@gmail.com>
This commit updates the existing 'Topics' settings UI
to add support for followed topics.
Changes:
- Add "Followed" as the first option in the topic status dropdowns.
- Modify the intro text.
- Replace the "Learn more." link with a question mark linking to
'/help/mute-a-topic' on the "Topic settings" heading.
The changes are visible in the development environment only.
Fixes#25918.
The change in the visibility_policy or status of a topic from
the topic popover, message header bar, or recent conversations
is not live-reflected in the 'SETTINGS / TOPICS' panel.
This commit fixes the above-mentioned bug by updating
the 'handle_topic_updates' function to update the settings panel.
Specifically when it's the last operand of the search
filter. This makes the first line of search results
more consistent with the lines that come after.
`selected_recipient_id` is supposed to be an id,
not a stream name. This function is currently
only ever called for direct messages, so there's
no present user-facing bug.
This mainly fixes error related to if checks like - `if ($jquery[0] !==
undefined)` which is not a good way to check for existence of jquery
objects instead we should check the length of jquery collections for
these if checks.
`modals_handle_events`.
We are not using the `_e` parameter here since this commit `4a3211d`, so
I removed this parameter from the `modals_handle_events` function.
Since `list_widget.render_item` accepts the parameter of type `Item` and
not `Key`, therefore we should pass the actual item instead of just
plain id to the `render_item` function here.
itself.
We were checking for the undefined value of `$html_item` but this
variable is always true since `$.find` never returns an undefined value
and it returns a JQuery collection instead.
So we need to check the length of that JQuery collection here to make
sure that the condition works as expected.
After migrating to TypeScript, we don't need to manually validate the
configuration passed to the `ListWidget`, that's what typescript complier
will do for us, hence I removed `validate_opts` and `valid_filter_opts`
functions.
We should directly set the value of `$scroll_container` when making the
`meta` object in `list_widget` instead of setting it up later in
`set_up_event_handlers` function which gets called anyways on
widget initialization. This allows us to not make an incomplete type
object which typescript will complain about when we migrates this module to
TypeScript.
This is a prep commit for typescript migration of this module. In this commit
I made all the users of ListWidget pass generic sort functions like 'alphabetic'
and 'numeric' explicitly to avoid type conversions which we may need when moving
to typescript, also it simplifies our `set_sorting_function` a bit more.
This is a prep commit for moving towards typescript migration of this module.
We should make `get_item` required on `list_widget` because its intended to be
used with a set of keys and then hydrate the keys lazily. Also this will help
us to avoid writing messy if-conditions while filtering and sorting and make
our life much easier when we migrate to TypeScript.
I added a `default_get_item` function which is just n identity function and
also refactored some code to make use of default get item.
We should keep methods of `list_widget` generic and independent of outer modules
data types and hence I added this parameter to get insert index to make
`insert_rendered_row` work with any list we create and not only `topic_list`.
This is a prep commit for migrating `list_widget` to TypeScript, In this
commit we declare all our methods for the widget directly inside `widget`
object to avoid making an incomplete object when we add a type for our widget.
Previously clicking on a message in search results opened
the compose box. This was not great, because search views
show messages outside of their context, and replying to a
message without the context of possible more recent
messages sent to that narrow can result in a bad experience.
This commit prevents the composebox from opening on click and instead
moves the user to a near view for the message, and similarly with the
enter keyboard shortcut.
Fixes#21217.
Removes the `assert_number` over defensive function which was being used
for validating the type of `stream_id` but now that this module is
converted to TypeScript we do not need this function anymore since
typescript compiler will do the type checking for us.
In this commit, we have replaced `build_stream_list()` with
`update_streams_sidebar()`. This change avoids zooming out from the
"more topics" view when toggling your subscription to a different stream.
It also triggers a forced rerender of the left sidebar only when
unsubscribing from the currently active stream. The stream list will be
updated once the user zooms out.
The `stream_list.build_stream_list()` function is responsible for
rendering the stream list in the left sidebar. Previously, it uses
`topic_list.clear()` to clear the `active_widgets` that tracks active
stream(s) in the left sidebar. This led to a bug where rendering stream
list after adding or removing a stream through `build_stream_list()`
while a stream was zoomed in ("more topics" clicked) didn't fully exit
the "more topics" view. So clicking "BACK TO STREAMS" throws an exception
with the message "Error: Unexpected number of topic lists to zoom out"
because `active_widgets`, cleared by `topic_list.clear()`, became
inaccessible.
To address this issue, instead of clearing the topics list with
`topic_list.clear()`, the code now ensures the closure of the zoomed
stream by using `topic_zoom.clear_topics()`. This change ensures a
proper exit from the "more topics" view and avoids the exception.
Fixes#25670.
This commit completes the notifications part of the @topic
wildcard mention feature.
Notifications are sent to the topic participants for the
@topic wildcard mention.
This commit also demonstrates how precise line-heights contribute
to a design: by matching the line-height on the avatar's grid area
to the dimensions of the square avatar image, it's possible to
center the first line of text (me-messages, in this case) with a
non-text element.
This satisfies the linter's desire for the `grid-template`
shorthand while keeping the illustrative template areas in
their own little diagram-like property.
This commit adds a boolean field `mentions_topic_wildcard`
to the `MessageRenderingResult` dataclass.
The field is set to true only if message rendering determines
the message has an actual topic wildcard mention in it (and not,
e.g., topic wildcard mention syntax inside a code block).
The rendered content for topic wildcard mention is
'<span class="topic-mention">{wildcard}</span>'.
The 'topic-mention' class is the identifier for the wildcard
mention being a topic wildcard mention.
We don't use 'data-user-id="*"' and "user-mention" class for
topic wildcard mentions and eventually plan to remove them for
stream wildcard mentions too in a separate mini-project.
This is a prep commit to replace 'wildcard' with 'stream_wildcard'.
This wasn't included in 179d5cb because we didn't decide to
use a different rendered_content for topic wildcard mention,
i.e., ''<span class="user-mention topic-mention">{wildcard}</span>'.
Our intention was not to create separate tests for both stream
and topic wildcard mentions, as they were expected to have the
same rendered content format.
This commit adds a 3px column between the `controls` and `time`
areas, which keeps the controls from crowding the time for
languages with longer time markers.
To make the layout easier to reason about, this includes the
minimum width for the time column as part of the message-box
grid definition.
This includes changing the URL to #settings/preferences, with a
transparent redirect so that existing links, like the one from Welcome
Bot, continue to work.
Previously the flatpickr was always set to show at the top but this
led to it being cut off when the message was at the top of the
screen -- should happen only when someone is editing a message.
We use `get_by_user_id` instead of directly accessing the global dict, because
when accessing person objects directly from one of the global dicts we
need callers to check for undefined values, this can be fixed by using
`get_by_user_id` method to get person objects because that functions
makes sure to assert that we indeed have a valid user id, so it will
never return undefined values.
Co-authored-by: Zixuan James Li <p359101898@gmail.com>
This commit improves the edited/moved tippy tooltip to now include a
second italic line: "Click to view history" This line is visible
only when 'realm_allow_edit_history' is true for any organization
settings. Additionally, the first line is changed to display
"Last edited today at 00:00 AM" The date is in lowercase if it
doesn't contain a number for example 'today' unless the first
alphabet is uppercase.
'tippy-zulip-delayed-tooltip' was used as a common class to
implement tippy tooltips in addition to other elements in the
'edited_notice.hbs' file. However, now we need to make some
changes in tippyjs inside the onShow function to decide whether
to show the second line of a tooltip or not. Therefore, we need
to use a unique class for the edited_notice tooltips. Hence, removed
the 'tippy-zulip-delayed-tooltip' class from the edited_notice.hbs
file and used the 'message_edit_notice' class instead.
Fixes: #23075
When a message list view rerenders a locally echoed message the
message recipient header is also rerendered, which then removes
the "sticky_header" class if it was present. If rerendering the
message triggers a non-user initiated scroll event, then the
"sticky_header" class is updated.
But it is possible that the rerendering of the message will not
trigger a scroll event, which means the recipient header is no
longer updated and the next calculation for the message list
view's _scroll_limit for the top of the feed will not include the
sticky header and the currently selected message may be scrolled
partially or completely under the message header recipient bar.
In message_list_view.rerender_messages, adds a check, after calling
_rerender_header in a loop, for the current message list and calls
update_sticky_recipient_headers if the message feed is visible.
Adds a comment to _rerender_header that we expect it to only be
called in rerender_messages so that the "sticky_header" class is
updated if needed.
This commit removes "@" from name of role-based system groups
since we have added a restricion on having user group names
starting with "@" in the previous commit as they look odd in
mention syntax.
We also add a migration in this commit to update the name of
role-based system groups in existing realms to remove "@"
from the name. This migration also updates the names of
non-system user groups by removing the invalid prefixes
from their names and if there is a group already with that
name, we insted name the group as "group:{group_id}".
Fixes#26148.
Replaced all instances of `safeOuterWidth()` and `safeOuterHeight()`
methods from the codebase with the safe counterparts `outerWidth() ?? 0`
and `outerHeight() ?? 0`. Removed custom safeOuterWidth/safeOuterHeight
method definitions from global JQuery object instance.
This bad rendering was the result of unwanted css applied
in the stream description. In message view header, the stream
link (title) we have defined has css defined but the markdown
rendered stream link in stream description had the same class
resulting in unwanted css applied to it.
Fixes: #25961.
Signed-off-by: Akshat <akshat25iiit@gmail.com>
The bootstrap CSS was not re-added to the input for number of licenses
in "Pay by invoice" section of upgrade page while removing the bootstrap
CSS for "number" type inputs from bootstrap.css.
This commit fixes it by re-using the existing CSS for other number type
inputs.
This commit removes the CSS for "text" type input elements
from bootstrap.css as we have already added the required
CSS rules to the specific elements in their specific files.
This commit adds filter_text_input class to various search inputs
used across the app. This new class is used to re-add the bootstrap
CSS rules such that we can remove the CSS from bootstrap.css.
This commit re-adds bootstrap CSS for custom time limit inputs
used by various settings by using more specific selector in
settings.css.
This is a prep commit for removing bootstrap CSS for text type
inputs.
This commit adds settings_text_input class to inputs in the
playground and linkifier panels, excluding the search inputs
as they are handled by filter_text_input class, and also to
the description input in the new user group creation form.
After adding this class, the bootstrap CSS rules to these
inputs are applied using the "settings_text_input" class.
This commit re-adds bootstrap CSS rules to ".settings_text_input"
selector in settings.css and this helps in adding the bootstrap
CSS to text inputs used in settings.
This is a prep commit to remove bootstrap CSS for text type inputs.
This commit re-adds bootstrap CSS for search input in
integrations page using a more specific selector in
integrations.css. We also change the selector to use
a class name instead of "input".
This is a prep commit for removing bootstrap CSS for text type
inputs.
This commit re-adds bootstrap CSS for text inputs in devtools
integrations page using a more specific selector in
integrations_dev_panel.css.
This is a prep commit for removing bootstrap CSS for text type
inputs.
This commit re-adds bootstrap CSS for the input
used to set the email to which emails will be
forwarded in the development environment "/emails"
page by using a more specific selector in
email_log.css.
This commit also increases the width of input to be
consistent with many other text type inputs and this
also helps in viewing the full placeholder text.
This is a prep commit for removing bootstrap CSS for
text type inputs.
This commit re-adds bootstrap CSS for "Organization website"
input in sponsorship page using a more specific selector in
billing.css. This change is done by re-using the existing
CSS for number type inputs and also removes the height
property which is not required.
This is a prep commit for removing bootstrap CSS for text
type inputs.
This commit re-adds bootstrap CSS for text inputs in realm details
page by using a more specific selector in activity.css. The CSS
added for search input includes bootstrap CSS applied using
".search-query" and "input[type="text"]" selectors.
We remove the CSS for search-query CSS from bootstrap.css
as the search element in app navbar already overrides the
bootstrap CSS.
This is a prep commit for removing bootstrap CSS for text type
inputs.
This commit re-adds bootstrap CSS for text inputs used in poll and
todo widgets by using a more specific selector in widgets.css.
This is a prep commit for removing bootstrap CSS for text type inputs.
This commit re-adds the required bootstrap CSS rules for inline
topic edit input to the specific selector in zulip.css.
This is a prep commit for removing bootstrap CSS for text type
inputs.
This commit re-adds required bootstrap CSS rules for
search box input element.
We also need to add the code to handle dark theme CSS
here to make sure the CSS for dark theme is prioritized
correctly.
This commit re-adds bootstrap CSS for custom expiration time
input in invite modal.
We also need to add the code to handle dark theme CSS here to
make sure the CSS for dark theme is prioritized correctly.
This commit also refactors the CSS to modify the selectors to
be simple and remove unnecessary IDs.
This commit adds modal_text_input class to:
- Input for payload url in new bot form. We add
modal_text_input class as type attribute for it has
been set to "text".
- Inputs in old user group creation modal.
- Input in set status modal.
- Inputs in linkifier edit modal.
- Inputs for options for "List of options" type
custom profile field.
This change is needed as we would be removing the
bootstrap CSS for text inputs and further commits
and the required CSS is added to modal_text_input
class.
This commit re-adds bootstrap CSS rules to ".modal_text_input"
selector in modal.css and this helps in adding the bootstrap
CSS to text inputs used in modals.
This is a prep commit to remove bootstrap CSS for text type inputs.
We don't have 800 font weight available, so the font weight defaults
to 700, so we use it directly here to avoid any changes when
we convert to variable font.
`Lighter` for this icon gets converted to 100 font weight, but the
visual difference starts to appear only after 500 font weight so,
we keep at 400 to begin with, which is what we support.
In `user_pill.js` add parameter to allow for excluding bots
when getting the users for the pill typeahead.
For `custom_user_field` typeahead exclude bots by default.
Fixes#25092.
There was no function to retrieve users while excluding bots,
this was needed to allow for typeahead user fields that require
to exclude bots from the autocomplete suggestions.
Fixes part of #25092.
Rename `get_active_human_ids` to `get_realm_active_human_user_ids`
to better fit naming conventions and to be more clear about the
detail that it only includes active users.
Fixes part of #25092.
Users are permitted to see wildcard mentions for all/everyone
during message composition in large streams according to
`restrict wildcard mentions` policy.
Fixes#25429
Declares the `handler` property inside the class constructor and not
after the constructor to avoid eslint and typescript errors when we
convert this module to typescript.
With the previous commit, we now have two buttons. One button cancels
the upload, while the other simply hides the upload banner. This
commit renames the switch case inside upload.js so that instead of
'upload_banner_close_button', it is now called
'upload_banner_hide_button', which appears to be more aligned with
the actual functionality of the icon.
This commit adds a cancel button to the upload banner, replacing
the previous close icon. Now, the cancel button is used to cancel
the upload process, while the close icon is used to remove the
upload banner without interrupting the upload.
A new case has been added to the switch statement in the 'upload.js'
file to handle the functionality of hiding the banner called
'upload_banner_hide_button'.
Replaced the functionality of the 'compose_banner_close_banner' case
inside the switch statement with a new case called
'upload_banner_cancel_button'. The cancel button is now assigned
the selector 'upload_banner_cancel_button'.
`Cancel` button is only preset for banner which tracks
progress while a file is being uploaded.
To maintain consistency with other banners, the cancel button's
dimensions and color have been adjusted to match the style of other
buttons present in different banners.
Fixes: #21156
Archiving a user/stream notification stream disables
user/stream notifications.This commit adds a warning
that notifications will be disabled while archiving
any notification stream.
Fixes#22110.
Co-authored-by: Victor Fróes <71036803+vfroes21@users.noreply.github.com>
Co-authored-by: Isabella Carmo <isabella.carmo@hotmail.com>
It might be possible that an event can come while we are in the
middle of rendering the stream settings overlay. This can cause
`hash_util.is_editing_stream(sub.stream_id)` to be `true` while
the `sub/unsub` button still hasn't been rendered yet.
Removes redundant `preventDefault` and `stopPropagation` calls for the
users of `dialog_widget.ts` module since we are already calling those
functions in the submit button click handler now.
We should prevent the default html behavior when submitting the forms
in the dialog_widgets to avoid reloading the whole page when the user
clicks the submit button.
Fixes: #26104
Previously, some unread banners were warning banners, but it made more sense
for all the unread banners to match and display as more of an info/notice
banners instead. This change matches all unread banners to be info/notice
banners.
The CSS for modals uses "--color-background-color" to set
background color of modal. But the variable is defined in
zulip.css which is not available for portico pages and thus
the email visibility modal was not rendering as expected in
"Terms of service" page.
This commit defines the "--color-background-color" variable
in portico.css such that it is available for portico pages
as well.
`update_recipient_bar_background_color` changes in a paint
after change in theme without using `requestAnimationFrame` to
make sure they happen in the same paint..
Replaced `setTimeout` with `requestAnimationFrame` in
`server_events_dispatch` since `requestAnimationFrame` already
ensures that they happen in the next paint, assuming that was the
intention of `setTimeout` being preset there.
We should make `get_by_user_id` type-safe in the sense that it's caller
should not expect undefined values and hence it's caller should not
need to validate the user ids.
To do this I extracted a method `maybe_get_user_by_id` which is
type-unsafe version of this function which will allow undefined values
and will behave exactly the same as the previous version. So the callers
which expects the undefined values from this function should use this
new function `maybe_get_user_by_id`.
Probably about half of these callers are implicitly iterating through
all users in the people.js data set and thus by construction should
never fail, but it's simpler to just convert all existing callers than
do that audit.
Made this function to avoid having incomplete `people` objects floating
around resulting in better type safety when using TypeScript. This function
has three required parameters - `user_id`, `email` and `full_name` and adds
default values to all other required properties.
Also removed the `user_id` field in case of `stream` type messages in favor
of `id` field because it will help us to form a well-defined object for involved
people.
Used `location.origin` instead of plain `location` because even though
passing just `location` is valid here and works because it has a
stringifier but still it will give us type error when we move this
module to TypeScript because of the expected `string` type here.