Checking `browser_history.state.changing_hash` was not correct since
we were calling `select_id` on message list, which saves the narrow
state, before we set `browser_history.state.changing_hash` to `false`.
That means, it was not reliable to save the narrow state.
Also, it is possible that `save_narrow_state` is called after URL hash
is changed but before we render the new message list. That could result
in us saving the narrow state of the previous message list on the
new URL. That could lead to a weird bug where message list doesn't
change after clicking on a near link but user just gets scrolled
in the current message list as per the wrongly saved narrow state.
We fix it by only saving the narrow state when the URL matches the
filter set in the current message list.
If a muted message for the currently rendered message list is moved
to a non muted topic, it was not rendered if it is part of
`_all_items` and not `_items` due to it being previously muted.
We fix it by removing all the moved messages from the list and
added them back which allows us filter the messages for muting again.
This overall reduces the amount of rerender calls too since we
are now guaranteed to only call it once now.
Fixes#31977
This will be useful for later when we'll need the schema for
converting settings_org to typescript.
This commit also renames StreamSettingProperty to more accurately
reflect the type of a single property key.
This will be useful for later when we'll need the schema for
converting settings_org to typescript.
This commit also renames RealmSettingProperty to more accurately
reflect the type of a single property key.
Followup to #31960. I forgot to consider the case of a narrow with
an undefined filter. To make sure we fully run render_section_headers
on narrows like Recent Conversations the first time they load, this
commit initializes `current_filter` to the string "unset".
Previously, these were only shown for Mac OS users and replaced
the "Home", "End", "PgUp" and "PgDn" shortcuts. But as this really
depends on the keyboard the user is using (there are Mac keyboards
with the above keys), we instead show both options in our web app
and help center documentation on keyboard shortcuts.
The tooltip for the "Scroll to bottom" button will now always show
"End" for all users. Previously, it showed a "Fn" key option for
Mac users.
Fixes#31815.
The operand for the canoncial "channel" operator can be an ID, but
it must be an integer and not a string, so we take care of that
directly in handle_operators_supporting_id_based_api.
This commit adds a 'Type' column to the Data exports table
in the org settings.
It specifies whether it's a public data or standard export.
Fixes part of #31201.
'realm_upload_quota_mib` is updated when `plan_type` changes.
Earlier, we were including 'upload_quota' to update
`realm_upload_quota_mib` in extra_data field of 'realm op: update'
event format when property='plan_type'.
This commit migrate those two parameters to `realm op: update_dict`
event format.
* None of the clients processes these fields, so no compatibility
code required.
* Renamed `upload_quota` to `upload_quota_mib` as it better aligns
with our goal to encode units in the client-facing API names.
Also, it helps to avoid extra code to update 'realm_upload_quota_mib`
in web client, web client simply aligns with
'realm["realm_" + key] = value'.
When combined feed is cached, moving messages can cause some
messages to be missing.
This can be reproduced by moving messages from a muted stream to
non muted stream.
Fixed by updating all rendered message lists for the messages
that were moved.
Earlier we use to restrict admins, moderators or members of a group to
manage that group if they were part of the realm wide
`can_manage_all_groups`. We will not do that anymore and even
non-members of a group regardless of role can manage a group if they are
part of `can_manage_all_groups`.
See
https://chat.zulip.org/#narrow/stream/101-design/topic/Group.20add.20members.20dropdown/near/1952902
to check more about the migration plan for which this is the last step.
Fixes#25942.
Users with permission to manage the group (either on the group level or
realm level) should be able to add members to the group without being
present in can_add_members_group.
This commit moves the code to compute the profile field order and
the number of fields shown is user card, out of the list_widget
functions just to maintain the code readability and keeping code
easy to understand.
Earlier, only public data export was possible via `POST /export/realm`
endpoint. This commit adds support to create full data export with
member consent via that endpoint.
Also, this adds a 'export_type' parameter to the dictionaries
in `realm_export` event type and `GET /export/realm` response.
Fixes part of #31201.
`$(".buddy-list-subsection-header").children()` has length more often
than I had thought. Using the narrow filter is more direct way of
managing this state.
Removed "type"/"Type" from schema and type names used
for group settings because we want to use "type"/"Type"
only for "type of a type" cases.
So, this commit renames-
- anonymous_group_type => anonymous_group_schema
- group_setting_type_schema => group_setting_value_schema
- GroupSettingType => GroupSettingValue
We also had duplicate definitions for GroupSettingType, in
state_data.ts and in settings_components.ts. So, removed it
from settings_components.ts.
This commit updates live-update of group settings like we do for
stream and realm settings.
Current behavior is -
- If the save discard buttons are visible, meaning that the current
user was in the middle of changing a setting, then all the settings
elements are synced to the original value irrespective of whether
that setting was actual updated, including the setting which the
current user was changing.
- If the save discard buttons are not visible, then only the
element of updated setting is synced as it is not needed to
reset the UI for other settings.
We make the change similar to what we did for realm and stream
settings in 5da1e57fc2. 5da1e57fc2 did not had the changes
for group settings since we had only one group setting then
but now we have multiple settings.
Since group setting value can be an object containing
direct_members and direct_subgroups fields, this code
updates check_group_property_changed function to use
isEqual to compare the setting values instead of using
"===".
This makes sure that save-discard widget is shown and
hidden as expected.
This function only uses `e` for its `target`, so it could instead be
passed the `HTMLInputElement` instead of the `JQuery.ChangeEvent`. The
caller is an event handler for the selector `"input, select"` and
`<input>` has no children, so there’s no difference here between
`.target` and `.currentTarget`.
This will be helpful for typescript, because `currentTarget` has
clearer typing.
The "members" field for user groups sent by servers only include
active users, so there is no need for is_person_active check to
filter out the deactivated users.
We show a confirmation dialog explaining the "resolve topics"
feature when the user marks a topic resolved for the first time.
If the user confirms the action, we mark the
topic resolved, else we don't.
We don't show anything the first time a topic is marked
unresolved.
Fixes#31242
This commit improves the copy codeblock button and playground button
in the codeblocks to improve their visibility, particularly when on
top of some code.
Previously, the text under these buttons was difficult to select, as the
buttons would block the selection. This commit now hides these buttons
when a user clicks on any part of the codeblock, allowing to view the
code without any distractions, as well as, allowing the user to select
any part of the code.
We previously auto-mocked this out of expediency, but that made it
impossible to test anything that uses the Zod schemata in the same
module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is a follow-up of 43eebbf9c6,
and it sets `data-simplebar-tab-index="-1"` on the remaining popovers.
This prevents the simplebar container from taking focus while trying to
navigate the popovers via the keyboard, thus fixing the bug where the
user had to click the down key twice before reaching the first
focus-able popover menu option.
This should work because all the events are either `change` events or
`click` events on elements without children. This change is being made
to make typescript migration easier, ecause we can type `this` more
easily than `e.target`.
This simplifies the StreamSubscription type, and parallels how we
always initialize every other property that isn’t in
NeverSubscribedStream (audible_notifications, desktop_notifications,
email_notifications, push_notifications, wildcard_mentions_notify,
color, is_muted). email_address was already optional.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
Fixes#31701.
This fixes a bug where when the user clicks on a near link, the
pointer doesn't shift to the `near` linked message. This can
be a confusing experience for the user.
On a fresh render of a narrow if the view doesn't scroll,
`update_sticky_recipient_headers` is not called. So, we need call
it after we have scrolled to the message we want to select.
This helps us better update the views where we don't have the
messages that were updated cached or the filter cannot be
applied locally.
Tested using browser breakpoints for search `zulip` in starred narrow
for `!filter.can_apply_locally()` and setting message_fetch
constants to single digit for `messages_to_fetch.length > 0`.
This flake was happening since `wait_for_fully_processed_message`
only checks if the `star` icon is displayed on the message but
doesn't check for current narrow or waits for the narrow to
change.
Since narrow is changed to the message narrow after sending a
message. If we don't wait for narrow to change, this narrow change
can make the `get_current_msg_list_id` call return true for the
wrong narrow change. Which causes message list id of the wrong
message list to be returned and hence we cannot locate this
message list id.
To fix it, we check if sending this message will cause a narrow
change and if true, we wait for the narrow to change before
checking if the message is visible.
Previously, only spaces were used as word separators when searching
for topics. This meant that searching for "support" would not find a
topic named "topic_support" or "topic/support," which could lead to
unexpected results.
To address this, hyphen (-), underscore (_), colon (:), and slash (/)
have been added as additional word separators for topic filtering in
the left sidebar, as these characters are commonly used as separators
in topic names.
Fixes: #31844
Before, the message reactions section along with the add reaction button
was being rendered for every message even when there were no reactions
present - this led to additional DOM cost.
This commit adds the message reactions section only when there is
at least a single reaction on the message, and follows up with a cleanup
of the message reactions section when there are no reactions.
Fixes#31137.
Co-authored-by: Anmol-dev45 <basnetanmol2020@gmail.com>
Instead of storing setting pill widgets for new groups
in group_setting_widget_map, we just use variable in the
user_group_create file to store the widget.
This helps in accessing the widget with the key having
"new_group_" as prefix which we want to avoid as a pattern.
Note that the classes and IDs in templates still use
"new_group_" prefix.
This commit refactors get_group_setting_widget_value function
to accept pill widget as parameter instead of setting name.
This is a prep commit for not needing to store the widgets for
group creation form in settings_components.group_setting_widget_map.
This commit refactors set_group_setting_widget_value function
to accept pill widget as parameter instead of setting name.
This is a prep commit for not needing to store the widgets for
group creation form in settings_components.group_setting_widget_map.
Previously [{operator: "topic", operand: "one\xa0two"}] would be
unparsed to "topic:one\xa0two" which parses as [{operator: "topic",
operand: "one"}, {operator: "search", operand: "two"}], leading to
exceptions in the search pill system.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
Previously, the "stream_topic_history" used to store unacked float
message ids as well in its "max_message_id" of stream and
"message_id" of topic histories.
This commit updates it to rather store only the acked message ids
here, and rather use the "echo_state" module so as to look up
for unacked messages in case of looking for recent topics, or
max message id in functions.
Previously, when `insert_local_message` was called, the
data structures in the `echo_state` are updated with the new
local messages after calling `insert_new_message`. This would
update the stream sidebar before even updating the `echo_state`
with the new local messages.
This commit introduces `track_local_message`, which basically
updates the `echo_state` data structures with the local
message before actually updating the stream sidebar.
This is a preparatory commit to update stream_topic_history
to only contain acked message ids.
The narrow_state module has a function that returns what this needs.
This does remove a log statement, but I don't think it was useful; we
don't need to or have a useful way to colorize a channel that doesn't
exist.
This commit refactors the `ensure_channel_topic_terms` of filter.ts.
Previously, this method used to add channel and topic terms, with
operands as placeholders in case the `with` narrow doesn't have
channel-topic terms.
This commit updates it to rather correct the narrow with the right
terms in case the channel-topic terms are missing in the `with`
narrow, but leave it as it is in case the channel-topic terms are
present, so that it can later be corrected if the channel-topic
terms are not pointing to the right conversation.
Previously, no custom styling was being applied to the enter send
choice options, which led to uneven styling from the other popover
options, as well as the outline ring being cut-off from the edges of
the popover. This commit fixes these issues by adding custom styling
for the outline ring when the enter send choice options are focused.
This was causing a bug where the participants weren't necessarily
all getting rendered, specifically when there were many subscribers
to a channel, because we render users in batches as buddy list
scrolls, and those users would only show up after some scrolling.
This fix makes sure we always load the participants first.
We create an unnamed user group with just the group creator as it's
member when trying to set the default. The pattern I've followed across
most of the acting_user additions is to just put the user declared
somewhere before the check_add_user_group and see if the test passes.
If it does not, then I'll look at what kind of user it needs to be set
to `acting_user`.
We also add the exception for the group creator to be able to edit their
group in this commit. This exception was added in the backend in earlier
commits.
This commit does not add the logic of using this setting to actually
check the permission on the backend. That will be done in a later
commit.
Only owners can modify this setting, but we will add that logic in a
later commit in order to keep changes in this commit minimal.
Adding the setting breaks the frontend, since the frontend tries to find
a dropdown widget for the setting automatically. To avoid this, we've
added a small temporary if statement to `settings_org.js`.
Although, most lists where we insert this setting follow an unofficial
alphabetical order, `can_manage_all_groups` has been bunched together
with `can_create_groups` since keeping those similar settings together
would be nicer when checking any code related to creating/managing a
user group.
This commit does not add the logic of using this setting to actually
check the permission on the backend. That will be done in a later
commit.
Adding the setting breaks the frontend, since the frontend tries to find
a dropdown widget for the setting automatically. To avoid this, we've
added a small temporary if statement to `settings_org.js`.
When adding or removing recipients for a direct message, the
placeholder text may cause a change in the size of the compose box,
so this adds a call to `compose_ui.autosize_textarea` when setting
that placeholder attribute.
If the user group being deactivated is used as a setting for a stream
which cannot be accessed by the user trying to deactivate the group,
we show "Unknown stream" in the banner mentioning where the group
is used.
This commit adds code to list the groups and streams
where the group is being used as settings in a banner.
The banner also mentions if the group is being used for
realm settings.
This isn't a bug fix, but it does clean up the code. `reload_setup`
only uses the `stream_id` if it can parse it as an integer and
otherwise falls back to `undefined`, so it makes more sense to not
include undefined stream ids.
Fixes#31750.
The control buttons of the edit box were flickering b/w default cursor
and pointer cursor after c1d155d923.
The addition of `position: relative` to `.edit-content-container` was
causing that. We've now added a div to apply position:relative to, this
div does not have any edit controls in it's children.
This is helpful for when a user wants to delete multiple pills
in a row, now that a pill needs to be highlighted before it can
be deleted.
It makes more sense intuitively for the previous pill to be selected
after backspace, since the direction of deletion is backwards. We
still potentially focus next() if there is no previous pill, which
is most helpful when the input element has no more pills left, since
this focuses the text field.
Select the pill on the first backspace and delete the whole pill on
the second backspace. If the pill is already highlighted from
left-pressing, then backspace would delete it right away.
We're making this change because it can be quite annoying to
re-type out a pill that's accidentally deleted, and users might
think pills are editable and accidentally delete the whole thing
with a backspace stroke.
The HTML id attribute is supposed to be globally unique; it’s not an
appropriate place to store a user-controlled string, or to identify
part of a component that’s rendered more than once.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
`window.Notification` can be `undefined` in iOS Safari.
https://bugs.webkit.org/show_bug.cgi?id=247315
This hasn't caused any known bugs, but it's better to catch
this case with an undefined check than to assert it's defined
when we convert this file to typescript.
As the guide to getting an organization started is being replaced
by the moving to zulip guide, replace links to subsections of the
old guide to instead go to dedicated articles about those topics.
Fixes#28633
Added a button to switch license management type on billing page.
Tested that the plan switch works correctly.
Tested that when switching from manual to automatic license
management, customer is only billed for billable users for the
next billing cycle.
Add to the help center and in-app shortcuts overlay, near the existing
"Go to combined feed" shortcut, documentation for the similar inbox/recent view
navigation shortcuts.
Removed the night images since they were not being used and these
new day mode images are designed to look not too bright in the
dark mode screens too.
The rewording clarifies that this setting allows users to change only
the value of the field for their own account.
This is a follow-up to #29570 which implented the setting through a
series of 3 commits ending in 23efb5cec7.
For settings with allow_everyone_group is False, guest users
are not allowed to do the task controlled by that setting even
if the guest user is member of the group which is used for
that setting.
So, we do not show guest users in typeahead for such settings
and also not create a pill when someone types full email of
the guest user in the input.
There is no such restriction in the API and it is fine
since we eventually have the check to not give guest user
the permission.
And we still allow guests to be part of any group, so there is
no restriction on using groups containing guests as subgroups
of the anonymous groups and showing them in typeahead.
We only use pills UI for can_manage_group setting currently,
but we can still pass setting_type in pill_config so that we
can use that while calling get_group_permission_setting_config
for checking if group is allowed to be used in the setting when
creating group pill from group name.
We currently use the pills UI only for can_manage_group setting so
it is fine to pass setting type as "group" directly to
get_realm_user_groups_for_setting, but it would be better to just
accept setting_type as parameter in typeahead_source and pass that
to get_realm_user_groups_for_setting as other settings will also
use the pills UI in future.
Earlier, we used to compute last_edit_timestr as data-tippy-content
when rendering the whole message feed.
This commit changes the behaviour by computing the `last_edit_timestr`
when a user hovers over the message_edit_notice.
Fixes: zulip#27240.
This commit allows configuration of "editable_by_user" property from the
organization settings modal. It also adds support for non-editable
fields in profile settings modal.
Fixes#22883.
Co-Authored-By: Ujjawal Modi <umodi2003@gmail.com>
This margin was extending the size of the parent div, which caused
tooltips applied to the parent to trigger in the empty space below this
input.
Other elements in this section do not have bottom margins. So this
change also helps with uniformity.
This commit is a prep for #22883.
This new property allows organization administrators to specify whether
users can modify the custom profile field value on their own account.
This property is configurable for individual fields.
By default, existing and newly created fields have this property set to
true, that is, they allow users to edit the value of the fields.
Fixes part of #22883.
Co-Authored-By: Ujjawal Modi <umodi2003@gmail.com>
Previously, links in typeahead suggestions appeared inconsistent with
the surrounding text when highlighted. This commit updates the link
styling to match the text color and adds a subtle underline with reduced
opacity for better visual consistency.
Fixes#31005.
Earlier, when subsequent message had different year, date divider
would leave out year from `time_str` if it was from current year.
This commit adds year to time display if two adjacent messages have
different year and the second message is from current year.
Fixes: zulip#26673.
We refactor the following inputs to use a `placeholder-shown` CSS selector to
show/hide the close button, rather than custom JS logic:
- Filter topics field in the left sidebar
- Filter direct messages field under direct messages
- Stream message topic
This was confusing because there are other elements named
e.g. "#buddy-list-users-matching-view-container", which are
distinct from "#buddy-list-users-matching-view", and the
elements with the latter id should not be named with container
in the variable name.
Previously, the error was shown besides the group name
after the modal was closed, but it did not look good
for long error messages like the one we get when the
group being deactivated is being used for a setting.
Updated the code to use dialog_widget.submit_api_request
since it takes care of showing the error inside the
modal and also added code to show loading spinner as
the modal is not closed immediately to show the error.
`Enter` keypress on `save/cancel` was not working for users without
`should_enter_send` user setting due to it being prevented from
triggering default behaviour.
Fixed by only handling enter keypress if pressed inside
`message_edit_content` textarea.`
Previously, we were selecting the wrong input element, which caused an
unexpected undefined type error. This change corrects the selector to
properly select the input element.
Followup to #31645. I tweaked the filter in `maybe_shrink_list`, but
that function works with user ids originally fetched in
`get_filtered_user_id_list`, which was only fetching ids of users
that had been recently active.
There is no `.message_edit_content` in `focus` when user does
`tab + enter` to save the message. We use the existing text
content edit object get identify the row being edited which is
more robust and efficient.
This commit just replaces the old fa copy icon with the custom Zulip
copy icon. Since all the bot related icons in Personal/Settings/Bots
uses different colors, this commit avoids only changing the copy icon
colors, since that would result in an unintended standout.