Commit Graph

53318 Commits

Author SHA1 Message Date
Aman Agrawal 696287b0eb left_sidebar: Remove dev environment check for inbox. 2023-09-18 21:31:58 -07:00
Steve Howell a8f5836ee6 tests: Make soft-reactivation tests readable.
The `expected` flag was incredibly confusing, as you
couldn't tell from the calling code what you were
actually expecting to happen.

I avoid the context manager idiom in order to force
the callers to create simple helper functions, and
I de-duplicate some code in some places.

I also force the caller to explicitly soft-deactivate
the user with one simple line of code, so that the
person reading the test doesn't have to research
the side effects of the helper. (And I make it
very easy for new authors to follow the practice
going forward.)

This is also somewhat of a prep commit to avoid
the obfuscated use of refresh_from_db.
2023-09-18 16:55:06 -07:00
Steve Howell 31d2660ee2 tests: Simplify policy-related tests.
The helper here was no longer a useful abstraction.
2023-09-18 16:55:06 -07:00
Steve Howell 0e261f6ec4 tests: Wrap get_user method.
The get_user function is poorly named, but I don't want to
sweep the entire codebase yet.

It's also nice to have a test wrapper for little experiments
like profiling tests or hunting down calls to refresh_from_db.

It's possible that we would also just change the new wrapper
to more directly call Django. The `get_user` function isn't
used in a ton of real-world places, so we might want the test
code to just bypass the cache.
2023-09-18 16:55:06 -07:00
Steve Howell df43f86cbc tests: Clean up check_has_permission_policies.
I add a bunch of cute helper methods to make
the test a bit more readable.

And then I make sure to get clean objects,
which precludes the need for our callback
functions to refresh the user objects.

And finally I make sure that our validation
functions don't cause any round trips (assuming
we have fetched objects using a standard
Zulip helper, which example_user ensures.)
2023-09-18 16:55:05 -07:00
m-e-l-u-h-a-n 8a6d649ef9 user groups: Fix right panel display for new user group on small screen.
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.
2023-09-18 16:09:31 -07:00
m-e-l-u-h-a-n e42fa42b0c user groups: Reset active_group_id at initial build of groups overlay.
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.
2023-09-18 16:09:31 -07:00
m-e-l-u-h-a-n 350802a510 user groups: Remove redundant DOM operations on user group add event.
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.
2023-09-18 16:09:31 -07:00
m-e-l-u-h-a-n 4a8271e854 user groups: Optimize DOM operations while showing groups overlay.
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.
2023-09-18 16:09:31 -07:00
m-e-l-u-h-a-n 4f6f619d20 user groups: Correctly decide the display of group list on left panel.
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.
2023-09-18 16:09:31 -07:00
m-e-l-u-h-a-n 1a7eb17450 user groups: Fix buggy display of edit button on group membership event.
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.
2023-09-18 16:09:31 -07:00
m-e-l-u-h-a-n 74318c9b7e user groups: Update left panel correctly on membership update event.
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.
2023-09-18 16:09:31 -07:00
m-e-l-u-h-a-n 74bcfa5a9f user groups: Update handling of user group add event.
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.
2023-09-18 16:09:31 -07:00
m-e-l-u-h-a-n 5cb99ad8a4 user groups: Update handling of user group remove event.
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.
2023-09-18 16:09:31 -07:00
m-e-l-u-h-a-n 0261be5993 user groups: Fix how we decide if a group is being edited.
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.
2023-09-18 16:09:31 -07:00
m-e-l-u-h-a-n 5b7e04773a user groups: Hide correct right panels on #groups overlay change.
`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.
2023-09-18 16:09:31 -07:00
m-e-l-u-h-a-n c147aafbe3 user groups: Preserve active group state during left panel updates.
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.
2023-09-18 16:09:31 -07:00
m-e-l-u-h-a-n e92aa2293d user groups: Add tabs for your/all groups in #groups overlay.
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.
2023-09-18 16:09:31 -07:00
m-e-l-u-h-a-n 4b8856b5d6 user groups: Fix tooltip for new user group button on #groups overlay.
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.
2023-09-18 16:09:31 -07:00
m-e-l-u-h-a-n f494daba95 user groups: Miscellaneous fixes to new user groups settings overlay.
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.
2023-09-18 16:09:31 -07:00
Vector73 40a8ca2ced message_edit_form: Remove question mark icon after edit-timer-text.
Fixes: #26759
2023-09-18 15:31:55 -07:00
Lauryn Menard 31daef7f79 response: Remove "result: partially_completed" for success responses.
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`.
2023-09-18 13:18:24 -07:00
Prakhar Pratyush 8d29ad7325 toggle_resolve_topic: Display spinner while request is in progress.
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.
2023-09-18 13:17:10 -07:00
Prakhar Pratyush 72b3a53864 inline_topic_edit: Fix spinner not visible in the dark mode.
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.
2023-09-18 13:17:10 -07:00
Alex Vandiver f778316b5a uwsgi: Ensure that the master process cannot load the application.
The rolling restart configuration of uwsgi attempted to re-chdir the
CWD to the new `/home/zulip/deployments/current` before `lazy-apps`
loaded the application in the forked child.  It successfully did so --
however, the "main" process was still running in the original
`/home/zulip/deployments/current`, which somehow (?) tainted the
search path of the children processes.

