Commit Graph

53118 Commits

Author SHA1 Message Date
Alex Vandiver 631868a05b users: Refactor and optimize max_message_id_for_user by removing a join.
This algorithm existed in multiple places, with different queries.
Since we only access properties in the UserMessage table, we
standardize on the much simpler and faster Index Only Scan, rather
than a merge join.
2023-09-11 15:00:37 -07:00
Alex Vandiver 0c88cfca63 postgres_exporter: Build from source for per-index stats.
This builds prometheus-community/postgres_exporter#843 to track
per-index statistics.
2023-09-11 11:59:39 -07:00
Lalit Kumar Singh 5f74b9051e ts: Migrate `user_topics.js` to typescript. 2023-09-11 10:57:38 -07:00
Lalit Kumar Singh dc142ab1d1 fold_dict: Use `IterableIterator` instead of `Iterator`.
The type `Iterator` does not allow us to loop over the iterator in a `for`
loop. but `IterableIterator` does.
2023-09-11 10:57:38 -07:00
Lalit Kumar Singh d82b3625f1 user_topics: Pop `user_topics` from `page_params`.
This avoids accessing the global page_params directly.
2023-09-11 10:57:38 -07:00
Daniil Fadeev a2b4db07f6 emoji_picker: Move module event registration to initialization. 2023-09-11 10:42:18 -07:00
Tim Abbott b0007bf5ca settings: Navigate to profile to edit self in users panel.
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.
2023-09-11 10:39:00 -07:00
Tim Abbott 0174902b73 user_profile: Centralize footer logic. 2023-09-11 10:39:00 -07:00
palashb01 db47f675f0 user_profile: Add tippy tooltips to edit pencil button.
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'.
2023-09-11 10:39:00 -07:00
palashb01 1c049ab5f4 user_profile: Replace the id with class for pencil button.
This commit replaces the id attribute with class attribute for the
edit pencil button in user profile modal.
2023-09-11 10:39:00 -07:00
palashb01 135518435a user_profile: Align the title header of the modal and fix edit button.
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.
2023-09-11 10:39:00 -07:00
palashb01 f9dd2db3e4 user_profile: Move bot icon to the left of the name.
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.
2023-09-11 10:39:00 -07:00
palashb01 c6bb7b9169 user_profile: Redirect edit pencil to manage user tab.
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.
2023-09-11 10:39:00 -07:00
palashb01 e1322faae0 user_profile: Fix the gap between labels and input.
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.
2023-09-11 10:39:00 -07:00
palashb01 6323bb1e39 user_profile: Disable deactivate user button if the admin is only user.
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.
2023-09-11 10:39:00 -07:00
palashb01 c2f878638b user_profile: Fix inconsistent height of user profile switching tabs.
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.
2023-09-11 10:39:00 -07:00
palashb01 66bf87062e settings_users: Combine "handle_human_form" and "handle_bot_form".
To remove duplicated code this commit will combine two functions.
2023-09-11 10:39:00 -07:00
palashb01 61948d273b settings_bots: Migrate manage bot to user profile modal.
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
2023-09-11 10:39:00 -07:00
palashb01 5d8e6b5f92 settings_users: Make element variable name more descriptive. 2023-09-11 10:39:00 -07:00
palashb01 218bde443a profile_modal: Migrate manage user footer buttons to user profile.
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.
2023-09-11 10:39:00 -07:00
palashb01 61cca84b17 settings_users: Migrate manage user modal to full 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
2023-09-11 10:39:00 -07:00
Daniil Fadeev a844be8825 user_group_popover: Remove unused template parameter. 2023-09-11 10:27:03 -07:00
Daniil Fadeev a3906009ae user_group_popover: Refactor and rename helper functions.
Rearranged some code to align with our current patterns and improve
readability. Renamed `show_user_group_info_popover`. No functional
changes in this commit.
2023-09-11 10:27:03 -07:00
Daniil Fadeev 7777c55b22 popovers: Extract `user_group_popover` into separate module.
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.
2023-09-11 10:26:50 -07:00
palashb01 1765ce23b0 user_profile: Adjust the stream tab headings to look good.
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.
2023-09-10 11:20:15 -07:00
Aman Agrawal 6321ab54ce dropdown_widget: Show empty list text without initiating search.
Fixes #26649

