It is better to have stream dropdown option value, which is the ID
of the stream, to be of "number" type.
This fixes the assertion error which occurred when someone tried to
subscribe the user to a stream from user profile modal.
This commit updates code to live update the groups UI if
realm or group level setting to manage groups is changed.
This commit also does some refactoring to better organize the
code in different functions.
And also, the code to hide/disable the UI if the user does not
have permission to manage the group in JS such that the same code
is used for live-updating as well.
This commit fixes the live update of subscribers list
on changing can_remove_subscribers_group setting.
Previously, whole members panel, including the pill container
to add subscriebrs, is re-rendered. But the click and input
handlers for the add subscribers UI is not added again after
re-rendering and thus they do not work.
This commit updates the code to just re-render the subscribers
list which is only needed to update the "Unsubscribe" button.
This allows log in button in navbar for spectators to have more space
to be displayed in different languages without being truncated.
Login page already has 2 buttons for user to sign up from.
Preivously, the tooltip was shown only for first element
since initialize_disable_btn_hint_popover only added the
tooltip to first element. And then after d9f25d01a1, there
was an error shown as initialize_disable_btn_hint_popover
asserted that only single element list was passed.
This commit fixes it by calling initialize_disable_btn_hint_popover
for each setting element. Similarly the code to destroy the
tooltip on enabling the setting elements is called for each
element.
Reset event handlers attached to the dropdown widget and by removing
it from DOM.
User is unlikely to use the same dropdown multiple times, even if
they do, the operation is fast.
In the Zulip Cloud support view, adds a "Realm management" section
for support actions that are specific to that view, (e.g., changing
an organization's type or deactivating an organization).
Moves the note about emailing organization owners when a full
sponsorship is approved for Zulip Cloud Standard to the success
message for that action, which mirrors the remote server/realm
support view.
Earlier there was only a realm level setting for configuring
who can edit user groups. A new group level setting is also added
for configuring who can manage that particular group.
Now, a user group can be edited by a user if it is allowed from
realm level setting or group level setting.
This commit make changes in frontend to also use group level setting
in determining whether a group can be edited by user or not and disables
changing the group settings when group cannot be edited by user.
Earlier in frontend there was a single function to determine whether
user can create and edit user groups.
This commit adds a separate function for determining group creation
permissions.
This commit adds a group level setting can_manage_group in
`#groups` overlay. This setting can be set while creating a
new user_group and can be changed for existing groups.
This commit make changes in code to include can_manage_group
field to UserGroup objects passed with response of various endpoints
including "/register" endpoint and also in the group object
send with user group creation event.
There's existing logic that assumes `on_undo` can be `undefined`.
(see the `opts.on_undo === undefined` if clause)
This commit updates some types to let it actually be `undefined`,
which it is in `message_edit`, which we're about to convert to
typescript.
This was inconsistent before, with `message_edit` using JQuery
elements, and `compose_popover` and the definition of
`get_closest_row` using HTMLElements.
Previously, even when a user doesn't have permission to edit
a user group, the dropdown for the group permission settings
was not disabled, and is possible for a user to change the values.
This commit disables the dropdown of the user group permission
settings, in case user doesn't have permission to edit the settings.
This commit adds a wrapper around the "dropdown_widget" of
"dropdown_widget_label".
This wrapper is primarily added so as to be able to show tippy
tooltips over the dropdowns in case they are disabled, since
we can not assign tippy instances to disabled buttons.
Just verifying that a `message-list` is rendered is not enough to
ensure that we are in the correct narrow. We need to check
if we are narrowed to the correct message list id.
This prevents CI from failing unexpectedly.
Fixes#31345.
We were using `e.target` as the popover element for the person picker
which meant that the popover would either open just beside the user's
image or the user's name text, both of which would cover the close icon.
The popover element is now the entire pill by using `e.currentTarget`.
The message feed can take long enough to render that
users are locked out of clicking things for a second
or so. This has become especially an issue since we
updated the search bar logic to refresh the message
feed as search terms are added to the search bar.
More details on CZO here:
https://chat.zulip.org/#narrow/stream/101-design/topic/search.20narrow.20live.20update
Fixes#31102.
It would be good to have defined the event listener in
`user_group_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.
Show user group 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.
This commit won't work for drafts overlay since drafts has a direct
event listener which receives the event before our delegated event
listener.
This commit also adds an explicit `cursor: pointer` to
`user-group-mention`.
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