Set the parent uwsgi process to start in `/`, so that the old deploy
directory cannot taint the load order of later children processes.
2023-09-18 13:13:34 -07:00
Alex Vandiver a6d5d7740e uwsgi: Always enable lazy-apps.
Enabling `lazy-apps` defers loading of the uwsgi application until
after the fork, instead of happening prior to forking workers[^1].  The
nominal reason to not enable this is that it increases the memory
footprint of the server (since no memory is shared across processes),
and may slow down worker initialization, since each worker has to load
the files from disk.

However, Django defers loading the majority of the code until the
first request[^2].  As such, our current non-`lazy-apps` gains nothing
over `lazy-apps`.  For consistency, switch to using `lazy-apps` for
all deployments, rolling restart or no.

[^1]: https://uwsgi-docs.readthedocs.io/en/latest/articles/TheArtOfGracefulReloading.html#preforking-vs-lazy-apps-vs-lazy
[^2]: https://uwsgi-docs.readthedocs.io/en/latest/articles/TheArtOfGracefulReloading.html#preforking-vs-lazy-apps-vs-lazy
2023-09-18 13:13:34 -07:00
Aman Agrawal 8ebb64c622 inbox: Reduce width of rows. 2023-09-18 12:17:51 -07:00
Aman Agrawal 01959d49fc inbox: Use a non transparent background color.
Since the search box header is sticky, we need the background to
be non transparent.
2023-09-18 12:17:51 -07:00
Aman Agrawal 7e11f95716 inbox: Add inbox as default view.
Fixes #26736
2023-09-18 12:17:49 -07:00
Aman Agrawal 9ac4ad2292 inbox: Let hotkey handle the escape keypress if we don't.
We were forcefully navigating user to default view, which was not
correct as hotkey handles that case while taking into account
user settings.
2023-09-18 12:11:23 -07:00
Aman Agrawal d14d6db6af narrow: Show "Inbox" in tab title when in inbox view. 2023-09-18 12:11:23 -07:00
Karl Stolley e5f7f1701f vdots: Simplify colors on right sidebar.
This now presents uniform vdots colors and styles across both the
left and now right sidebars.
2023-09-18 09:06:33 -07:00
Karl Stolley b168d4911c popovers: Use sidebar-menu-icon utility class. 2023-09-18 09:06:33 -07:00
Karl Stolley fd01ebdc5d vdots: Simplify colors in streamlined selectors on left sidebar.
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
2023-09-18 09:06:33 -07:00
Karl Stolley 5a476d06c3 sidebars: Add sidebar-menu-icon util class. 2023-09-18 09:06:33 -07:00
Karl Stolley a764c15bcb icons: Express global filter icons as colors. 2023-09-18 09:06:33 -07:00
Aman Agrawal b845ef5091 recent_view: Show empty text after rerenders too.
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.
2023-09-18 08:01:58 -07:00
Aman Agrawal 19056db88b inbox: Show text if inbox is empty. 2023-09-18 08:01:58 -07:00
Aman Agrawal 4791e9f2fa inbox: Remove unused variable. 2023-09-18 08:01:58 -07:00
Aman Agrawal 05e133156e inbox: Make borders span full height. 2023-09-18 08:01:58 -07:00
Lauryn Menard 7c618b57cf emails: Update subject for confirm_new_email to have realm host.
Updates the email subject for confirming an email change to include
the realm host.
2023-09-17 15:12:21 -07:00
Anders Kaseorg 88e9320fa5 list_widget: Rename unsafe modifier parameter to modifier_html.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-09-15 18:11:50 -07:00
Tim Abbott a4e0abb216 version: Update version and changelog after 7.4 release. 2023-09-15 18:04:42 -07:00
Anders Kaseorg 500e6bfdef user_card_popover: Add missing $ prefix for jQuery object variable.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-09-15 14:14:50 -07:00
Anders Kaseorg c6b60f6490 dependencies: Upgrade JavaScript dependencies.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-09-15 14:09:49 -07:00
Daniil Fadeev 91d2b5ed81 user_group_popover: Migrate popover to Tippy.
Fixes part of #23632.
2023-09-15 13:40:53 -07:00
Daniil Fadeev e52188bd41 user_group_popover: Fix blueslip error messages. 2023-09-15 13:40:53 -07:00
Daniil Fadeev a678aee467 popovers: Apply styles for `hr` tag not just when nested under `.nav`.
We've got `hr` elements not just under `ul.nav`, like in
`user_group_info_popover`, so we need to apply styles there too.
2023-09-15 13:40:53 -07:00
Prakhar Pratyush fa063e4afc typeahead: Suggest only the first matching wildcard mention.
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.
2023-09-15 13:22:35 -07:00
Aman Agrawal fe2d6c07fb recent_view: Reduce width of unread header. 2023-09-15 13:20:45 -07:00