Show user card popover for scheduled messages overlay, compose box
preview, message edit preview, message edit history.
`.messagebox` was chosen as the selector since that was the nearest
parent class that was common for all of the above.
`@all` does not have a popover and that's why it will have the same
pointer as its parent element. We also introduce a new class called
`.user-mention-all` for managing css rules specific to that mention.
We introduce `has_message_context` as an additional argument to
`toggle_user_card_popover_for_message`. `has_message_context` is set to
false for all messages that have not been sent yet i.e. drafts and in
the future commits: scheduled messages, compose box, edit message box.
It would be good to have defined the event listener in
`user_card_popover.js` to keep everything in one place, but since direct
event handlers were getting invoked before delegated event handlers, we
had to define direct event handlers in the launch function of drafts
overlay ui.
This was introduced in 3c7e470cfb, and
since the comment said it should never happen, it felt safe enough to
remove.
The `message` argument has also been replaced with `sender_id` since
that is the only property we need from the message now. This will
become useful in adding support for these popovers to compose box where
the message object will not be present but there would be a sender_id.
The 'tutorial_status' field on 'UserProfile' model is
no longer used to show onboarding tutorial.
This commit removes the 'tutorial_status' field,
'POST users/me/tutorial_status' endpoint, and
'needs_tutorial' parameter in 'page_params'.
Fixes part of zulip#30043.
We plan to remove the 'tutorial_status' field from UserProfile
table as it is no longer used to show tutorial.
The field is also used to narrow a new user in DM with
welcome bot on the first load.
This prep commit updates the logic to use a new OnboardingStep
for the narrowing behaviour on the first load. This will help
in removing the 'tutorial_status' field.
In our web client code we use email as the operand for
'dm' operator. Later user_ids_array is set as operand
in 'handle_operators_supporting_id_based_api' before
making the API call.
Earlier, using user_id as the operand was resulting in
the following error during user signup:
data=b'{"result":"error","msg":"Invalid narrow[0]: Value error,
operand is missing","code":"BAD_REQUEST"}
This commit replaces user_id with email as operand.
This commit changes some event handlers to pass in relevant
JQuery objects instead of using `e.target`. This will be
necessary for converting message_edit to typescript.
`message_edit_topic_propagate` is only used in the template for
moving messages, separate from the message edit template, and
`message_edit_topic` doesn't show up anywhere anymore. Editing
the topic of a message used to be part of the message edit file,
and was removed in 0fc19732bc (diff-c68d68d71e21a4d22f39212a43e4f66ecc774bd17109963fe017d9878aace9bf)
In an earlier refactor, `removePill` was being called with the exit
button element instead of the pill. This change fixes that bug by
using similar code to what we previously did (and still do in
input_pill for cases without on_pill_exit).
This commit extracts the "waiting_for_id" and "waiting_for_ack"
data structures of "echo.js" into a separate module in "echo_state".
This is a preparatory commit so as to be able to use them for
"stream_topic_history" module, without causing import cycles.
This replaces a :disabled selector with individual ones for each
element type; I verified in CSS selector profiling that this change
removes lines that were previously about 10% of profiled CSS selector
processing time for rendering the combined feed.
The reason being that the rendered elements have very few disable-able
elements, but the browser was spending a lot of time trying to match
**every** element for whether it might have been disabled, which was
slow.
This probably reflects a browser bug.
This commit updates the stale logic in 'toggle_topic_visibility_policy'
function. It was not updated after the addition of 'follow' visibility
policy resulting in buggy behavior.
Earlier, 'Shift + M' hotkey was working in unsubscribed channels.
This commit updates the logic to make it non-functional. This
helps to keep the UI consistent as we don't offer a way to
change visibility_policy in unsubscribed channels via
recipient_bar_controls or other UI elements.
Note: We don't implement this restriction in server because
we don't delete the user-topic states in db when a channel is
unsubscribed as it helps to retain those states when re-subscribed.
And implementing this restriction at server level can create
a confusion of why such states exists in db when API doesn't allow.
Even though the border-color was set for `#subscriptions_overlay
.subsection-parent div`, since the border-style was not set. It did not
have any effect on the appearance of the children div of
.subsection-parent.
These were added in ae7fe85ec5, and
should have been deleted in 333b8b095c.
Having those rules did not make any difference to the subscription and
user group list items.
Having the `div` selector there affects the performance. See
https://chat.zulip.org/#narrow/stream/6-frontend/topic/CSS.20selector.20performance/near/1845719
for more details.
We've introduced a new class called `.client-logos-div`.
In `hello.ts` we just manually append the name of this new class for the
logo changing logic since that felt more readable than adding the class
programmatically.
What was happening:
* Focus being in the search input text box made Up/Down be handled
by the browser and move the cursor. This is default browser behavior,
and not useful to us (you can use home/end for the same goal, but
also one just doesn't put much text in that input given the pills
system).
* We probably don't want to push keyboard focus out of the search box
after completing a search, since that would make it annoying to type
a new search term or whatnot.
The fix is to just make the existing Up/Down keyboard handler apply
even if the search input is focused.
More context here:
https://chat.zulip.org/#narrow/stream/9-issues/topic/Can't.20navigate.20search.20results.20using.20the.20keyboard.20.2331291/near/1913535
The class was named `typeahead-option-label` for the element containing
the actual option label. We renamed it to
`typeahead-option-label-container` to give it a more appropriate name.
Zopfli[^1] performs very good, but time-intensive, zlib compression.
It is hence only suitable for pre-compressing objects, not on-the-fly
compression.
Use a webpack plugin to write pre-compressed versions of JS and CSS
assets using Zopfli, and configure nginx to serve those assets when
`Accept-Encoding: gzip` is provided.
This reduces the size of the JS and CSS assets on initial pageload
from 1422872 bytes to 1108267 bytes, or about a 22% savings.
[^1]: https://github.com/google/zopfli
This parameter is unused for Zulip avatars, and results in a smaller
(pixel-wise) Gravatar than we use for Zulip "small" avatars. Omitting
the `s=50` parameter results in a 80x80 image, which is closer to the
100x100 image that Zulip thumbnails avatars to. Ironically, using the
default (larger) Gravatar dimensions also results in _smaller_
responses (in bytes) from Gravatar.
We are using `.val` to set compose box content which is very fast vs
`setFieldText` which is very slow due to it doing a lot of
forced repaints. The major downside of using `val` here is that
user will not able to perform `undo` operation on this which doesn't
seem something user would want to do here.
Note that this effects compose content restored from drafts,
scheduled messages and on reload.
Previously no message was being shown in the group popover,
when group had no members, this commit intends to fix this
by displaying an approriate message when group is empty.
Fixes#30830.
Note that the link in zulip_update_announcements.py is not updated
so that the content in the source code reflects what users actually
received in the update announcement message.
To enhance the readability and operand handling of the
get_custom_profile_field_data function in user_profile, avoid the
unnecessary passing of objects inget_external_account_link.
Instead, pass only the required field_data and value.
Also remove the unnecessary field_type key stored in profile_field in
get_custom_profile_field_data data function.
On clicking the "Edit your profile" option in the user popover,
profile section is opened directly for narrow screens as well
instead of just showing the left panel list of sections.
For narrow screens, we only show left side panel list on
opening the overlay. Previously, we showed the right section
if the overlay was closed with a right-side section opened.
Currently if the settings overlay is opened on narrow screen,
where only left side panels are shown, and then the screen
width is increased, the right side shows "Profile" and
"Account and privacy" sections of personal settings together
everytime.
This fixes it to show the last opened section or the first
section or the section used in url.
Have one inbox row and focus on it. Mark the message as read in
another tab. Press `r` in the first tab will return an error as
the row_focus didn't change but there is no present. So, we
fix it by updating the row_focus if it can get out of bounds
when updating inbox view.
This commit refactors the common function used for test in
such a way that we can test more cases for a group setting
along with the ones tested by the common function.
This commit is part of a bigger project to remove custom logic in
the input_pill module. This commit move us away from a world where
we have a `display_value` that's used as identifying information
for a pill as well as for what we display to the user. Now individual
widgets can configure how they come up with a display value based
on the data of that type of pill.
Note: The change in the stream pill test for setting subscribers
for denmark is fixing an issue that wasn't discoverable before.
There always should have been three subscribers.
We no longer need to do `robust_url_decode` because we're
creating the display value ourselves, whereas previously
we were using `Filter.unparse` which does encoding.
By using a custom `generate_pill_html`, we can remove the
`has_stream` logic in `input_pill`, as part of a wider effort
to remove custom pill logic in `input_pill`.
This is part of a larger effort to refactor input_pill to
remove custom logic and move it into relevant modules.
This commit completely removes group_id from all modules, but
there's another module that uses stream that must be refactored
before that can be removed from input_pill.
This is part of a larger project to move custom
logic out of input_pill. The `generate_pill_html`
function will be used for other modules in upcoming
commits.
This keeps colors uniform between edit and preview modes, and also
ensures no bleedthrough of the editor when in preview mode.
ID selectors have been used for those colors to both keep the text
color declaration in the same place, and to avoid a dark-theme
specificity problem where the generic textarea took precedence over
the colors specified on the compose box's own textarea.
Function `message_helper.process_new_message` takes a
`RawMessage` and throws out `Message`. But here we are
passing it an already processed msg of type `Message`.
This is completely type unsafe. Since our purpose here is to
replace our old message object with a latest copy from
`message_store`.
We can do this directly without calling `process_new_message`.
With the refactoring of the rendered-Markdown area to use only
margin bottom, including in message-edit previewsk, these expensive,
general selectors are unnecessary.
Headings and horizontal rules, which do have margin-top, are zeroed
out elsewhere in the rendered-markdown file.
Because the compose-box resize logic is tied to the size of the
textarea, it's possible when resizing in preview mode that the
state of the compose box is not properly tracked. That's because
the height logic in `autosize_message_content` assumes a visible
textarea.
However, because both the textarea and the message preview area
occupy the same named grid area (`message-content`), and because
the preview area comes after the textarea in the DOM, when visible,
the preview area will automatically cover (and be sized to) the
textarea. And because the textarea remains observable in the DOM,
the compose box will obey the same expansion logic in preview mode
as it does in edit mode.
This check been present since
466beef6fe, but it seems unnecessary in
that the main logic handles there being 0 channels just fine, that's a
rare case (so not a useful optimization), and importantly, not calling
stream_list_sort.sort_groups for that transition resulted in
`stream_list_sort` having stale data structures, resulting in
exceptions if one tried to open the CHANNELS filter widget in the
newly-no-channels state.
When the caret in textarea is around the right end of the screen,
typeahead can overflow the window. To fix it, we use tippy's
mechanism to keep the tooltip inside the visible boundary.
Scroll to bottom button is visible for a few ms when switching
narrow to Inbox / Recent view while scrolling in message feed.
While we can end the transition faster to completely avoid the issue
for now but this seems like a more permanent and simpler fix
than to fiddle with CSS.
Using the existing tooltip template for the other "add emoji reaction"
element in message_controls results in the keyboard shortcut being
shown and avoids doing work to translate the string for every single
message containing emoji reactions.
Here we want to rerender the current narrow after receiving an
event which moves messages. We have mechanisms to keep using
the cached list if we are narrowing to the same narrow which
we want to avoid in this case.
This reworks canonical_url_of_media to work with HTMLMediaElement,
making it possible to do cross-browser inspection of media sources.
(Firefox and Chrome disagree on whether to return the "href"
attribute as the path in the source, or a full URL).
Additionally, we ensure non-empty cache keys on media so
unexpected results from the DOM do not get cached.
Co-Authored-By: Alex Vandiver <alexmv@zulip.com>
Co-Authored-By: roanster007 <rohan.gudimetla07@gmail.com>
Using different punctuation for the aria-label from the tooltip is
silly. Additionally, we don't need to repeat the channel name in
aria-label; it essentially will never be seen and the message list
copy of getting the channel name was buggy.
Tested by deleting a DM and navigating to recent view. No error
is thrown and dm row is correctly placed.
Co-authored-by: Tim Abbott <tabbott@zulip.com>
Earlier tooltip info for the default topic menu notification option
had static string to display.
This commit changes the string info and includes channel name and its
corresponding privacy icon to display in the tooltip.
Earlier tooltips for topic menu button had inconsistent context with
that of other tooltips. In topic menu tooltip, action was described in
first line which different from that of other tooltips.
This commit changes the tooltip context and rearranges them to match
the format of action on first line and more context on second line.
Using "*" selector is inefficient as they require checking every
element because of the browser's bottom-up matching process.
This commit instead updates the selector to use individual
classes for elements to apply the CSS rules keeping in mind
to use unique class names instead of general class names.
Earlier, the `Add Channel` button was being focused even after the
modal was open, causing multiple modals to open on pressing enter
repeatedly.
This commit fixes the issue by removing the focus from the `Add
Channel` button after the modal is open by focusing the dropdown on the
modal.
Earlier the focus remained on the button to open the modal,
causing multiple modals to open on pressing enter repeatedly.
This commit fixes the issue by removing the focus from the button
by focusing on the first input field of the modal.
When moving message while compose box has content, stream was not
updated to the new stream if it was changed.
Tested by moving message with stream changed and with / without topic
changed.
This commit makes pasting formatted text a two-step process:
- Insert unformatted text
- Insert formatting
This way, undo (Ctrl+Z) will restore the original pre-formatting
syntax.
This is the same as the approach taken with
auto-formatting in #29302.
Fixes#31061
This commit fixes the overflowing issue for long bot owner names in the
user card popover, and also repositions the bot owner user card popover
to align with the bot owner name on the bot user card popover.
The `.popover-menu-user-avatar` selector being used to replace the small
avatar with the medium avatar was a broad selector, which also targeted
the bot's avatar when the bot owner's user card was opened. This commit
fixes this bug by scoping the selector to the current popover instance.
This CSS was needed when there was label along with the buttons
on the same line when this was originally added in 626c5ef55e.
But there is no label with the buttons now, so this CSS is not
needed.
I'm not aware of us using any of these; we don't generate the class
names involved, and we're not using `uppy.use` on any of their UI
components.
I confirmed that the only use of an Uppy UI component was the progress
bar, which was stopped using in
b01ac3623f.
We previously did not allow users to deactivate themselves from users
list to avoid users deactivating themselves accidentally. But we now
show a confirmation modal before deactivating, so it is fine to allow
it.
When the user card is displayed via right sidebar, the reference
can be lost due to it being updated or hidden on window resize.
To fix it, we show user card as an overlay when we cannot find
the reference.
Another solution would have been to relocate the reference and
update it for the popover but that is not naturally supported by
tippy once the popover has been displayed.
As a follow-up to the commit f124ef931, which deals with the keyboard
focus when opened via the keyboard shortcut `U`, this commit ensures
that when the user card is opened via the mouse, and the first
navigational key is pressed, the focus is on the first menu option
instead of the other tabbable elements which can be distracting.
Previously, clicking on "view user profile" in the user card popover
would open up the profile as an overlay, changing the hash, and
closing other already opened overlays when opened.
This commit would modify it to behave as a modal rather when
an overlay is already open in the background, thus preventing
the hash change, and allowing the background overlays to exist
when it is opened.
Fixes#30481
This commit updates the color of the text items in the user card popover
which are mostly user related information, to use the new Zulip color
palette.
This increases the contrast of the custom profile fields and other user
related information such as the user's local time and status text to
improve readability.
Fixes part of #31027.
The postcss-color-mix-function plugin does not support var() color
arguments since those cannot be dynamically resolved. This commit
replaces all var() color arguments with their static hsl() equivalent
values to ensure that color-mix() functions are successfully compiled
to rgb() for browser compatibility.
Fixes#30851.
Since there can be multiple messages being edited at once, with a
possibility for them to be out of the DOM, we use
compose_state.get_last_focused_compose_type_input to determine which
message edit to toggle the preview mode on.
We keep the compose box preview toggle behaviour more or less the same,
where we do not check whether the compose box was last focused or not if
there are no eligible message edit boxes and the compose box is open.
This behaviour works well for compose box since there's always one
possible compose box at a time compared to multiple message edit boxes.
One thing to note behaviour wise is that if you have 1 message edit
box open and you shift the focus to compose box, and then close the
compose box, `Alt + P` will not work until the focus is brought back again to
the message edit box.
We want to able to use the clear_preview_area in other places than
click_handlers and that's why it has been moved to message_edit.js.
The name was chosen to be consistent with a similar function in
compose.js.
We want to use render_and_show_preview in message_edit, but that will
cause a dependency cycle because of message_events. In order to avoid
the dependency cycle, the function has been moved to compose_ui and
relevant types have been added.
This commit does not audit the existing function for improvements, just
moves it around and adds types.
The `msg` and `result` are same as the other files (e.g.
activity.test.js) with success responses.
This adds the `LONG_HOVER_DELAY` delay to the user card tooltips, which
prevent the tooltips from becoming distracting when the user is just
navigating the popover.
When the user card is opened via the keyboard shortcut `U`, the initial
focus should be on the first popover menu option, rather than the copy
buttons or the custom profile field links which can be distracting due
to the presence of tooltips on them.
Fixes part of #31027.
Changing the button text of one-time modals to introduce the recent and
inbox view to say "Got it" rather than "Continue" helps reinforce the
vocabulary we're using "Got it" = dismiss one-time content forever.
The previous logic did not properly account for the fact that in muted
channels, unmuted/followed topics are sorted above normal topics.
Rather than trying to reproduce that logic, we just call the function
for computing the topics in the left sidebar, and pull off the top
topic.
Earlier the focus was not being set to the modal when it was opened.
This was because `is_in_focus` checks if `modals.any_active` which
checks `$(".micromodal").hasClass("modal--open")`.
But when `is_in_focus` is called
`$(".micromodal").hasClass("modal--opening")`.
This commit fixes the issue by creating a function
`is_active_or_animating` which checks if the modal has the class
`modal--open` or `modal--opening`.
Earlier, when the user deactivation modal was open, the focus was not
set on the modal. This commit fixes that by setting
`focus_submit_on_open` to `true` in the modal options.
Previously animated images were automatically played in the
message feed of the web app.
Now that we have still thumbnails available for them, we can add a new
personal setting, "web_animate_image_previews", which controls how the
animated images would be played in the web app message feed -- always
played, on hover, or only in the image viewer.
Fixes#31016.
This commit increases right padding for the th elements in recent
views table to make sure that the sorting arrow is visible correctly
for various screen width and font sizes. This change is similar to
what we did for tables in settings UI.
There was a bug when stream_id field was being passed as NaN when user
tried to edit topic of a message if the user did not had permission
to edit the channel.
This commit fixes it to not pass stream_id field in such cases because
channel cannot be changed.
Fixes#30992.
When a user changed an email, we updated the compose and narrow state
before updating that person's email in `people_dict`. This raised a
warning in `get_direct_message_permission_hints` when using
`emails_strings_to_user_ids_string` since that person's email wasn't
updated in `people_dict` by then.
We just changed the order of update so that the email is updated in
`people_dict` before we update compose and narrow state.
After navigating to a `near` narrow, user is likely to press back
to go back to previous selected message. To support this, we have
to select `then_select_id` without rerender, if we can.
Tested by using breakpoints with `near` links to check if the
correct code is being executed.
This moves the cache key for parse_media_data to being the "canonical"
image URL, not the displayed `img src`. We may not even have the `img
src`, if the thumbnail has not yet been generated.
We use different text for guest users, specifying that they can
only search in channels they can view.
The issue description suggests the same for spectators, but
we already use different text for them.
The search-operators help overlay is also updated with the same.
Fixes#30902
When rendering a spoiler block that includes a datetime format,
the dropdown button was pushed out of view on smaller devices.
This happened because the time tag was overflowing past
the spoiler blocks width.
This commit intends to fix this problem by adding a `white-space`
attribute to the rendered time tags which will stop it from
overflowing.
Fixes#30641.
We now set max-width on the pill value for stream creator pill
to make sure that the pill does not get too long for long names
and the full name can anyways be seen by clicking on the pill.
Previously, if you typed "channel: rome" you'd see a result for
both channel "rome" and a second one for "Rome". This commit
deduplicates that by comparing for duplicates without case
sensitivity.
Note that if you fully type "channel: rome" you'll see the
result with a lowercase R instead of uppercase. It would
be a bit involved to change this, so I'm leaving that as
something to address in the future.
This commit removes the popover from the "+" button shown in the closed
compose UI at mobile widths, and instead performs compose actions
directly on-click. The "+" button now opens the compose box with the
channel picker open (even if the user is in a topic or channel view).
This reduces the number of clicks required to start a new message from
the closed compose UI in mobile views, and makes the behavior more
consistent across all the views.
Fixes#30634.
The `update_new_direct_message_button` function sets the text for the
new DM button to "New direct message" on every update cycle, which makes
no difference since the button starts with that text and never changes.
This adds the "New direct message" button back in the closed compose UI
for DMs view, to make the closed compose UI consistent across the app.
Since the closed compose UI is always visible, and one that is likely
to be used frequently, it makes sense to have the same UI across all
the views to avoid the mental overhead of figuring out how to compose
a message in different views.
This keeps the first item focused when user uses keyboard.
User can still move the focused item using mouse and click to select it.
Highlighting an item via mouse and then pressing enter would select
the highlighted item.
We change the code to update the visibility of information
density setting inputs only on successful completion of
request and not on receiving events.
Visibility of inputs is not being live updated on receiving
events because that leads to flashing of inputs when deselecting
the "Compact mode" checkbox due to the data being sent in
different events and data with the client being different for
time till the all events are received.
Bug:
A tooltip appears on hovering over a control button in the
message edit form. Now when the form was closed either using
Esc key (cancel) or Enter / Ctrl + Enter (save), the tooltip
didn't disappear. This resulted in a random tooltip visible
in the message list view.
Fix:
Since tippyjs doesn't hide tooltip even after the element is
hidden we need to explicitly hide the tooltip in those cases.
See https://github.com/atomiks/tippyjs/issues/938
This commit fixes the above mentioned bug by explicitly hiding
the tooltip instance.
Earlier the `generate integration url` button (fa-link) was still in
focus even after opening the modal.
This caused the modal to open multiple times when the user pressed the
enter key. This commit fixes that issue by focusing on the input
dropdown when the modal is opened.
Earlier the `Add a new emoji` button was still in focus even
after opening the modal. This caused the modal to open multiple times
when the user pressed the enter key. This commit fixes that issue by
focusing on the input field when the modal is opened.
Earlier the `edit` button was still in focus even after opening the
modal. This caused the modal to open multiple times when the user
pressed the enter key. This commit fixes that issue by placing the
carat at the end of the first input field when the modal is opened.
Earlier the `change your password` button was still in focus even
after opening the modal. This caused the modal to open multiple times
when the user pressed the enter key. This commit fixes that issue by
focusing on the input field when the modal is opened.
Fixes#30918.
This commit also adds a paper plane icon under `send-dm.svg`. `dm` is
used instead of `direct-message` to opt for brevity when using the
icons.
Fixes part of #30918.
We don't need `align-self: baseline;` for `fa-envelope` set in
`message_view_header` since this is a different icon and it appears
better without it like other icons.
We also don't need the explicit font-size for switching b/w 14px and
16px mode since `zulip-icon` class takes care of that by default.
This commit updates the banner text in the case of message sent
while in search view to match the narrow_to_recipient_banner text
displayed in other cases.
Earlier, on sending a message while narrowed to a search view
'!can_apply_locally()' resulted in error during local echo.
Reason:
In 'insert_new_messages' the call to 'maybe_add_narrowed_messages'
needs message ID to make a GET request to '/messages/matches_narrow',
but during local echo message ID is not available. We were using
'local_id' (a float) resulting in 400 error response.
Fix:
This commit fixes the bug by skipping the discussed GET request
during local echo.
Earlier, on sending a new message in a search view it didn't
appear in that view for the sender.
This was because the message event received by the sender
was processed by 'msg_list.view.rerender_messages' which
effectively did nothing because the message is not
rendered in the first place during local echo in that
message list view.
We can't determine locally if the message should be added
to the search narrow. So, we use maybe_add_narrowed_messages
when narrowed to such views.
This fixes the bug and the message appears in the search view.