This commit adds the new users icon and uses it in the
recipient dropdown, both in the selection options and
the selected option displayed on the button.
If a click happens somewhere within compose, we don't want to cancel compose
and we also don't necessarily want to refocus the cursor in the compose
text area.
This change was made because clicks in the compose recipient dropdown
were hitting the first `if` statement and moving focus to the text area
when it should have gone to the topic or PM recipient input fields.
This `if` block was originally written for clicking external links and
codeblocks, which are outside of the #compose div and won't be affected
by this change.
Previously this dropdown was only for selecting streams, but
soon it will also be for switching to a private message. This
name helps it be clearer that the dropdown is more general
purpose.
We refactor the triage function to optionally take in a comparator
function, and use this to sort the results, except any exact match,
which is placed highest. Now we don't need to sort the results of triage
for streams, languages and slash commands since we just pass in the
comparator function. The overall effect is same as before, except that
exact matches are always shown first.
For users, we can't use the new triage feature to achieve this goal
without sorting `rest` and breaking a key optimization, so we just add
a bit of manual code for the job.
Fixes: #25123.
We now show a banner on opening the compose box and changing the
stream in dropdown, if a user is not allowed to post in a stream.
The "Send" button is also disabled if user is not allowed to post
in the stream.
This commit also moved the CSS for disabled modal button in dark
theme below after the other CSS for modals as we are using the
same CSS for the "Send" button as well in disabled state.
We now show all the streams, even if user is not allowed to post
in them, in the stream dropdown in compose box. In further commits,
we would add a banner mentioning that user is not allowed to post
for such streams.
This provides a basic link to view scheduled messages. At present, the
link is always visible, and it does not yet include a scheduled-message
count.
Fixes part of #25101.
This fixes the region between the avatar and the sender name in /me
messages not being part of the blue hover/highlight region for the
sender's user card.
The sender_info_hover region incorrectly filled the full row to the
right of the sender's name, resulting in the blue highlight being
visible in parts of the message that should be just the message body.
Fix this by moving the selectors for it further down in the DOM.
Fixes#25276.
The core bug here was that we opened the overlay after setting up the toggler
widget; this meant that the call to focus the correct element in the toggler
widget setup code path was ignored due to it not being possible to focus an
element that is hidden.
Fix this bug by reordering the execution of things, now we first open
the overlay to make sure that the content is available to be focused when
setting up the toggler.
Before `scroll_util` typescript migration this function was present in `compose_validate`
but this function is more closely related to `compose_banner` module, hence moved this
function to `compose_banner`.
This commit migrates `scroll_util.js` to typescript. I made a helper
type `JQueryOrZJQuery` for the argument of `get_scroll_element` instead
of adding a `__zjquery` property to the global JQuery object because it
isn't being used anywhere outside of this function and hence it makes
sense to have a little helper type than to add the property to the global
object.
UNMUTED topics in muted streams obey stream-specific
notification settings and global notification settings
as fallback.
A user receives or does not receive email or push
notifications for messages in UNMUTED topics depending
on the email or push stream-specific notification settings
configured, and global notification settings are used as a fallback.
This commit updates the logic to send or not send
desktop notifications for messages in the UNMUTED topic
depending on the corresponding stream-specific notification
settings configured and global notification settings as a fallback.
We show the stream privacy icon for the selected option in
dropdown list widget even if the widget is disabled. It is
fixed by changing the CSS to hide only the "i" element used
for the arrow toggle button and not all the "i" elements in
disabled state.
Created the new `compose_textarea` and moved event handlers for `#compose_textarea`
from `ui` to this new module so that it is now responsible for initializing event handlers
for compose_textarea instead of `ui` module.
This commit moves mainly two functions from `ui.js` to `message_live_update`,
`update_message_in_all_views` and `update_starred_view`. This is done in favor of
eliminating `ui.js` and also these functions are more closely related to
`message_live_update` module than to `ui` module.
We also move `show_message_failed` and `show_failed_message_success` to `echo.js`
for cleaner seperation of responsibilities.
This commit adds code to colorize the stream privacy icons in
dropdown list widget. Both the selected option in button and
options in the menu are colorized as per the stream color.
Fixes#25282.
A variable in the Node.js context cannot be mutated by a function
evaluated in the browser context. The boolean was also incorrectly
inverted, and a click to open the dialog containing
`enter_sends_choice` was missing.
Co-authored-by: Aman Agrawal <amanagr@zulip.com>
Signed-off-by: Anders Kaseorg <anders@zulip.com>
While we use a different convention in recent conversations and
recipient bars, in this context, it make sense for this icon to just
match the action we'll be doing.
We add a new banner informing the user if and when they send a message
to a muted topic / stream. It also has a button to unmute the topic.
Fixes: #24246.
For topics in muted streams, replace the "Mute topic" option in the
three-dot topic menu with an "Unmute topic" option, which should make
the topic unmuted. For unmuted topics in muted streams, show the
regular "Mute topic" option, which should specifically mark the
topic as muted, as usual.
Also, used new unmute icon for unmute option in three-dot menu for
topics in muted stream.
Fixes part of #24243
Updated mute_or_unmute_topic to take visibility policy as parameter
and set topic visibility_policy to the passed visibility_policy.
In zulip.css, updated CSS to set opacity as per visibility_policy.
Updated click handlers for recipient_row mute/unmute icons to
work as per stream.
Fixes#25124
Added unmute.svg in web/shared/icons. Also added
source and license information for the icon in
docs/THIRDPARTY.
Additionally, used unmute icon for unmute option in
topic_sidebar menu for topics in muted stream.
Fixes#25124
We now showing spinner in the "Schedule" button while the
message is being schedules similar to how we show the spinner
for "Send" button.
Fixes#25182.
We show the loading spinner when scheduling message using slash
command as the submit button present is "Send" button and not
"Schedule" button. This commit fixes the behavior to hide the
loading spinner in case of both success and error and also resets
the UI (mainly enabling the textarea element and clearing the
compose box) after successful scheduling of message using the
slash command.
This commit refactors show_compose_spinner and hide_compose_spinner
functions to use class of the button instead of ID to select the
appropriate elements such that we can use the same function to show
and hide spinner in "Schedule" button in further commits. For this
purpose, we add a new class compose-submit-button to the "Send"
button and this class will be added to "Schedule" button as well
in the next commit.
This commit renames 'settings_muted_topics.js'
to 'settings_user_topics.js' because the file now
supports the settings for topics with any visibility_policy,
not just MUTED.
It also renames the corresponding test file.
This commit renames 'muted_topics_settings.hbs' to
'user_topics_settings.hbs', because the file now represents the
settings for topics with any visibility_policy, not just MUTED.
This commit updates the existing 'Muted topics'
settings UI to add support for other visibility
policies.
Changes:
Settings sidebar:
1. Rename 'Muted topics' to 'Topics'.
2. Change icon.
Main panel:
3. Rename 'Muted topics' header to 'Topic settings'.
Topics table:
4. Rename 'Date muted' to 'Date updated'.
5. Update the search bar placeholder text to 'Filter topics'.
6. Drop the 'Actions' column.
7. Add a status column with a dropdown set of options.
(Muted, Unmuted, Default for stream)
Fixes#25081.
This prep commit updates the function
'get_user_topics_for_visibility_policy' to include 'visibility_policy'
as one of the keys in the user_topic objects.
The default stash function (which does nothing, as it's
essentially an identity function) and the function passed
from "markdown.js" do not accept any boolean input.
However, in "fenced_code.js", the function calls provide
a boolean parameter that is not used. This commit removes
that unused boolean argument.
It is required for its migration to TypeScript.
Migrated input_pill subsystem to TypeScript, used generics to make
it a generic module so that it works with different implementations
like stream_pill or user_pill.
This commit breaks the trivial import cycle between `input_pill` and
`compose_recipient.js` by manually triggering an on-change event when we remove
a pill which makes sure to run the `update_on_recipient_change` as
the event callback without us having to import it inside `input_pill`
and manually calling it.
Fixes: #25022
Refactored `payload` object such that when we migrate this module to typescript,
we will not have to write an incomplete type definition for this object.
This is a prep commit for preparing this module for typescript
migration. We should consistently use `.bind` and bind the funcs
in the final prototype correctly.
Documents narrows now have support for new filters for direct messages:
`is:dm`, `dm`, and `dm-including`. Also documents that `is:private`,
`pm-with` and `group-pm-with` are now legacy aliases for these three
new filters respectively.
Note that API documentation references the help center documentation
for search/narrow filters.
Fixes#24806.
Adds support in the web app for `dm-including` operator.
This will deprecate the `group-pm-with` operator, but any changes
to that narrow operator will be in a separate commit since it
returns a different message query. The `group-pm-with` operator
only returned group direct messages, while the new `dm-including`
operator returns both group and 1-on-1 direct messages.
The general API changelog and documentation updates will be done
in a final commit in the series of commits that adds support for
the various new direct message narrows.
Adds support in the web app for `dm` operator. This will deprecate
the `pm-with` operator, but existing links/URLs are still supported
for backwards-compatilibity.
This commit updates the web app default behaviors to default to
the new narrow/URLs `dm/...` and `/#narrow/dm/...` when navigating
and searching in the app.
There is some general clean up of references to private messages
or PMs to be either direct messages or DMs in these changes.
The general API changelog and documentation updates will be done
in a final commit in the series of commits that adds support for
the various new direct message narrows.
Adds support in the web app for `is` operator with the `dm` operand.
This will deprecate the `is` operator with the `private` operand,
but we keep support for backwards-compatibility with links/URLs.
This commit updates the web app default behaviors to default to
the new narrow/URLs `is:dm` and `/#narrow/is/dm` when navigating
and searching in the app.
There is some general clean up of references to private messages
or PMs to be either direct messages or DMs in these changes.
The general API changelog and documentation updates will be done
in a final commit in the series of commits that adds support for
the various new direct message narrows.
Incresase the max number of conversations shown when not zoomed
into the direct messages in the left sidebar to be 8 when there
are no unread conversations and 15 when there are unread
conversations.
When search bar is empty and we've reached that state
by using the `backspace` key. There are no suggestions
as there are when you select an empty search bar.
The cause of this was an explicit prevention of this
suggestion box in `typeahead.js` so that the
`backspace` key is free to interact with the other
elements.
The fix here is to add an optional `hideOnEmpty` option
so that if we want this suggestion box to appear we can
set this option to `false` and this behavior will be
prevented.
This option is enabled for the search input when pills are not
enabled.
Fixes: #25062.
Previously the typeahead container was being created at the bottom
of `body`, and its width (and `top` and `left`) were being set to
move it to the right position.
Now it sits in the search box container, which gives it the correct
position and width by default. This is better for DOM readability,
and is also better for the new 100% width (which is part of the
search bar redesign) because it can change width more smoothly
with the search bar when the page changes width.
This commit adds custom functionality to the bootstrap typeahead
to allow the typehead to be placed in the search box container
(whereas previously, it could only be appended to `body`).
Until now, the typeahead was hidden on clicking outside only if the last
click was not on the header. This happened because clicking the header would
blur the input, and any other click then would not trigger the blur event
(which is responsible for hiding the typeahead).
Now we refocus the input after clicking the header, so that clicking
elsewhere blurs the input and hides the typeahead.
This commit make changes in create stream panel by moving
announce stream option below stream description and adds a
"Stream permissions" section heading just above
"Who can access the stream?" and also rewords the text
"Announce stream".
Also now announce stream option is only shown if the user creating
stream have access to the announcement stream name. When option
is not shown, default behaviour is to announce public and
web-public streams.
Fixes#23327.
Modal that were used as dialog boxes for editing info
had issues with long heading text int .modal__title,
This commit add word-break to break words and avoid
abrupt ui in such cases.
This commit does following improvements in #streams and #groups overlay.
* Adds word break in the title in the right pane to handle long stream
and group names.
* Fix positioning of edit (pencil) button to the right end and provide
maximum available space for stream/group name.
Co-authored-by: Hardik Dharmani <Ddharmani99@gmail.com>
Previously, when adding a task to a /todo list, after pressing "Add
task", the cursor would move to the "Description" field, which is
not the desired behavior. This commit fixes this issue by ensuring
that the cursor moves to the "New task" field after a task is created.
The core bug was introduced in
68dcdcd28e, which added the incorrect
.focus().
Also tighten the selectors while we're at it.
Fixes#25064.
This commit fixes the text overflow bug for pill values by adding a
maximum width of 100% for the pill along with the ellipsis property on
text overflow.
Fixes: #21807.
If a user is editing a message or viewing the message source, they'll notice that clicking on the messsage doesn't move the blue box to it while the keyboard works just fine. We want to allow the message to be selected while not triggering the reply function.
Local storage is an untyped interface external to the frontend code
itself. The `data` field after `JSON.parse`'d from `raw_data` can be
further validated using `zod`'s schema `formDataSchema`.
The test case `server_upgrade_alert hide_duration_expired` in
`navbar_alerts.test.js` has a bug at `start_time`, which is fixed in
this commit. `start_time` is a mock value of `Date.now()` used in
`localstorage.ts`, which will concatenate with a number `expires`.
So `start_time` was supposed to be an integer value. Before fix, `new
Date(1620327447050)` returns a `Date` object which is wrongly
concatenated with `expires`.
Fixes#24997.
Added function parameter types, return type, and types of local
varaibles. Added a `null` check for `raw_data` before `JSON.parse`.
Created a type `FormData` and an export type `LocalStorage` to
imporve conciseness and clearity.
Type `LocalStorage` is exported because it might be used in other
files based on an observation that many files have imported `localstorage`.
This commit converts the dynamic closed_compose_box
tooltip to template-based tippy.js tooltips. The functions in
the compose_closed_ui.js file are refactored to dynamically change
the 'data-tooltip-template-id' attribute according to the situation.
The title parameter is removed from the functions in
compose_closed_ui.js so that we can change the tooltip within the
caller functions themselves, according to the situation. Since there
is no way to match the title in existing functions with different
languages to change the tooltip attribute dynamically, it is better
to change the tooltip attribute within the caller function according
to the situation, rather than passing the title as a parameter.
In the case of the reply button, we disable it when direct messages
are not allowed. However, tippy.js tooltips do not appear in the
case of disabled elements, so we have to use the container element
around it to show the tooltip. This approach is used in the case of
the reply button, where the span element wraps the button.
We used to have two titles for the reply button: one is the usual
'Reply to selected message', and the other is for the disabled state.
However, in the case of recent conversations, it makes more sense
to have a new tooltip title: 'Reply to selected conversation'.
To ensure that the tooltip content changes dynamically, it is
required to destroy the tooltip instance and then reinitialize it
every time.
Fixes: #25096
If there are unread_mentions in unmuted topic in muted stream then,
show `.subscription_block unread_mention` in regular font not faded.
An additional parameter is passed to the update_count_in_dom function
to add or remove the "has-unmuted-mentions" class from the
.subscription_block, allowing for the relevant CSS to be applied to
display the unread mentions in regular font.
Fixes part of #24243.
This commit implements a new logic to display unread messages count
in muted streams. If there are any unread messages in unmuted topics
within a muted stream, the unread counter for the stream will display
the total count of all the unread messages in the unmuted topics.
The counter will be shown in regular font (not faded).
Fixes part of #24243.
Co-authored-by: Tim Abbott <tabbott@zulip.com>
Add class unmuted_topic to li.bottom_left_row element if topic is
unmuted. Add relevant CSS for .unmuted_topic to display unmuted
topics in regular font.
Fixes part of #24243.
Previously, muted streams in the left sidebar were faded using
opacity: 0.5, and on hover, the opacity was increased to 0.75.
This opacity was applied to all elements within the muted stream,
including the stream-privacy icon, names of the stream and topics
within, and the unread_count.
In this PR, we changed this behavior to handle opacity for each
element separately. We changed the opacity of the stream-privacy icon
and unread_count, while for the text (names of stream and topics),
we changed the alpha factor for the hsla color property.
The reason for this change is that we can have different opacity levels
for the unread_count and other elements. This will allow us to add
feature in next commits in this PR to set the opacity of unread_count
to 1 while keeping it at 0.5/0.75 for other elements in the case of
muted streams with unread messages in unmuted topics.
Fixes part of #24243
We should trigger click event to open up the dropdown popup instead of using
`.dropdown("toggle")` because we want to clear the search state when opening up
the popup and the logic for that is registered in `on-click` handler defined in
`dropdown_list_widget`.
Fixes: #25218
Since we currently have 3 unread banners, it'd be much preferred to group
all of them up into one folder to keep them organized like how compose
banners are. This way, it's much easier to keep track of unread banners
and new ones in the future.
After merging #24309, we want to add an additional option to the "mark
messages as read on scroll" setting where we only mark messages as read
on scroll in conversation views.
`copy code` button now show a `Copied!` tooltip when clicked.
It implements a similar function used on `saved as draft` notice.
We need to modify the copy_code_button template to limit
data-tippy-trigger to not include click; otherwise, repeated clicks to
copy code will incorrectly also display the "Copy code" tooltip
alternating with "Copied".
Fixes part of #21036.
When we send a message (for which notifications are enabled)
in format `[](file_url)`. A blank notification is sent.
Fixing this by checking if there is no text and adding
message in that case.
Inspired from: #8796.
Fixes: #8087.
Without this, if there was a success compose banner and user pressed
escape key, no banners were hidden and the same behaviour was repeated
without compose ever closing.
Previously, when a user marks messages as unread in the all messages view
then enters another view and finally back to the all messages view, they'd
notice that the reading state in all messages view is still paused.
This happened uniquely for "All messages" because we only resumed the "reading"
state in `narrow.activate` (and generally that would generate a new MessageList anyway);
but `message_lists.home` is a singleton, so the "no longer reading" state would remain
attached to that object forever.
Fix this by explicitly resuming the reading state when we enter all messages
view/message_lists via narrow.deactivate.
Set data-tippy-trigger="mouseenter" on mute icon in recent
conversation to prevent tippy from staying on when the mute icon
is focused after clicking it. (The Tippy default is "mouseenter focus").
Rename get_muted_topics to `get_user_topics_for_visibility_policy()`,
since it works for both muting and unmuting.
Additionally, inline rerender_for_muted_topic, as well as removing
most of the logic to diff the sets of muted topics; the event is for a
single topic being changed.
Co-authored-by: Hardik Dharmani <Ddharmani99@gmail.com>
This commit refactors the logic of the 'all messages' view to
display messages from unmuted topics within muted streams.
Previously, we hid all messages from muted streams except mentions
by checking if the stream was muted. With this new change, we also
check for unmuted topics within muted streams using the
'is_topic_unmuted' function inside 'user_topics', which returns
'true' if the topic is unmuted. If there is any unmuted topic, we
show the messages from that topic in the 'all messages' narrow.
Live update was handled by the previous commit.
Fixes part of: #24243
We can dramtically simplify the stream muting live-update code path
for updating home_msg_list by observing the only thing it was doing
intentionally differently from update_muting_and_rerender is replacing
_all_items with a new version computed from from all_messages_data,
and the rest of update_muting_and_rerender can handle the live update
correctly unmodified.
This deduplication means live-update of "Unmute topic" just requires
updating the `in:home` filter logic appropriately, without any special
live update work.
Created a new function choose_topics that loops through the topics
and push filtered topics using should_show_topic function to items
array if not zoomed else just push all topics directly to array.
If stream is muted and not zoomed call the choose_topics function
twice, first with passing unmuted_topics and second time with passing
remaining topics. else, call it only once with topic_names.
Fixes part of #24243
When user marks messages as unread, we used to rerender them but
that was not required since we only need to add `unread` class
to their `message_row` to achieve the same effect.