If there are no items for dropdown widget to display, show empty
search result text.
2023-09-10 11:20:15 -07:00
palashb01 656494d73b user_profile: Add a reset subscribe widget function.
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.
2023-09-10 11:20:15 -07:00
palashb01 daf3d9ee74 user_profile: Add tippy tooltip to subscribe button.
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.
2023-09-10 11:20:15 -07:00
palashb01 4e786293ae user_profile: Add the subscribe widget to user profile.
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
2023-09-10 11:20:15 -07:00
Tim Abbott d494f5bdaa user_profile: #user-profile-modal is a singleton.
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.
2023-09-10 11:20:15 -07:00
Aman Agrawal 45491710b7 narrow: Check if coming for `All messages` narrow when deactivating.
This will work correctly as we add more narrows like recent topics.
2023-09-09 18:51:01 -07:00
Aman Agrawal a5dafa383c left_sidebar_navigation_area: Rename narrow_to_recent_topics.
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.
2023-09-09 18:51:01 -07:00
Aman Agrawal f75a5483cf left_sidebar_navigation_area: Add a note to rewrite the logic. 2023-09-09 18:51:01 -07:00
Lalit Kumar Singh c47a18eb2b ts: Migrate `realm_logo` to TypeScript. 2023-09-09 18:30:43 -07:00
Lalit Kumar Singh b8e0850aa1 ts: Migrate `realm_icon` to TypeScript. 2023-09-09 18:30:43 -07:00
Aman Agrawal 1305fe74b6 test-js-with-node: Remove deleted dropdown-list-widget module.
Fixes #25741
2023-09-09 18:22:25 -07:00
Anders Kaseorg 1905df2342 requirements: Upgrade Python requirements.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-09-09 12:53:39 -07:00
Anders Kaseorg 22e8b641e1 mypy: Remove exemption for aioapns.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-09-09 10:10:24 -07:00
Anders Kaseorg 31b5879242 docs: Remove obsolete mentions of reStructuredText.
Commit b53e676860 (#19600) removed the
last of our reST.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-09-09 01:56:16 -07:00
Anders Kaseorg 964cc182a4 sync-translations: Normalize translations to NFC.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-09-08 17:51:47 -07:00
Anders Kaseorg ddba558f1d mypy: Remove no_implicit_reexport override.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-09-08 16:46:44 -07:00
Mateusz Mandera b6cce494a8 docs: Add a warning about restarting individual services.
restart-server is almost always the way to go, so we can be clearer
about it.
2023-09-08 16:22:50 -07:00
Adrián Oliva 732ad89f3d markdown: Fix URL link topic skipping query.
When searching for links inside a topic name, the question mark (?)
was used to split the topic. If a URL had a query after the URL
(e.g., "?foo=bar"), then the query was trimmed from the URL.

Removing the question mark from `basic_link_splitter` is sufficient
to fix this issue. The `get_web_link_regex` function then removes
the trailing punctuation if any, including literal question marks.

Fixes #26368.
2023-09-08 16:17:11 -07:00
N-Shar-ma 8c91c91d86 widgets: Fix bug where a new line right after /todo broke rendering.
When there was no space right after `/todo` but there was content on a
new line, the message would be rendered plainly, not as a todo widget.
This was because we split on only the space character to then check if
the first token was a valid widget.

Now we split on both spaces and newlines to extract the widget name,
irrespective of whether it is followed by a space or a newline. This
results in the message being rendered as a todo widget as expected.
2023-09-08 15:39:07 -07:00
Anders Kaseorg 61bc10ca01 web: Add missing CSS selector escaping.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-09-08 15:35:50 -07:00
Lauryn Menard b4f02a336d demo-orgs: Add section on configuring email address to help article.
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.
2023-09-08 15:17:23 -07:00
Lauryn Menard 3ef2c9e0cf demo-orgs: Update invite users warning to be same as auth methods.
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.
2023-09-08 15:17:23 -07:00
Lauryn Menard 11adc0f37d demo-organizations: Rename shortend versions of 'demo organization'.
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`.
2023-09-08 15:17:23 -07:00
Anders Kaseorg 4beea6c210 input_pill: Remove incorrect $ prefix from non-jQuery variable.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-09-08 15:09:39 -07:00
Anders Kaseorg 6232425618 message_overlay_ui: Prefix jQuery object variable names with $.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-09-08 15:09:39 -07:00