Commit Graph

62701 Commits

Author SHA1 Message Date
PieterCK
4db7ea2296 migration_status: Add parse_migration_status.
This commit adds `parse_migration_status`, which takes in the string
output of `showmigrations` and parse it into key-value pair of installed
apps and a list of its migration status.

This is a prep commit to rework the check migrations function of
import/export which will parse the output of `showmigrations` to write
the `migration_status.json` file.
2025-01-24 17:08:37 -08:00
PieterCK
68b3ce482a check-database-compatibility: Refactor a STALE_MIGRATIONS.
This consolidates the list of stale migration to
`lib/migration_status.py` as `STALE_MIGRATIONS`.

This is a prep work to make the migration status tool at
`migration_status.py` be able to clean its output of these migrations
too.
2025-01-24 17:08:37 -08:00
PieterCK
0b2f5c638d export_test: Prevent migration status fixtures from going stale.
Currently if for what ever reason one decided to change how
`migration_status.json` is written, the check migrations tests in
`test_import_export.py` will happily just use the old and potentially
stale migration status test fixtures in
`fixtures/applied_migrations_fixtures` against other stale fixtures and
run the check migrations tests in a bubble.

This adds an assertion in `verify_migration_status_json` that makes sure
all the migration status fixtures we use in the tests resembles the
actual `migration_status.json` file our export tool will write.
2025-01-24 17:08:37 -08:00
PieterCK
7a2b91ae97 migration_status: Update ANSI code clean up regex.
in `get_migrations_status`, we clean up the printed output of any ANSI
codes used to format the output. Currently the regex only cleans up bold
ANSI escape code (\x1b[1m) and style reset code (\x1b[0m). So it won't
be able to clean up basic ANSI escape codes such as "\x1b\31;1m" which
is used to format `showmigrations` output for apps with no migrations.
   e.g, "\x1b\31;1m (no migrations)"

This commit updates the regex to catch a wider range of basic ANSI
codes.
2025-01-24 17:08:37 -08:00
PieterCK
5f2286353f migration_status: Move connection.close_all() to test_fixtures.py.
The `get_migration_status` command calls `connections.close_all()` when
its done and it was previously only called when we need to rebuild the
dev or test database and when running the `get_migration_status`
command.

This commit moves the `connections.close_all()` call out of the function
and into `test_fixtures.py` directly, making sure it will only be called
when we are rebuilding the dev/test database. This is a prep work to
refactor the check migration function of import/export later on which
plans to use `get_migration_status`.
2025-01-24 17:08:37 -08:00
PieterCK
dfae02a273 migration_status: Move get_migration_status to a new file.
This moves `get_migration_status` to its own file in
zerver/lib/migration_status.py. This is a prep work to refactor the
check migration function of import/export later on.

Some of the imports are moved into `get_migration_status` because we're
planning to share this file with `check-database-compatibility` which is
also called when one does `production-upgrade`, so we'd want to avoid
doing file-wide import on certain types of modules because it will fail
under that scenario.

In `test_fixtures.py`, `get_migration_status` is imported within
`Database.what_to_do_with_migrations` so that it is called after
`cov.start()` in `test-backend`. This is to avoid wierd interaction with
coverage, see more details in #33063.

Fixes #33063.
2025-01-24 17:08:37 -08:00
Lauryn Menard
6b6142bcf6 help: Update change email address instructions for UI changes. 2025-01-24 16:49:05 -08:00
Jitendra Kumar
f96484eed5 style: Center the ⌘ symbol by replacing it with an icon.
This commit updates the keyboard shortcuts UI by replacing
the ⌘ symbol with a more symmetrically aligned icon.

Fixes: #32926
2025-01-24 16:48:26 -08:00
Mateusz Mandera
f81e514d07 slack: Fetch workspace users from /users.list in the correct manner.
1. Fetching from the `/users.list` endpoint is supposed to use
   pagination. Slack will return at most 1000 results in a single
   request. This means that our Slack import system hasn't worked
   properly for workspaces with more than 1000 users. Users after the
   first 1000 would be considered by our tool as mirror dummies and thus
   created with is_active=False,is_mirror_dummy=True.
   Ref https://api.slack.com/methods/users.list

2. Workspaces with a lot of users, and therefore requiring the use of
   paginated requests to fetch them all, might also get us to run into
   Slack's rate limits, since we'll be doing repeating requests to the
   endpoint.
   Therefore, the API fetch needs to also handle rate limiting errors
   correctly.
   Per, https://api.slack.com/apis/rate-limits#headers, we can just read
   the retry-after header from the rsponse and wait the indicated number
   of seconds before repeating the requests. This is an easy approach to
   implement, so that's what we go with here.
2025-01-24 16:41:53 -08:00
Alya Abbott
3dd3de3efa contributor docs: Describe how to handle follow-ups. 2025-01-24 15:02:18 -08:00
Karl Stolley
7111d429e6 compose: Size help-button icon to match other formatting buttons.
Because button sizes are precisely specified in the area, we set
the buttons as flex items that neither to grow or shrink, which
is essential to right-size the button area for the help button.
2025-01-24 14:57:29 -08:00
Karl Stolley
1d7076a534 channel_modal: Push back against inherited icon styles. 2025-01-24 14:56:41 -08:00
Aman Agrawal
9f71f4578b portico: Replace "Find accounts" link with "Log in".
Fixes #32199

We only need a log in button since that will take users to
"/accounts/go" if we are on a non-realm specific URL.

"/accounts/go" already has link to go to "Find accounts" page.
2025-01-24 14:55:47 -08:00
Sahil Batra
6bb3e6fb38 settings_checkbox: Rename tooltip_text variable. 2025-01-24 14:51:51 -08:00
Sahil Batra
52fbca65ce group-settings: Move functions used for group settings.
This commit moves get_realm_user_groups_for_setting and
get_realm_user_groups_for_dropdown_list_widget functions
from user_groups.ts to group_permission_settings.ts.

This change is needed to avoid import cycles in further
commits to add "Permissions" panel for groups.
2025-01-24 14:51:51 -08:00
Sahil Batra
4ae45763b4 settings: Use a common object for all group setting labels. 2025-01-24 14:51:51 -08:00
Sahil Batra
255eee255b events: Pass group in functions called for updating the group.
We now pass group in functions called while handling group update
events, instead of fetching the groups in those function as we
will need the old setting value in future commits.
2025-01-24 14:51:51 -08:00
Sahil Batra
62ab21bd79 node-tests: Improve user group event tests.
Tests for testing user group events does not stub "user_groups"
module anymore as it is mainly used to handle data and it is
easy to test the events without stubbing them.
2025-01-24 14:51:51 -08:00
Sahil Batra
14b7bde954 settings: Extract type for all realm level group settings.
Zod schema and type for realm level group settings is moved
to group_permission_settings.ts as we would define types for
stream and group settings there and the change would also help
in avoiding import cycles in further commits.
2025-01-24 14:51:51 -08:00
Pratik Chanda
f744625e4c tooltip: Add counts in tooltip for views in left sidebar.
Earlier, tooltip in left sidebar views had only the navigation list
title shown inside it.

This commit adds more information to the tooltip by including their
respective counts.

Fixes: zulip#25901.

Co-authored-by: ecxtacy <dc.dhruvchouhan@gmail.com>
2025-01-24 14:16:16 -08:00
Pratik Chanda
6c03d839f7 left_sidebar: Refactor tooltip logic for left sidebar navigation list.
Earlier, left sidebar navigation had two separate tooltip logic to
handle the same tooltip template.

This commit refactors it to use a single tooltip logic for the left
sidebar navigation.
2025-01-24 14:16:16 -08:00
whilstsomebody
733ab5f2f8 reactions: Remove emoji container when reaction count is 0.
While adding a new reaction, we create a new JQuery element
called "message_reaction_container" and append it to the
view to display the emoji.

Previously, when the reaction count became zero for an emoji,
we used to just remove the emoji but not the JQuery element
mentioned above, requiring a reload to remove it. This
inconsistency introduced a bug in the UI. causing unwanted
spaces between emojies as this element used to get accumulated.

This commit resolves the bug by introducing logic to remove
reaction containers with no reactions.

Fixes: #32983
2025-01-24 13:32:35 -08:00
apoorvapendse
6586d9078e copy_and_paste: Paste Excel copied content as image and text.
This ensures that using `^V` pastes the content from excel as
an image.
To get normal text in a formatted manner one can use
`^⇧V`.

The earlier conditions in `is_single_image` caused
the classification to fail in case of Excel pasted
content, which is why we check for the for the XML
namespaces associated with Microsoft in the pasted
HTML.

Fixes #32968.
2025-01-24 11:10:38 -08:00
Steve Howell
63cab557b5 event types: Introduce BaseEvent class.
Some checks failed
Code scanning / CodeQL (push) Has been cancelled
Zulip production suite / Ubuntu 22.04 production build (push) Has been cancelled
Zulip CI / ${{ matrix.name }} (zulip/ci:bookworm, true, false, Debian 12 (Python 3.11, backend + documentation), bookworm) (push) Has been cancelled
Zulip CI / ${{ matrix.name }} (zulip/ci:jammy, false, true, Ubuntu 22.04 (Python 3.10, backend + frontend), jammy) (push) Has been cancelled
Zulip CI / ${{ matrix.name }} (zulip/ci:noble, false, false, Ubuntu 24.04 (Python 3.12, backend), noble) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:bookworm, --test-custom-db, Debian 12 production install with custom db name and user, bookworm) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:jammy, , Ubuntu 22.04 production install and PostgreSQL upgrade with pgroonga, jammy) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:noble, , Ubuntu 24.04 production install, noble) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:bookworm-7.0, 7.0 Version Upgrade, bookworm) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:bookworm-8.0, 8.0 Version Upgrade, bookworm) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:jammy-6.0, 6.0 Version Upgrade, jammy) (push) Has been cancelled
Zulip production suite / ${{ matrix.name }} (zulip/ci:noble-9.0, 9.0 Version Upgrade, noble) (push) Has been cancelled
2025-01-23 16:33:10 -08:00
Aman Agrawal
b8e8c06bef message_summary: Add minor comment. 2025-01-23 16:29:42 -08:00
Aman Agrawal
673281aae8 message_fetch: Extract function to modify narrow before server query. 2025-01-23 16:29:42 -08:00
Steve Howell
a9b7b0e692 test helper: Use subscribe_via_post.
The shorter name more clearly describes what
it does and that it's the more expensive sibling
of simple subscribe.
2025-01-23 16:10:37 -08:00
Steve Howell
aaa8279cb8 testing doc: Update common setup methods.
The names of helpers have evolved over time.

