This test did extensive mocking and didn't feel like it either fully
tested the module or did a good job of testing the logic; and will
break with the migration to tippy. I think it's better to remove the
test and plan to write a new one testing just
get_user_card_popover_data, the actual interesting part for node tests
of this module.
This commit improves the alert message to clearly state that
"You have at least 50,000 unread messages."
In the other case, i.e., when unread_msgs_count > 500 and the user
hasn't read the messages for more than 2 days, the alert message
states,"You have {unread_msgs_count} unread messages."
Fixes#17469.
Previously, this function was used by other bootstrap popovers, but
such popovers have all been migrated to Tippy.
Hotspots uses some of that machinery but I think doesn't actually use
the Bootstrap popovers system.
It exists to prevent the $(document) click handler from seeing the
event and closing the compose box, but we could also just not close
the compose box.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
When changing name of users, the name was updated corectly
in the "Users", "Deactivated users" and "Bots" list but
it removed the "<a>" element, used to open the user
popover, and instead changed it to plain text.
This commit updates the code to just update the text inside
"<a>" tag so that the popover can still be opened by clicking
on the name.
We refactor the tests to check if a multi word query's result is
correctly highlighted (multi word highlighting fixed in
e2c23b656e).
The test case was already present, but the setup was not correct, and
has been corrected now to safeguard against regression in the future.
This commit adds a dropdown and custom input element to set the
`realm_jitsi_server_url` when the video call provider is Jitsi. This
allows organization administrators to add a custom Jitsi server as the
organization's video call provider.
Fixes#17914.
Co-authored-by: Gaurav Pandey <gauravguitarrocks@gmail.com>
Since `settings_org.update_dependent_subsettings` handles settings whose
value and state depend on other elements and video chat provider settings
is an independent setting moving it out of update_dependent_subsettings.
This test has been flaking for a couple months, and it hasn't felt
worth it for anyone to debug, so we should disable or delete it.
I chose deletion, since I don't think this settings panel is a
high-value place for end-to-end testing.
This does not adjust any of the padding from a float-based era.
It's entirely possible that the status-preview area especially
deserves some further tuning.
With no existing class to reach this selector, this change
introduces a new `.inline-status-emoji` class on the Handlebars
template and in the main Zulip CSS file.
Because of the inline styling in the message sender row, this
specific instance of a status emoji needs to be presented as
an inline flex: that keeps the avatar image layout clean, while
also introducing the `align-self: center` vertical positioning
of the status emoji adjacent the username, which is itself a
bare text node.
This change paves the way to update how actual status emoji are
presented in sidebars, pills, etc., care of flexboxes, which
is previewed here by the inclusion of the `align-self` property.
Previously, the text on the warning banner when the user is not allowed
to direct message is "Direct messages are disabled in this organization.".
While the text on the warning banner when the user is not allowed to
send message to stream is "You do not have permission to post in this
stream". These wording is inconsistent with each other and we should
change it to keep them consistent and aligned with each other.
Fixes: #21896.
After the changes in #25572, users were no longer able to start a direct
message with bots if the organization disabled direct messages. However,
we should allow direct messages to bots regardless of the policy because
it's a useful interface for users to interact with various classes of
bots.
user_ids_string_to_ids_array was also modified to prevent cases where
the split function returned an array of [0] rather than [] when dealing
with a empty id string of "".
Fixes: #21896.
To make the date change in recipient header more smooth, we
update it with throttled scroll event. This can cause some
performance regressions on slow computers during scrolling but
nothing I can notice even with 6x CPU slowdown on Intel i7 on mac.
This is an alternative to #25163 since implementing it seems harder
than expected. The date changing animation cannot be made smooth without
serious structural changes to how messages are rendered.
So that the user can still select and copy text from the body of the
linkifier rows. It might be helpful if we extend this behavior to other
draggable rows, like those for custom profile fields settings.
Fixes#26798
`make_query_highlighter` called `highlight_with_escaping_and_regex`
once for each word in the phrase, due to which only 1 word searches
could be highlighted. For example searching for `two wo` resulted
in no highlighting at all in `two words`.
One call per word in the phrase was also redundant since the called
function can handle a multi word query. So now the entire phrase is
passed to the called function just once.
Earlier mid word parts matching with the search query were also
highlighted (made bold), but since actual matching for showing search
suggestions is based on prefix matching, this highlighting logic is
now made to be in sync with the search suggestions matching logic.
Until now, lists with 3+ digit markers would have their beginnings cut
off to align with 2 digit markers. We fix that by having custom styling
for markers where we align markers only up to 2 digits, and let larger
numbers take up more space pushing the list item content forward as
required to fit the marker. Works for multiline and nested list items too.
The class `search-query` is a bootstrap classname, and using
a name unique from that both lets us rely on bootstrap less
and also not have to override some boostrap styles.
Existing callsites to `close_search_bar_and_open_narrow_description`
already do this filter check, so this is extra and unnecessary.
Doing the check always before calling this function probably
makes more sense given the name of the function sounding like
it always takes action.
Currently the search bar doesn't close when you e.g. click outside
of the search input field. In the new design we do we want the search
bar to close on most blur events. Instead of setting up a new blur
handler, this commit checks if the search bar should be unexpanded
any time the typeahead is hidden (which does usually happen on blur).
This commit adds a function to make it easier to close
the search bar consistently in any siuation where the
typeahead closes, to avoid being in broken middle states.
`focus_first_popover_item` was executed right after the click handler
had asked to open the popover, but before the popover was mounted to
the DOM, causing the popover to not work correctly when opened via
the keyboard.
This API will serve as the primary entry point for the
`user_card_popover` module. It will help to control and check the
state of all the popovers in this module.
We now disable the submit button if no input is changed
in modals used for editing name and descriptions of
stream and user groups. The button is enabled if any
value is changed.
This fixes an issue where the "Change group info" and "Delete group"
buttons would display a tooltip immediately upon closing the modal
opened by clicking on them.
This commit adds code to show the "not-allowed" cursor when hovering over
pill input in "Add members" section if a user is not allowed to add members
to the group like we do for "Add subscribers" section in stream settings.
Previously the "not-allowed" cursor was show only when hovering over "Add"
button.
This commit adds simplebar to user group creation form and makes
it consistent with stream creation form.
This also fixes transparency issue in footer of group creation
form dark theme.
Fixes#24443.
This commit fixes placeholder text in the pill input for user
group members UI in "#groups" overlay to mention members instead
of subscribers. For this we add a new template instead of using
add_subscribers_form.hbs and thus this commit also updates
the class names used in javascript code accordingly.
This commit renames search-container class used in stream and
user group settings overlay to list-toggler-container since
the element does not contain search UI and instead contains
the toggler for "Subscribed" and "All streams" and similarly
for "Your groups" and "All groups".
This commit adds code to show loading spinner on clicking
submit such that modal does not closes before the request
succeeds and error, if any, is shown inside the modal.
And as a result we remove the saving indicator and "Saved"
message which was shown on request completing successfully
but it should be fine as we already have this behavior for
stream settings.
This shifts the 8px of margin to the wrapper, preserving the space
to the right of the + icon, but no longer allowing it to shift the
hover state or trigger the tooltip when clicking actually activates
the search filter.
Fixes#11494 (at least the one fixable part; the rest should be
closed as wontfix)
This causes no visual changes, but it makes the grid definitions
more precise, while also reflecting that only two hover icons are
ever shown at mobile scales.
The use of grid and flexbox precludes the need for padding these
controls. Further, removing the padding corrects a sneaky grid
discrepancy between controls on messages with and without a
sender.
Opening create user group from `+` button on left panel did not
open the create user group form properly on small viewports.
This was due to show_right_section not being called which is
resposible to handle this.
We maintain active_group_id as a module level variable to keep
track of the group that is being edited in the right panel of
the overlay. This variable could store the value of group id for
which settings were open when the groups overlay was open previously.
While this caused no bugs but it was not inline with the idea of
the variable holding id of group for which settings were open
and undefined in case right panel was empty or group creation
form was open.
To make this variable consistent with this idea we reset the
value of this variable while building up the ui for groups
overlay as initially groups overlay is opened with empty right
panel.
Settings DOM for newly created group were unnecessarily appended
in the right panel during live update. This was not needed as
these HTML elements are any way created for the window in which
the group was created and this was extra work for a window that
had groups overlay open but the group was not created in that window.
These changes also solved a minor bug where an extra delete button
appeared after the extra HTML elements were appended in the right
panel.
Groups overlay during initial build up created groups rows for
all the groups in the realm and then based on the section/(active tab)
it updated the list data in the group_list_widget that again caused
repeated removing and rebuilding of several group rows.
We optimize here by initially building the overlay with empty group
list and later on update the group list based on section/(active tab).
Changes in this commit only affect (reduce) the number of DOM
operations we do while showing groups overlay and have no visual
changes.
All groups were listed on the left panel by default, irrespective
of which tab was active.
This caused a mismatched ui where list of groups displayed was not
according to the active tab.
We fix this by redrawing left panel based on active tab.
The display of edit button was not correctly toggled on membership
update events during first render of user group user group settings.
This was due to toggling of display for incorrect html element.
We fix that by toggling display for correct node.
Live update code for user group membership update events did not cover
following updates that are covered in this commit.
* Updating list of groups to be displayed on left panel based on
updated membership and selected tab.
* Updating the presence of checkmark on the group row for which
membership was updated.
Group list data in group_list_widget was not updated correctly,
on user group event as a result the group items shown on the
left panel were some times not according to the filters and selected
tab.
We make changes to appropriately update group list data of
group_list_widget on group add event and show group settings for
newly created group even in cases when the newely created group row
is not present in the left panel due to search filter or tab toggles.
Groups list in group_list_widget data was not propoerly updated
on group remove event as a result the group list on left panel
gave errors during search/(tab switches) redraws.
We earlier used URL for checking if a group was being
edited in the right pane of #groups overlay. This is
hacky in cases where the URL might be changed by the
user by toggling between all-groups and your-groups.
As the information about the group being edited is
reliably maintianed by user_group_settings_ui module
we use that while checking if the group is being edited.
`show_user_group_settings_pane` for user groups ui used made hide()
calls to incorrect panels. This however had no effect on the UI
but affected the readability of code for those functions.
The active group information that was provided by
`user_groups_settings_ui.get_active_data` became
inconsistent as the group list ui on left panel
updated due to tab toggle between Your/All groups
or due to search inputs.
To address this we maintain a module level variable
`active_group_id` that is updated during switches
in the right pane so that information about the
active_group_id is maintained and updated correctly.
We add tabs to make distinction between the groups the user
is a member of and all groups in the realm. This is a preliminary
commit and there would be following immediate follow-ups to this:
* Persisting the active state of selected group in the left panel
as the list updates with search and thorugh tab toggles.
* Updating the display of group in the left panel list on membership
update events.
The tooltip for new user group button (+) icon button on #groups
overlay was not mounted correctly on the target element as a
result its content was not able to render properly.
This mounting problem was due to its sibling element (search bar)
being inserted dynamically after handlebar got rendered.
To address this we append the tooltip element to the body itself
with target as the + button.
We address few of the minor required change mentioned in
https://github.com/zulip/zulip/issues/24443.
* Sort user group list alphabetically by name on left panel.
* Fix actions column items on member list on right panel.
* Add tooltip to trash icon on right panel.
In feature levels 153 and 154, a new value of "partially_completed"
for `result` in a success (HTTP status code 200) was added for two
endpoints that process messages in batches: /api/delete-topic and
/api/mark-all-as-read.
Prior to these changes, `result` was either "success" or "error" for
all responses, which was a useful API invariant to have for clients.
So, here we remove "partially_completed" as a potential value for
"result" in a response. And instead, for the two endpoints noted
above, we return a boolean field "complete" to indicate if the
response successfully deleted/marked as read all the targeted
messages (complete: true) or if only some of the targeted messages
were processed (complete: false).
The "code" field for an error string that was also returned as part
of a partially completed response is removed in these changes as
well.
The web app does not currently use the /api/mark-all-as-read
endpoint, but it does use the /api/delete-topic endpoint, so these
changes update that to check the `complete` boolean instead of the
string value for `result`.
We replace the check icon for "Mark as resolved/unresolved" with
a spinner while the request is still ongoing.
This helps to prevent double-clicking and reduce possible
race conditions.
Fixes#26190.
A spinner is shown when the request is in progress
for inline topic edit.
Earlier, the spinner was not visible in the dark theme.
This commit makes it visible by setting a different fill color
in the dark theme.
This expresses the colors for vdots icons in just three variations,
all as CSS variables. The colors are all derived from the existing
design, and the dots colors in the streams/topics area was used as
as reference. The only visual change here, then, is to the global
filters area, whose vdots were the outliers prior to this change.
The three variations are:
1. hint: for touchscreens where a :hover state is not available
2. visible: for all screens when a parent element is highlighted
3. hover: for when the vdots themselves are hovered
The selectors have been streamlined to use the .sidebar-menu-icon
utility class, and the hover-within-a-hover color on vdots is
expressed more directly, eliminating the need for
selector-specificity busting via !important.
Fixes: #20600
Fixes#26746
There was a bug which caused empty text to not appear after
rerender since tbody didn't have the `required-text` class on
rerenders as it was not part of the handlebars template.
We suggest only the first matching wildcard mention,
irrespective of how many equivalent wildcard mentions match.
This helps to avoid suggesting multiple wildcard mentions at
the same time that do the same thing but have different names.
Fixes#25613.
The deleted CSS around the `.zulip-icon-ellipsis-v-solid` class
has no impact on the hover controls, as flexbox and grid are
handling baseline alignment, not this one-off line-height.
This commit renames all uses of `private_message` in `unread.js` to
`direct_message`. Renamed `private_message_count` to
`direct_message_count` and `right_sidebar_private_message_count` to
`right_sidebar_direct_message_count`.
Created a new set `direct_message_with_mention_count` which stores direct
messages containing mentions. In `new_message_count`, direct messages
with mention were added twice, once by res.mentioned_message_count
and once by res.private_message_count so subtracting intersection of
both `direct_message_with_mention_count` now gives accurate count.
Fixes#25453
This is a follow up to #26728, which disables buttons in preview mode
for any message being edited.
Care is taken to pass the correct preview state (compose vs the message
row being edited) to the popover menu so the buttons in it too can be
disabled as needed.
Inspired by #19821. The original proposal in #19821 got bogged down with
issues around multiple overlapping tooltips, but this seems like a useful step
forward.
By implementing a careful flexbox declaration on a new banner-
element container, this presents banners accessibly across the full
range of possible viewports--and relies only on a single, small
media query to do so.
Fixes: #25847
Co-Authored-By: Hardik Dharmani <Ddharmani99@gmail.com>
Added a show_unread_counts personal user setting to the
Settings > Display settings > Advanced section which
lets user choose whether he/she wants to see unread messages
count on the left sidebar for streams.
This setting have three options,
"All Streams" - This will show unread messages count for all
streams.
"Unmuted Stream" - This will be default option and it will
only show unread messages count for unmuted streams.
"No Stream" - This option will not show unread messages count
on any stream.
Fixes#24149
This is a prep commit for introducing new "Show unread counts for" user
display setting. We should use css classes like `.hide` to hide the unread
count from the DOM as opposed to using `$unread_count_span.hide()` because
this injects inline styles and hence we won't be able to change the `display`
style on hovering for unread counts.
This is a prep commit for the new setting `stream_unreads_display`.
Before when a stream was active i.e. once you are viewing topics in
the stream we had a `active-filter` class applied to the stream `li`
but if we were viewing a topic then the `active-filter` was removed
even though the stream was still expanded.
Added a new class `stream-expanded` which persists even when we are
in a topic view, this is useful for knowing whether a stream is
expanded or not within css.
This commit introduces a new behavior for the search bar. Now, if
the search keyword is 'sender:', it displays the title of the user/me.
for example: sender:me
title: Messages sent by you
sender: Palash
title: Messages sent by Palash
for the implementation, we already have the check for 'dm:', which is
similar to this so just added a new if check for 'sender:' and return
the title accordingly.
Fixes: #18690
Currently, `is_common_narrow` relies on `calc_can_mark_messages_read`
to check a number of filters that are "common narrows" (which means
they have a special message header title and different behavior when
exiting a search view).
Creates a helper function,
`single_term_type_returns_all_messages_of_conversation`, that is
used in both the above functions.
The check for an empty array of term types is unnecessary for
`is_common_narrow` because the "All messages" view has an undefined
filter and the "in-home" term type used in the "zhome" message list
is covered. So that empty array check is not moved to the helper
function, and instead stays only in `calc_can_mark_messages_read`.
The helper function checks for a single term type (except in the case
of topic, which is checked in combination with stream) that will return
all the messages of a conversation.
To ensure consistency in the function, split the combined if
condition of in-home and in-all, further improved the comments, and
deleted the unnecessary ones.
Buttons which change the content in the compose textarea were so far
enabled even in preview mode, and would work, but those changes would
not be reflected in the visible preview. This is extremely confusing,
and can lead to the possibility of a user accidentally changing the
content of the compose textarea while previewing, and sending that.
Now we disable those buttons in preview mode, both when composing a new
message and when editing an existing one. We still show the tooltips,
but grey them out and make them unclickable.
Fixes: #20962
This commit removes the code to initialize
"realm-default-notification-sound-audio" element from
"notifications.initialize", because we do not need this
now as the previous commit added code to initialize it
in "settings_realm_user_settings_default.set_up".
This change works because the realm default notification sound
can only be played from the settings UI and so it is fine to
initialize it only when opening the default user settings panel.
Fixes#25744
By rendering the emojis after initializing the simplebar container,
the rendering time is decreased by ~30% as observed at 6x CPU
cooldown on mac i7.
This naming more accurately reflects the functionality of these types
of functions. They are not only responsible for displaying the
popovers but also for toggling them off.
The intent behind this commit is to tidy up how we handle user info
popovers. The first step is to move everything related to them into
its own module. This commit should not have any functional changes.
This commit aims to extract all logic related to obtaining
notification title from the `process_notification` function into
a separate `get_notification_title` function.
This commit aims to extract all logic related to obtaining
notification key from the `process_notification` function into a
separate `get_notification_key` function.
This commit aims to extract all logic related to debugging the value
of `notification_source` from the `process_notification` function into
a separate `debug_notification_source_value` function.
This commit aims to extract all logic related to obtaining
notification content from the `process_notification` function into a
separate `get_notification_content` function.
Also register these click handlers just on the popover itself directly
in the onMount helper, like we do with all the other popover_menus.js
functions.
stream_popover.is_open() much more accurately describes what this
does, and in particular the fact that the function applies to all
places the stream popover might be.
Commit 61f7ede43c (#25759) introduced a
bug: browser_history tried to access user_settings.default_view at top
level as soon as it was imported, before
user_settings.initialize_user_settings has been called, so
browser_history.state.spectator_old_hash was always initialized to
"#undefined".
Signed-off-by: Anders Kaseorg <anders@zulip.com>
For sorting topics in the left sidebar topics list, the "Followed"
topics are treated the same as "Unmuted" topics.
In a muted stream and not zoomed state:
* followed/unmuted topics at the top.
In an unmuted stream or zoomed state in a muted stream:
* normal recency sorting
The reason is that the "Followed" topics have a tier of interest
above being unmuted, so they shouldn't lie below the "Unmuted" topics
in the list.
This commit adds the follow icon to the right end
(before the three-dot menu icon) of the topic list item
for followed topics.
The icon replaces '@' instead of showing both the '@' and "Follow"
icons in the case of unread mentions, as users don't care if they
are following a topic if they've got unread mentions there.
In a muted stream, the text color of followed topics in the topic list
is set to be similar to that of unmuted topics.
The reason is that the followed topic has a tier of interest above
being unmuted, so it shouldn't stay faded in the topic list.
This commit adds the CSS variable '--color-unmuted-topic-list-item'
for the unmuted topic's color in the topic list.
The color for both the light and dark themes is defined in
'zulip.css' and used in 'left_sidebar.css'.
This approach helps to remove the use of the selector 'unmuted_topic'
only for color definition in 'dark_theme.css'.
We don't have a "Manage user" tab in your own profile, so it would
throw an exception to do the default thing here, and the mechanism for
editing your own settings should be the main "your profile" panel,
which is a bit bigger and more user-friendly.
I'm not totally convinced that the extra logic for not having a
"Manage user" tab is worth it; the alternative of figuring out a
non-confusing label would not be terrible here. But this version is
non-broken, and it'll be easy to change later if we change our mind.
This commit adds Tippy tooltips to the edit pencil button
in the user profile. Now, when a user opens another user's
profile, they will see the tooltip 'Manage user', and when
they open their own user profile, they will see the tooltip
'Edit profile'.
This commit unsets the padding of the bot icon and, as the anchor
tag has been replaced with the i tag, we have also set the color
and pointer. This is done so that when the user hovers over the
icon, it will appear as a clickable button.
This commit moves the bot icon to the left of the name in the user
profile and adds a margin-left and margin-right to the name to ensure
there is enough space between the icon, name, and edit pencil.
This commit redirects the edit pencil in the user profile modal to
the 'manage user' tab whenever a user with permission to manage
other users via the user profile opens another user's profile.
However, we still want to redirect the edit pencil to
'settings/profile' if the user opens their own profile. The user
management permission is granted if the user is an admin or the
owner of the bot. However, we do not want system bots to have
access to the edit pencil or the 'manage user' tab. Therefore,
a new variable called 'can_manage_profile' has been introduced
to manage all these permissions, and the CSS has been updated
accordingly.
To redirect to the manage user tab without opening another modal,
I have extracted the toggler. This toggler will store the
component, and if the edit pencil button is clicked, we can use
the goto function to redirect to a different tab.
Changed the id names of both the edit pencil icons to explain
better of what they do.
This commit increases the gap between the labels and input/select
of the user profile manage user/bot tab for clearer visibility.
It also reduces the gap between the 'deactivate user' button and
the last input to make it look better.
This commit disables the "Deactivate User" button inside the
"manage user" tab in the user profile modal. Additionally, a
tooltip is applied to the button by wrapping it inside a div
with the tooltip applied.
This commit fixes the inconsistent height of the user profile when
switching tabs. We now have four tabs in the user profile:
"Profile," "Streams," "User Groups," and "Manage User." However,
the "Manage User" tab has footer buttons that need to remain
sticky at the bottom without changing the overall height of
the modal.
To achieve this, we wrapped the footer inside a div element and
assigned it a class called "manage-profile-tab-footer." The main
body of the user profile is given a height of 60vh. However, for
the "Manage User" tab, we decreased this height to 52vh and
allocated the remaining 8vh height to the div element to
accommodate the footer buttons. This ensures that the user
profile maintains consistent height when switching between tabs.
However, we have a 1px border in the footer, so to ensure that
the height is consistent, we reduce the height of the modal
content by 1px, making it calc(52vh - 1px).
To implement this, CSS code was added to the "popover.css" file
and accessed through the class specified in the "user_profile.js"
file.
The default padding of the buttons inside footer is 20px, but
with the above solution on large screens the buttons are not
aligned properly, so removed the padding top and bottom
and instead applied the flex box and property to align the buttons.
This commit migrates the "Manage Bot" modal to the user profile modal,
with the same explanation as in the "Manage User" modal commit.
However, in this commit, we changed the permission of the "Manage User"
tab so that non-admin users can also see the "Manage Bot" tab if they
have created the bot. Additionally, since we can't make changes to
system bots, we check if the bot is a system bot and hide the
"Manage Bot" tab accordingly.
Fixes: #21806
This commit migrates the "Manage User" footer buttons to the user
profile modal. We made this change because we don't want the buttons
to scroll with the content; instead, we want them to be sticky at
the bottom at all times. Therefore, we moved the buttons to the user
profile modal.
This commit migrates the "manage user" modal to the "Full Profile"
modal. Refactored the show_edit_user_info_modal function since
earlier, we used to have a separate "Manage User" modal.
Consequently, we checked if we were coming from the
user_info_popover and then built the dialog widget accordingly.
However, with this new change, we no longer need to build the
dialog widget. Therefore, removed that part and now just pass
the container of the 'user profile modal' to get the content.
Previously, for deactivation, we used to have a separate dialog
widget. But now, since we have a dedicated function to handle
this case, refactored the deactivation code to use the
'confirm_deactivation' function.
Additionally, created two new functions to handle the loading
spinner. Since we will need these functions in the future for
the "Manage Bot" modal, we marked them as exported.
"Since we do not want to show the 'Manage User' tab to the user
looking at their own profile, in the 'can_manage_user' function
that we use to render the 'Manage User' tab, we check if the user
profile popover belongs to the same user. If it does, we set it to
'false' instead of 'true,' ensuring that the 'Manage User' tab is
not visible.
Added a new tab in the user profile modal 'manage user'.
Fixes: #21806
Rearranged some code to align with our current patterns and improve
readability. Renamed `show_user_group_info_popover`. No functional
changes in this commit.
This is a preparatory commit before we migrate `user_group_popover`
from Bootstrap to Tippy library.
The previous implementation was weirdly sharing the logic around
`current_message_info_popover_elem` with the user info popovers based
on a message; very likely an unfortunate latent bug caused by
copy/paste.
To address that, we need to add dedicated functions like
get_user_group_popover_items to avoid breaking keyboard navigation
with this extraction.
With the previous commits, we have now implemented the subscribe
widget with a separate heading. However, the font size and the gap
of both the heading of the widget and the streams list look bad,
so this commit fixes that.
Since the heading of both the widget and the list have the same CSS,
instead of duplicating it, we used the same class for both and
reduced the font size.
This commit adds a reset function for the subscribe widget so that
whenever someone subscribes to a stream from the dropdown, after
the subscription, the dropdown will return to its initial state
with no stream selected. Additionally, it will display a label with
the subscribe button disabled and a tooltip.
This commit adds a tippy tooltip to the subscribe button in
the user profile. We show this tooltip only when there is no
stream selected and the button is disabled. However, on any
change, we enable the button and hide the tooltip.
This commit adds a subscription widget to the user profile,
including the logic to prevent non-admin users from seeing the
subscription widget of other users. Additionally, as it is not
possible to subscribe generic bots to streams, and the user should
not be a deactivated user, we check for these conditions before
displaying the subscription widget.
To ensure that the alert for both subscribing and unsubscribing
appears on top of the subscribe widget, changed the location of
the alert to be displayed at the top.
Additionally, considering that no stream will be initially selected,
we have made the decision to disable the subscribe button. Once the
user selects a stream, we will enable the subscribe button
accordingly.
Changed the add_user_ids_to_stream function inside subscriber_api.js
to support self subscribe also, so that we don't have to duplicate the
logic in user_profile.js
Created a separate file for the subscribe widget called
user_profile_subscribe_widget.hbs.
Fixes: #18883
The closest($stream_row) logic is unnecessary, and worth cleaning up
because we'll be adding other calls from places that don't have a
stream row object.
narrow is a term that is intended to only apply to a message feed
view; it comes from "narrowing the set of messages you're looking
at from the All messages" so switching it to something different
makes sense.
Adds a section to the demo organizations help center article about
configuring an email and password for demo organization owners.
For demo organization warning banners about needing to configure
an email, add a link to the new section in the help article.
Also, adds a related articles section to the help center article,
and updates the current draft text for changes in how the demo
organization feature is being implemented.
To reduce extra work for translators, make text for warning banners
and tooltips in demo organizations when the organization owner has
not configured an email address consistent.
Rename existing shortened references to demo organizations, like
`is_demo_org` or `demo-org-warning`, that have been used in the
codebase so far and replace them to be like the `models.py`
variable: `Realm.demo_organization_scheduled_deletion_date`.
The callers of function `upload_widget.build_direct_upload_widget` always
have a defined value for the parameter `max_file_upload_size`, hence we
should just remove the default value for this parameter here.
As stated in the deactivate function comments, it should be called
via `browser_history.go_to_location` so that all the correct
functions are called like recent view being hidden.
This fixes a bug where searching for nothing results in activating
all messages narrow without hiding recent view. Now, all messages
should be activated as expected.
We should avoid adding extra fields directly on the server data because
it makes it hard to infer the types for the functions such as
`format_attachment_data`.
This commit fixes the issue of reordering the stream list when the
user unsubscribes from a stream. The issue was caused because, on
rendering, we sorted the list by name but did not sort it while
updating the stream list on any update.
Earlier, when a message was sent in a followed topic in
a muted stream, a compose banner warning with a suggestion
to UNMUTE the topic for receiving notifications about new messages
was shown.
This commit fixes the incorrect behavior. No warning is shown
in the case mentioned above because a user, in general, already
receives notifications for messages in FOLLOWED topics.
emoji_picker.is_open() much more accurately describes what this does,
and in particular the fact that the function applies to all places the
emoji picker might be.
After this change we add the "reaction_button_visible" class to every
reference element of the emoji popover. There's no need to handle the
user status picker case since the reference element should always be
visible. That's why we're reducing some complexity, even though it
means adding a class to the user status picker reference.
By default, Tippys with the `data-reference-hidden` attribute aren't
displayed. But when we render them as centered overlays on mobile and
use `getReferenceClientRect` for a virtual reference, Tippy slaps this
hidden attribute on our element, making it invisible. We want to
bypass this in scenarios where we're centering popovers on mobile
screens.
The offset modifier is tricky and its calculations is related to the
placement of the popover. So, to prevent inconsistency, we should fix
the placement to some value.
This is important because the "guests" value isn't one that we'd
expect anyone to pick intentionally, and in particular isn't an
available option for the similar/adjacent "email invitations" setting.
This commit initializes the user_group module before right_sidebar
module. This was needed to check whether user is member of user_group
whose members are allowed to create invite links.
This commit rename the existing setting `Who can invite users to this
organization` to `Who can send email invitations to new users` and
also renames all the variables related to this setting that do not
require a change to the API.
This was done for better code readability as a new setting
`Who can create invite links` will be added in future commits.
Earlier option to create new invitations in right_sidebar,
gear_menu and invitations panel does not get live update
when the setting `who can invite others to realm` is changed.
This commit make changes to do live update.
Creates process for demo organization owners to add an email address
and password to their account.
Uses the same flow as changing an email (via user settings) at the
beginning, but then sends a different email template to the user
for the email confirmation process.
We also encourage users to set their full name field in the modal for
adding an email in a demo organization. We disable the submit button
on the form if either input is empty, email or full name.
When the user clicks the 'confirm and set password' button in the
email sent to confirm the email address sent via the form, their
email is updated via confirm_email_change, but the user is redirected
to the reset password page for their account (instead of the page for
confirming an email change has happened).
Once the user successfully sets a password, then they will be
prompted to log in with their newly configured email and password.
Because demo organization owners do not initially have an email
set, some of the personal and organization settings in the web-app
UI should be disabled/hidden until the owner configures an email
address for their account.
Disables the form input elements in the invite user modal if the
user's email is not configured. Also displays a tip at the top of
the modal to let the user know why the form is disabled.
Because demo organization owners do not initially have an email
set, some of the personal and organization settings in the web-app
UI should be disabled/hidden until the owner configures an email
address for their account.
Disables the dropdown for changing the user's email address visibility
in the account & security tab of the personal settings overlay until
the user configures an email address.
Because demo organization owners do not initially have an email
set, some of the personal and organization settings in the web-app
UI should be disabled/hidden until the owner configures an email
address for their account.
Disables configuring organization authentication methods in the
organization settings overlay until the user has configured an email
address. Adds a tip at the top of the authentication methods tab to
indicate why the authentication method checkboxes are disabled.
Because demo organization owners do not initially have an email
set, some of the personal and organization settings in the web-app
UI should be disabled/hidden until the owner configures an email
address for their account.
Disables the show/change API key button in the account & security
tab of the personal settings overlay if the user's email address
is not configured. A tooltip is shown when hovering over the disabled
button explaining why the feature is disabled.
Because demo organization owners do not initially have an email
set, some of the personal and organization settings in the web-app
UI should be disabled/hidden until the owner configures an email
address for their account.
Updates showing the password change field in the account & privacy
tab of the personal settings overlay to check if the user's email
being configured (to cover the demo organization case) and if the
organization has enabled password authorization.
Since an email address is not required to create a demo organization,
we need to disable some parts of the web-app UI until the owner of
the demo organization configures an email address for their account.
Addd `user_email_not_configured` check to `settings_data.ts` so
that we can check in various modules if the user is a demo
organization owner who has not configured an email address yet.
This adds `delivery_email` to `page_params.ts`. Also, adjusts the
`muted_users` in the list of page params so that the list is sorted
alphabetically.
It’s unused since commit eb45925b1a
(#23665), and the entire reminder feature was removed in commit
f40855bad2 (#25318).
Signed-off-by: Anders Kaseorg <anders@zulip.com>
We should reuse the `channel.xhr_error_message` in `ui_report` to reduce
code duplication.
Also, I changed the type of `message` parameter to `string` instead of
`string | null` so that we do not need to alter the types of the functions
that depends on the return value of `xhr_error_message`.
This allows the select to flex, keeping the buttons position on
screen even at mobile-scale viewports.
While other most other controls are currently not so responsive,
this might provide some direction (along with a TODO) on how to
go about moving controls in that direction.
Fixes: #26563
Remove overflow: hidden from the body and overflow: auto from the
.markdown element. Adjust the scroll-margin-top on the heading
elements so that using the hash, the page opens at perfect
location. Add position: fixed to .sidebar so that it does not scroll
with the content.
For the mobile view, change the .sidebar right from 100vw to 100%.
Also change how the hamburger menu changes its position: use right
instead of left as that works better than translate combined with
left.
This commit checks for two edge cases where the paste-URL logic
should not apply:
1. On text selections likely already in or adjacent to Markdown
link syntax
2. Over top of existing links
This improves upon a change introduced in #26279. But rather than
setting an `overflow` value, this uses `minmax()` with a 0 minimum
value--pushing back against the default grid minimum column value
of `auto`. The `auto` value will always try to fit the content
into the grid, even if that means wreaking havoc on the grid as
defined.
This PR implements the audio call feature for Zoom. This is done by explicitly
telling Zoom to create a meeting where the host's video and participants' video
are off by default.
Another key change is that when creating a video call, the host's and
participants' video will be on by default. The old code doesn't specify that
setting, so meetings actually start with video being off. This new behavior has
less work for users to do. They don't have to turn on video when joining a call
advertised as "video call". It still respects users' preferences because they
can still configure their own personal setting that overrides the meeting
defaults.
The Zoom API documentation can be found at
https://developers.zoom.us/docs/api/rest/reference/zoom-api/methods/#operation/meetingCreateFixes#26549.
It is unnecessory to make use of `update_choice_delete_btn` since
we disable the dialog submit button in case no default streams
selected in Org settings > Default streams > Add stream.
This commit is a follow-up to PR: #22903
While editing select type profile field, if we submit empty or zero
choices it fails silently, current implementation for this issue does
not work for some cases, and this commit will fix that.
This will disable dialog submit button in case of empty field choices.
Also removing code of all calls making to `update_choice_delete_btn`
as that function have no more use-case for empty field choices, still
keeping the function because it gets used in `settings_streams.js`.
Co-authored-by: Palash Baderia <palash.baderia@outlook.com>
This commit lets us render popovers centered on the screen with a
background overlay. It's the same thing we did with Bootstrap
popovers, but optimized for use with Tippy.
Instead, we show a message with links that either opens a modal for
creating a new bot or navigates to the bot settings page. The
"add a new bot" link only show up when the user has enough permission
to create new bots, and the "manage your bots" link only shows up when
the user has at least one bot if they don't have the permission to
create one. Otherwise, the message does not show up at all.
Signed-off-by: Zixuan James Li <p359101898@gmail.com>
This commit removes the 'View Edit History' option from the three-dot
menu since we have already implemented this feature through the
edited/moved label in the message. Therefore, we no longer need this
option in the three-dot menu. This commit aims to simplify the
three-dot message menu.
Fixes: #23077
This extraction has been done to make sure that creation of audio call
links can happen in the same function only.
A change in test was also required as the whole logic of finding the
textarea where the link should be inserted happens a bit later now.
The tabular figures in Source Sans 3 place a foot on the 1, and
overall just feel visually a little heavier than their proportional
counterparts.
To compensate for that, this takes advantage of the variable-font
properties of Source Sans 3 to subtly drop the weight to keep the
timestamp readable but not in fierce competition with the message
area.
In commit 640de3ad29, a separate
`page_params.ts` was added for the stats/analytics page, but adding
it to the `web/webpack.assets.json` for "stats" was missed, so we
add that here.
Adds typing notification constants to the response given by
`POST /register`. Until now, these were hardcoded by clients
based on the documentation for implementing typing notifications
in the main endpoint description for `api/set-typing-status`.
This change also reflects updating the web-app frontend code
to use the new constants from the register response.
Co-authored-by: Samuel Kabuya <samuel.mwangikabuya@kibo.school>
Co-authored-by: Wilhelmina Asante <wilhelmina.asante@kibo.school>
Fixes#11767.
Previously multi-character emoji sequences weren't matched in the
emoji regex, so we'd convert the characters to separate images,
breaking the intended display.
This change allows us to match the full emoji sequence, and
therefore show the correct image.
This saves the blue box position as state on the location
in brower history, with `history.replaceState`.
The position is restored when a narrow is activated.
Fixes#20066.
Previously, there was no mechanism in place to replace the data.
Therefore, we had to manually delete the stream row when
unsubscribing. However, with the introduction of this new function,
there is no need for manual deletion. The server events code path
already handles the case when any stream is unsubscribed, so we
can simply remove this code.
This commit introduces a new function named
'update_user_profile_streams_list_for_users'. it will be used
to update the stream_list in the unsubscribed streams section.
Since the list_widget offers a function to replace the data, we
can invoke this function whenever there is a subscription change
in the server_events file or stream_events file.
This commit refactors the 'get_subscribed_streams_for_user' function
to return an object with two keys: one for the subscribed streams
and another for the streams the user can subscribe to. The node
tests have been updated accordingly.
Renamed 'get_subscribed_streams_for_user' to 'get_streams_for_user'.
This commit is a prep commit for implementing the live update of
user profile streams list. Since the code for both adding and
removing peers is the same after adding or removing the peer data,
it is better to extract that code to reduce duplication in a new
function called 'process_subscriber_update'.
In commit 846b470b99, `narrow.by_topic` was missed for getting
the stream name via the stream ID in the message data. Updates
function to get the stream name to pass in the filter terms
to `narrow.activate`.
In that same commit, `narrow.by_recipient` was updated to not
pass the message ID to `then_select_id`. Updates call to
`narrow.activate` to include that opts parameter so that the
selected message doesn't change.
This not only introduces a new gold color that works across light
and dark modes, but it also separates out the hover and focus-
visible styles for stars--regardless of whether a star has been
filled or not.
The :focus-visible selector is more appropriate here, as that
enables browsers to determine whether focus should be displayed
or not. That's generally the case with keyboard-achieved focus,
but pointers and fingers generally do not need focus to be
displayed.
By not displaying a different icon color on simple :focus, this
will also ensure that star icons behave predictably when hovered
or focused via keyboard in both starred and unstarred states.
This corrects for an issue where hover controls would remain
visible after multiple clicks on one of the hover control icons,
despite the mouse pointer leaving the area.
This does not really create a regression for keyboard focus, as
there is currently no reasonable way to get a Tab key into the
hover controls area.
However, if one clicks multiple times on the vdots icon, and uses
Tab to move back and forth, the icons still remain visible--thanks
to the mouse pointer still being in the hover area.
This introduces a new breakpoint. In the future, this kind of
round-about sizing will be made unncessary by container queries,
but while those ship in all modern browsers, their availability
is quite recent:
https://developer.mozilla.org/en-US/docs/Web/CSS/@container
This should cause no functional changes.
This is part of a multi-step effort to move away
from using stream names to reference streams, now
that it's impossible for a user to write a message
with an invalid stream name (since switching to
the dropdown).
This should cause no functional changes.
This is part of a multi-step effort to move away
from using stream names to reference streams, now
that it's impossible for a user to write a message
with an invalid stream name (since switching to
the dropdown).
This commit updates the admin custom profile fields table to be
similar to other tables in settings page. After this change,
the table will be horizontally scrollable for narrow screens
and the buttons in actions column will not wrap to multiple lines.
This increases the width of "Actions" column and it takes some
unnecessary space, but this will be handled in the next commit
which will adjust "Actions" column in all the tables.
The bottom border of heading row in striped (and not bordered)
tables was thicker than needed due to two borders being present -
one from the bottom border for heading element and one from top
border for the first row in the table.
This commit changes the CSS to remove the top border of the first
row.
The table-condensed class was used by bootstrap to add padding
to the table cells. But since we want padding in cells for all
tables, we added the padding CSS to the other existing CSS for
tables while removing the bootstrap CSS for tables and
"table-condensed" is not required anymore.
This commit removes unnecessary CSS defined for tables using
table-condensed class.
The vertical-align property for "td" elements is not needed
since by default the vertical-align property for "td" elements
is inherited and is set to "middle".
The margin properties set for the tables in informational
overlay is also not needed since we have set the width
to 100% and setting the margin to auto does not result in
anything different.
The API and user documentation pages gain nothing from being a single
page application other than a bunch of random errors.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This effectively reverts a change introduced in #26260 that used
the original message to maintain the basline grid. With more
robust control over first-row line-heights, it is now safe to
fullyl hide the message again.
This also fixes a regression where messages with images would have
additional whitespace beneath the message edit box; see
https://chat.zulip.org/#narrow/stream/6-frontend/topic/message.20edit.20form.20height/near/1621758
This is functionally the same, but semantically more relevant.
It will also be helpful if some day in the future these two
function calls are no longer perfect opposites of each other.
This commit replaces the mute/unmute topic button in the recent
conversations UI with a button that allows the user to set the
visibility_policy of the topic to muted, unmuted, followed or inherit.
The button in the recent conversations UI has an icon corresponding to
the current visibility policy of the topic.
In a muted stream:
A click on the button opens a popover with 'Mute', 'Default', 'Unmute,
and 'Follow' options.
In a not muted stream:
A click on the button opens a popover with 'Mute', 'Default', and
'Follow' option. 'Unmute' option is available only when the
visibility_policy is set to 'Unmute'.
The current visibility_policy of the topic is highlighted
in the popover.
Fixes#25915.
This commit replaces the mute/unmute topic button in the message
header bar with a button that allows the user to set the
visibility_policy of the topic to muted, unmuted, followed or inherit.
The button in the message header bar has an icon corresponding to the
current visibility policy of the topic.
In a muted stream:
A click on the button opens a popover with 'Mute', 'Default', 'Unmute',
and 'Follow' options.
In a not muted stream:
A click on the button opens a popover with 'Mute', 'Default', and
'Follow' options. 'Unmute' option is available only when the
visibility_policy is set to 'Unmute'.
The current visibility_policy of the topic is highlighted in the
popover.
While `user_id` from `page_params` is marked as `number | undefined`,
when fuctions in this file are called, `page_params.user_id` will
never be undefined. Verifying from all of callers of
`initialize_with_current_user`, this is because when user is able
to create and initialize a stream, this user is authenticated and
thus a `user_id` is always available. Therefore, adding an assertion
when undefined user id is detected to handle a confirmed error.
`get_users_from_ids` is a function that map an array of user ids to
`User` object. According to `get_by_user_id` for mapping, every
id should be mapped to a valid `User` object. Thus removed
`undefined` annotation in this commit.
Add primitive types and promise types to variables, function
parameters and return values.
Apply type conversion functions to some objects so that the type
unification afterwards will succeed, such as converting int to
string.
Add custom types that for helper methods.
Add non-null assertions for trivial statements from code base context.
Second parameter (boolean) is not supported by the function definition
in the scope. Removed in this commit.
Previous commit that made this happen:
fa9d79e203
Added one line comment for each `populate_*` methods specifying the
corresponding component that the method rendering for on the webpage.
Comments make the cross-checking experience easier.
While Zulip has supported drag/drop into the compose box for some
time, if you drag/drop the file onto other parts of the message
viewport, it would just do the default browswer behavior of replacing
the Zulip app with that file opened in a new tab, which nobody wants.
The inline comments document the set of rules for how we choose
whether to drop the upload into the compose box or an edit widget, and
also how to open the compose box in different situations.
Fixes#14579.
If the owner of the bot is deactivated while reactivating the bot,
we mention in the reactivation modal that the bot owner will be
changed and the bot may be unsubscribed from some private streams.
The box-shadows cuts off on left and overlaps with button on right.
We instead change background-color in dark theme and border color in
white theme to show focus.
In Safari (and Google's crawler), this would throw an exception trying
to create a jquery element for certain unusual hashes like
`#:~:text=something`.
Fixes#26249.
This commit properly displays Tippy Copied! alerts in two cases:
1) On the clipboard icon when copying message source.
2) On the hover controls when copying the link to a message.
Fixes#21036.
Previously, the reason to complete the organization profile on the banner
wasn't clear and at times confusing. With the updated wording, it clears
up the confusion and improves the explaination of "why" as well.
Fixes: #24122.
Currently, we are displaying the "Complete the organization profile"
banner immediately after the organization was created. It's important to
strongly encourage orgs to configure their profile, so we should delay
showing the banner if the profile has not been configured after 15 days.
Thus also allows the users to check out Zulip and see how it works before
configuring the organization settings.
Fixes: #24122.
The 'Unmute' option is available in not-muted streams only when
it is the current value.
Add a 'Default' option. Available in both muted and not-muted
streams. 'Default' corresponds to the 'INHERIT' visibility policy.
Summary:
* In muted streams:
Four options: Mute, Default, Unmute, and Follow.
* In not-muted streams:
Three options: Mute, Default, and Follow.
The fourth option, 'Unmute' is available only when it is the
current value.
Reason for conditional availability of 'Unmute' option:
In a not-muted stream, 'Unmute' has no special significance.
We only show 'Default' because both 'Default' and 'Unmute' has the
same behaviour in the not-muted stream.
This avoids the big design downside of showing this fourth
nearly-identical option to users who are just in the normal
default state of a normal topic within a normal stream
We only show the 'Unmute' option in the not-muted stream to users.
if they have followed a sequence of steps that led them to
'Unmute' state in a not-muted stream.
For example:
Mute a stream > Unmute a topic > Unmute the stream
By doing so, we avoid destroying information. The user, when
mutes the stream again, the topic will retain the 'Unmute' state.
New icons for Mute, Default, Unmute, and Follow.
Update the 'data-tippy-content' and 'aria-label' from
* 'Mute topic' to 'Mute'
* 'Unmute topic' to 'Unmute'
* 'Follow topic' to 'Follow'
in the left-sidebar topic-popover UI to toggle visibility policies.
As we plan to add a 'Default' option, 'Default topic' doesn't sound
good (if we stay consistent with the earlier texts).
Instead, 'Mute', 'Default', 'Unmute', and 'Follow' sound good, and
it is obvious that we are performing action on the topic itself
(as it is a topic popover). There is no need to add an extra 'topic'
keyword.
We should just accept `subscribed` and `previously_subscribed` fields as
arguments to this function to avoid adding them on the `attrs` object
itself to simplify the type for `ApiGenericStreamSubscription`.
We should always return `boolean` type instead of `boolean | undefined`
type for functions `is_subscribed_by_name`, `is_subscribed`,
`is_web_public` to stay consistent with other similar functions which
have the type of `boolean` like `is_invite_only_by_stream_name` and
`is_web_public_by_stream_name`.
After commit e52a3bc662, `BinaryDict`
class currently only deals with numeric stream ids so there is no
benefit to use case-insensitive `FoldDict` here anymore.
We need to include this "transform-optional-chaining" for babel presets
to prevent an error related to optional chaining syntax when we convert
this module to typescript. This error is a bug which is present in the
unmaintained `babel-plugin-rewire-ts` plugin.
I refined types for Subscription objects and Stream objects which were
already present `sub_store`. I took reference for the types from the
`zerver/lib/types.py` file.
This commit refactors the `sub` object we were creating in
`create_sub_from_server_data` function, there were some fields which
didn't need to have a default set like `name`, `description` etc. so we
can remove those fields from here.
Also I set the color field in the object field itself to avoid making an
incomplete type object with not having `color` propertie initially.
We should make a new object called `attrs` instead of adding new fields
directly to `sub` in `populate_subscriptions` method because these
additional properties which are being added does not staisfy the type
definition for the data we are getting from the server.
Because of this when we will type this function we will get type errors
saying that these additional field does not exist. So we should make a
seperate object with the correct types.
Add type annotations. Create custom types for Bot and Service.
Add zod data validation for incoming bot data from server.
Based on `zerver/openapi/zulip.yaml` description, `add` operation
(`op`) carries data that follows `Bot` structure. So taking
reference from `bot` structure, I create `ServerAddBotData` zod
schema and infer its type. Similarly, `update` operation carries
data that follows `BasicBot`, so I create `ServerUpdateBotData`.
Note that `Bot` inherits from `BasicBot`.
`zerver/openapi/zulip.yaml` describes that `services` in `BasicBot`
can be one of two objects, one with `{base_url, token, interface}`,
another with `{service_name, config_data}`. Therefore, I create
two corresponding schema and infer their types.
Fix two test cases `bot_data.test.js` and `settings_bots.test.js`
whose synthetic objects should have had followed the schema.
Added type annotations for function parameters and return values.
Added non-null assertions or type narrowing to some variables to
enforce type safety.
In `global.d.ts`, I added a namespace `JQueryValidation` which is
neccessary for type annotations inovolved in `jquery-validation`
plugin.
Previous line written in that way assumes `email_form` will appear
in the `document`. A modernly standard way is to use `querySelector`
selecting by id. Another advantage is easy for enforcing typecheck.
The commit related to this line of change is linked below:
9cb682cada
Throughout the codebase there is currently one usage of `autofocus`
excepts in test files. The only one usage is in `signup.js` and was
supposed to pass a `JQuery` selector to `autofocus` rather than a
string. Passing a selector is more convenient in this case: The
selector accessed in `signup.js` is ready to `trigger` the `focus`
function, while getting a attirubte string from the selector and then
passing to `autofocus` and then accessing the selector by attribute
cost extra layers of work. Therefore writing this commit to simplify
the type for easy usage.
Fixes the test case(s) accordingly.
Select the linkifier with `:nth-child` assuming the possibility of other
linkifiers in the realm. This prepares for a later change that requires
us to populate the test database with linkifiers.
Organization owners can make streams private even if they're not
subscribed to them, but cannot access private streams they're not
subscribed to. This means they're able to lock themself out of streams.
This change warns users of this and give them a chance to subscribe.
Fixes#26437.
In commit 5edc8fc, abstract classes were added to the
drafts overlay, but the classes that were already there
were not removed. This resulted in the same styles being
applied twice.
Removes the "dropdown-list-body" class and references as it is no
longer used in the new DropdownWidget. The previous uses of the
class were removed in commit 875d564f2d.
In this commit, we introduce a new option in the stream creation
UI - a 'Default stream for new users' checkbox. By default, the
checkbox is set to 'off' and is only visible to admins. This
allow admins to easily designate a stream as the default stream
for new users during stream creation.
Fixes#24048.
This commit adds a 'Default stream for new users' checkbox in
the stream editing UI to allow admins to easily add or remove
a stream as the default stream for new users. Previously, this
functionality required navigating to separate menu.
Fixes a part of #24048.
Since this is based off of the id now and doesn't try
to get a stream from a name (because stream is now
selected by a dropdown and not a free-form input field),
we can also remove the error handling for when the
stream name doesn't correspond to any streams.
Recent Topics is hidden when we switch to a narrow view
or the All Messages view, so this call is not needed.
It will also become actively unhelpful when we build
a stream-specific recent topics page, because then it
will be possible to have a hash change that shouldn't
close the recent topics view.
We change the custom profile fields table to have same header as
of other table and as a result this also makes the page look
better if an organization has zero custom profile fields.
This commit re-adds bootstrap CSS rules defined using "table"
class to the specific CSS files where CSS for different tables
is present.
This is a prep commit for removing table related bootstrap CSS
from bootstrap.css.
We have already re-added the bootstrap CSS rules defined using
"table-bordered" class in the specific files where required and
thus this commit removes them from bootstrap.css.
Previously, two borders were applied on the heading of tables
in informational_overlay. Top of the heading element had one
border from "table" and one from "th" element. Bottom of the
heading had one border from "th" element and one from "td"
element.
This commit fixes it by changing the CSS for borders on
"th" element to be applied only on striped tables without
borders (i.e. tables having "table-striped" class but not
"table-bordered" class) as bordered tables already have
top borders defined on td and table element while on
striped tables without borders, only bottom border is
applied on "td" elements along with the top and bottom
borders on "th".
This commit re-adds bootstrap CSS rules with "table-bordered" class
to app_components.css so that tables used in the app can use this
css and we can remove the CSS from bootstrap.css.
This commit re-adds required bootstrap CSS rules defined with
"table-bordered" class to the specific files.
This is a prep commit to remove bootstrap CSS for tables.
We do not use classes like "success", "warning", "info"
and "error" for "tr" elements used in tables and thus
we can remove the related CSS from bootstrap.css.
We also do not have selectors of the form ".table .table"
and so we can remove that CSS from bootstrap.css as well.
ALso, the CSS defined using ".table tbody + tbody" to
set the border is not required as we already set borders
on th and td elements.
The browser defaults for font-weight for `th` elements
is "bold" so we can remove the CSS to set font-weight
from bootstrap.css.
The html for tables used by us has a following structure-
<table>
<thead>
<tr>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
So, as per the above structure, we do not have th elements
inside tbody and td elements inside thead and thus we can
remove the bootstrap CSS rules for these cases. Also, we
always have a thead before tbody, so tbody:first-child CSS
can also be removed.
We use "tfoot" element only in realm_domains_modal.hbs
template and this table does not have table-bordered class.
The bootstrap CSS rules for "tfoot" elements are only for
the "tfoot" elements inside a table with "table-bordereds"
class so we can safely remove the bootstrap CSS.
This commit adds code to pass stream traffic data using
the "stream_weekly_traffic" field in stream objects.
We already include the traffic data in Subscription objects,
but the traffic data does not depend on the user to stream
relationship and is stream-only information, so it's better
to include it in Stream objects. We may remove the traffic
data and other stream information fields for Subscription
objects in future.
This will help clients to correctly display the stream
traffic data in case where client receives a stream
creation event and no subscription event, for an already
existing stream which the user did not have access to before.
The save-discard was not being hidden properly in the below case-
- The "Default language for code blocks" setting was disabled
initially (i.e. the "Disable" option was selected in the dropdown),
meaning there was not default language set.
- The setting is then udpated to "javascript" and the save-discard
widget is shown as expected.
- The setting is then again change to "Disable" option.
The save-discard widget should have been hidden after the last
step, but it does not.
This was because while comparing the old and new value, the new
value (obtained using get_dropdown_list_widget_setting_value) was
computed as "null" while the old value (obtained from page_params)
was an empty string "". This commit fixes the bug by changing
get_dropdown_list_widget_setting_value to return empty string "",
instead of null, when the "Disable" option is selected in the
dropdown.
The "get_dropdown_list_widget_setting_value" function was returning
null previously, as we supported both null and empty string "" to
represent the state of no language selected, with null being the
initial value and empty string being used if user changed the
setting to some language and then disabled it again.
This was changed in #26275 and the state of not setting any default
language for code blocks is now represented using empty string in
all cases.
The save-discard widget was not showing and hiding correctly
for the "Automated messages and emails" section in organization
settings panel. This was because the "proposed_val" was always
being returned as "undefined" for language setting as
"data-language-code", which is used to check the proposed value
of setting, was not set after changes in 36475daba7.
This commit fixes it by passing language_code value to
language_selection_widget and thus setting "data-language-code"
attribute correctly.
The changes in 36475daba7 removed language_code parameter from
language_selection_widget as it was not passed in the template
from "Display settings" section. So, this commit also passes
the language_code parameter to language_selection_widget from
"Display settings" section.
This change sets the "data-language-code" attribute even when
it is not being used there, to make sure there is no reference
to undefined fields in language_selection_widget.
Note that the above bug was reproducible only if you have not
changed the language even once and are trying to change the
other settings, as the data-language-code attribute was set
after selecting a language from the modal, but it was not
set initially after rendering the page.
It is possible that the current value of a dropdown widget is
valid but not present in options since the current user doesn't
have access it. So, we show [disabled] as value in that case.
This can be reproduced by setting a private stream for
notifications in org settings and then opening org settings
as a user which doesn't have access to the private stream.
Before this change, the cursor left the DM recipient box after
selecting a pill from the typeahead. This was only the case with
mouse clicks and not with keyboard selection.
This change ensures we always return focus to the input field
after selection.
Earlier the API endpoints related to user_group accepts and returns a
field `can_mention_group_id` which represents the ID
of user_group whose members can mention the group.
This commit renames this field to `can_mention_group`.
Earlier the API endpoints related to streams accepts and returns a
field `can_remove_subscribers_group_id` which represents the ID
of user_group whose members can remove subscribers from stream.
This commit renames this field to `can_remove_subscribers_group`.
This commit renames "dialog_cancel_button" class in the exit button
of modals to "dialog_exit_button", which seems a much better name
for a button that is used to close a modal.
This commit changes the button text from "Cancel" to "Close" in
copy email address modal, since it is weird to click on "Cancel"
button after having copied the email address and might confuse
users. Using "Close" makes it clear that the button is to just
close the modal.
Fixes#25950.
Focus area is mostly determined by finding the first
relevant field that is *empty*, and selecting empty
fields has no effect.
The only situation where the field might not be empty
is when the textarea already has text in it, since
that's the default option. We don't want to select
the composebox textarea because this can lead to
people losing their messages if they start typing
right away.
This commit encompasses the following changes:
* Replace the [More...] link with a button titled "Show more".
* Replace the [Show Less...] link with a button titled "Show less".
* Add various on-hover interactions to the buttons.
* In the condensed view, add fading to the bottom of the message to
visually communicate that the message is truncated.
* Update /help/ description.
Fixes#22801.
Co-authored-by: Evy Kassirer <evy.kassirer@gmail.com>
Previously, the view function was responsible for doing a first pass of
the validations done for RealmPlayground. It is no longer true now. This
refactors do_add_realm_playground to check_add_realm_playground and make
it responsible for validating the playground fields and doing error
handling for the ValidationError raised.
Dropping support for url_prefix for RealmPlayground, the server now uses
url_template instead only for playground creation, retrieval and audit
logging upon removal.
This does the necessary handling so that url_template is expanded with
the extracted code.
Fixes#25723.
Signed-off-by: Zixuan James Li <p359101898@gmail.com>
Added type annotations for variables, function params, and return
values. Created custom types that help with clean type annotations.
Notes on `attrs` field in custom `Option` type:
`attrs` is an `Iterable` where each element is a pair of string, i.e
a string array with two elements. `attrs` is tranformed into a `Map`
at some point. `Map` constructor takes in `Iterable` object so has
no problem unifying with `attrs`. However, at some point `attrs` is
transfomed using `.map(...)` which is an array method, and `Iterable`
does not support `.map(...)`. So at this point, I cast `attrs` into
array before using `.map(...)` by this syntax:
`[..attrs].map(...)`
This also removes padding on .message_content that wasn't actually
rendered due to its low specificity. It was likely also leftover
from an earlier, non-grid-based layout.
The default appearance in modern Firefox is totally fine, and our
override was incorrectly changing the dropdown triangle to black for
the dark theme.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
initialization function.
We are already importing `generated_pygments_data.json` directly in
`realm_playground.js` so there is no need to pass it via initialization
method.
We have added the bootstrap CSS rules for blockquote elements
to the specific elements in previous commits and thus we can
safely remove these from bootstrap.css.
This CSS will only be used if somehow the tweet is renderd as
a simple quote without iframe either due to network problem
or if the actual tweet is deleted.
This commit re-adds bootstrap CSS rules for blockquote elements
used in various markdown pages including the ones which are
rendered during message formatting like when quoting a message.
This is a prep commit to remove the blockquote CSS rules from
bootstrap.css.
This commit re-adds bootstrap CSS rules for blockquote elements
used for testimonials in the landing page.
This is a prep commit to remove the blockquote CSS rules from
bootstrap.css.
This commit re-adds bootstrap CSS rules for blockquote written
using ">" in case study pages and some other pages like
"/why-zulip", "/history", etc.
We also remove the unnecessary CSS for "blockquote::after"
selector in this commit.
This is a prep commit to remove the blockquote CSS rules from
bootstrap.css.
This commit re-adds the required bootstrap CSS for blockquote
elements used in "for/businesd", "for/research", "for/events"
and "for/open-source" pages.
This commit only handles the blockquote elements inside ".quote"
and ".intro-quote" elements and not "blockquote.twitter-tweet"
elements which will be handled separately. The blockquote
elements rendered using markdown using ">" will also be handled
separately.
This commit also updates blockquotes in self-hosting page as
blockquote element on this page is also inside ".quote" element.
This is a prep commit to remove the blockquote CSS rules from
bootstrap.css.
We use "testimonials" class only to show the testimonials
in landing page, i.e. hello.html and that page does not
use "why-page" class. So, the CSS with selectors including
".portico-landing.why-page .testimonials" is not required
and this commit removes it.
The removed CSS was added in fc6833e46a when we used
"testimonials" class for quotes in why-zulip.html page
but this changed since we moved the quotes to markdown file.
The "label" class was only used for the labels shown in
activity support page. This commit adds the required CSS
rules to activity.css and removes them from bootstrap.css.
We use "small" element only to show secondary details in
a typeahead option. This commit re-adds bootstrap CSS
rule to the specific element in compose.css and removes
the CSS from bootstrap.css.
Also, we do not use small elements inside any of h1, h2,
h3, h4 and blockquote elements, so the CSS for those can
be safely removed.
We use input-append class only for some search elements
in the app and the CSS rules applied by bootstrap which
are really used are "white-space" and "margin-bottom"
for a couple of ".input-append" elements and "margin-left"
property on clear button which is re-added to the CSS for
specific elements in this commit.
Others are either redundant or overridden by the other CSS
for the specific elements.
The border-radius property for the clear button was applied
but since we use "x" for it, there is no border for that
button and hence it is redundant.
The terminology "arrows" comes from historical functionality
that is no longer relevant, so searchbox_container is a more
clear and accurate name.
It would be nice in the future to see if we can remove
some of the nesting of HTML (#searchbox, #searchbox_form,
and #searchbox_container).
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.