I add a few, and I remove `common_subscribe_to_streams`,
since most tests just want the simpler subscribe.

Note that `subscribe`, while not full stack, does
excercise `bulk_add_subscriptions`. So there is no
real danger of having unrealistic test data.

Almost all of our uses of `common_subscribe_to_streams`
are in test_subs.py, so it's already effectively
our policy to use subscribe in most cases. And
test_subs does more than a thorough job of actually
exercising the API.
2025-01-23 16:10:37 -08:00
Steve Howell
0f8f5fafe1 test_example.py: Add new example with mock.patch.
The original mocking example now uses time_machine, so I slimmed
down a lot of its comments, and then I created another
mocking example so that we still touch on mocking in
terms of mock.patch.

The new method reinforces the pattern of testing both the
sad path and happy path inside the same test.
2025-01-23 16:10:37 -08:00
Steve Howell
d6bd3f7abc test_example.py: Clean up minor things.
I flipped an assert to have actual/expected in standard
Zulip order, renamed some variables, and tightened up
a few comments.
2025-01-23 16:10:37 -08:00
Tim Abbott
dd430e2b56 scroll_util: Fix typo caught by codespell. 2025-01-23 16:07:52 -08:00
Alya Abbott
1367f305b2 help: Update docs on permissions to subscribe other users to channels. 2025-01-23 16:02:26 -08:00
Alya Abbott
6fdbea5ee8 settings: Clarify option label for who can subscribe others to channels.
Also add help link.
2025-01-23 16:02:26 -08:00
Shubham Padia
2fdb4fe53c stream: Add conditional note to can_add_subscribers_group.
Fixes #33156.
If the stream is set to on the private settings for privacy, we add a
parenthesis text `must be subscribed`.
We had to use JS to change the string since just having a conditional in
the handlebars template would not ensure that the parenthesis text
appears or disappears on changing the value.
2025-01-23 15:57:16 -08:00
Shubham Padia
82c04ebe9e stream_types: Add admin permissions note below advanced configurations.
We've also removed the label_parens_text of `in addition to organization
administrators` wherever applicable.
2025-01-23 15:57:16 -08:00
Aman Agrawal
3d6baaf450 stream_list: Scroll selected topic into view when zoomed in.
This is useful for keyboard users when use `n` to navigate to the
next topic with zoomed in topic list.
2025-01-23 15:53:16 -08:00
Aman Agrawal
a5e2a7b4e4 topic_list: Fix top selected element not visible on system scroll.
Fixed by accounting for the fixed header in the topic list.
2025-01-23 15:53:16 -08:00
Aman Agrawal
dd33ad11f5 scroll_util: Account for $elem not direct child of scroll container.
When using `position` to get the scroll offset, it uses `offsetParent`
to calculate the offset which is not necessary the scroll container.

To account for this case, we use `offset` to correctly calculate
the position of element relative to the document.
2025-01-23 15:53:09 -08:00
Aman Agrawal
25cb87cdc3 left_sidebar: Fix bottom item not visible in left sidebar.
The last topic is not visible in left sidebar in zoomed_in state.
This is due to height of `views-label-container` not being accounted
for when calculating scrollable height of the topics list.
2025-01-23 15:51:31 -08:00
Sahil Batra
1c07c013ae groups: Do not include "Everyone on internet" group in typeaheads.
There is no reason to show "Everyone on internet" group in
group members, stream subscribers, silent mention and DM
recipient typeaheads since specatators cannot be added to
groups or streams, cannot be involved in DMs and cannot be
mentioned.
2025-01-23 15:41:19 -08:00
Sahil Batra
233b776ea5 stream-settings: Show system groups in subscribers form typeahead.
We now show role-based system groups in the subscribers typeahead
in stream creation and stream edit UI.
2025-01-23 07:53:18 +05:30
Karl Stolley
eda9b1a271 me_messages: Improve grid for me-message alignment. 2025-01-22 16:18:31 -08:00
Karl Stolley
1878758baf message_row: Prevent avatar margin from shifting grid row. 2025-01-22 16:18:31 -08:00
Karl Stolley
38c6b82022 message_row: Refine action-button layout to better scale. 2025-01-22 16:18:31 -08:00
Karl Stolley
90279af1ea action_buttons: Remove noop font-size declaration.
A 16px conversion at 16px/1em is unnecessary, and there are no
other font-size declarations in the area. So the base font-size
should be inherited as expected, allowing the button icons to
scale.
2025-01-22 16:18:31 -08:00
Karl Stolley
aecd3dff7d topic_edit: Remove show/hide logic on edit button.
This logic is superfluous, as action buttons are hidden unless
hovered, and when hovered, the `display: none` this sets is
overridden anyway.

Additionally, removing this avoids interference with the flexbox
presenting the action icons, which was causing elements in the
sender line (sender, as well as the timestamp) to visibly shift
out of place when editing the topic, only to see the layout
corrected upon hovering in the action-button area.
2025-01-22 16:18:31 -08:00
Greg Price
9883e41436 docs: Clarify design-discussions as to #mobile-design vs. #design.
We have an increasing number of design discussions about mobile
these days (which is great), and that means I've started to
regularly point people to this page -- particularly the section
"Guidelines for code contributors" -- as part of pointing them to
the #mobile-design channel to ask a design question.

In that context it seems confusing that it only talks about #design
and not #mobile-design.  We do mention the latter elsewhere on the
page, but I still feel I have to explain the discrepancy when
pointing to this section.  Fix it here instead.

This introduces to our docs the concept of "a design channel",
meaning #design and #mobile-design and sometimes #zulip-terminal.
2025-01-22 16:16:33 -08:00
Greg Price
fa06616f71 docs: Pull out named links for channels in design-discussions page.
This helps keep the source a bit more readable; and we'll shortly
add another pair of occurrences of these.
2025-01-22 16:16:19 -08:00
Shubham Padia
d79020f8e0 right_sidebar: Use em for empty list message font-size. 2025-01-22 16:15:57 -08:00
Niloth P
4fbe893431 css: Extend .markdown .zulip-icon styling outside .content. 2025-01-22 16:14:14 -08:00