Commit Graph

50652 Commits

Author SHA1 Message Date
Mateusz Mandera f3db618cb5 actions: Implement do_delete_user_preserving_messages function.
With an extensive docstring by tabbott documenting its limitations.

Co-authored-by: Tim Abbott <tabbott@zulip.com>
2023-03-29 12:51:21 -07:00
Prakhar Pratyush d8a5ca5ddc user_topics: Update test_edit_muted_topic to verify events sent.
Previously, there was a stale code that didn't verify
if 'muted_topics' and 'user_topic' events are sent correctly.

This commit updates the test to verify if the expected
users are notified via 'muted_topics' and 'user_topic'
events.
2023-03-29 09:50:06 -07:00
Prakhar Pratyush 117264fb37 user_topics: Update move-topic codepath to utilise bulk database operations.
This commit updates the move-topic codepath to perform
bulk database operations on the UserTopic record using
user_profiles for each visibility_policy instead of
previously looping over each user_profile one by one.
2023-03-29 09:50:06 -07:00
Prakhar Pratyush 60762a750b user_topics: Update 'set visibility policy' codepath for bulk db operations.
This commit refactors 'set_user_topic_visibility_policy_in_database'
to perform bulk database operations and the related changes.

There is an increase in database query count because requests
to delete user_topic rows now take two queries instead of one.
This is required for logging the info for a request to delete
a non-existent user_topic row while performing bulk operations
at the same time.

The overall query count will be lower while performing
bulk operations (multiple user_profiles instead of one).
2023-03-29 09:50:06 -07:00
Prakhar Pratyush a890aaf34d user_topics: Update UserTopic records regardless of the visibility_policy.
This commit updates the 'do_update_message' codepath to
update the UserTopic records regardless of visibility policy
during the "move-topic" operation.

This is required before offering new visibility policies
in the UI.

Previously, UserTopic records were moved or deleted only
for objects with a MUTED visibility policy.

Fixes: #24574
2023-03-29 09:50:06 -07:00
Prakhar Pratyush 0377085f15 user_topics: Update a comment regarding the database query count.
This commit updates a stale comment regarding query count
to its correct value.
2023-03-29 09:50:06 -07:00
Prakhar Pratyush e1ec814507 user_topics: Add a test helper to improve readability.
This commit adds a test helper function that helps
to remove line wrappings and improve readability.
2023-03-29 09:50:06 -07:00
Prakhar Pratyush 0ec9ff17ce user_topics: Update lib functions to work with any visibility_policy.
This is a prep commit that renames 'set_topic_mutes' and
'topic_is_muted' to 'set_topic_visibility_policy' and
'topic_has_visibility_policy' respectively, and refactors
them to work with any visibility_policy, not only MUTED.
2023-03-29 09:50:06 -07:00
Adarsh Tiwari 78fdb6135a
ts: Migrate gear_menu.js to TypeScript.
Includes adding various missing values to page_params.
2023-03-29 09:36:52 -07:00
Ujjawal Modi de8148bc9e notifications: Warn if all PM notifications will be disabled.
This PR adds a modal to warn when user unchecks a box on the "PMs,
mentions, and alerts" line of notifications panel that will result in
all notifications for private messages and mentions being disabled.

Fixes #24151.
2023-03-28 18:36:56 -07:00
Aman Agrawal ddb0a6bae9 recent_conversation: Fix possibility of undefined topic row.
`topic_row_top = $(topic_row).offset().top;` returns an error
while calling `topic_offset_to_visible_area` since we cannot
find the `topic_row` for some reason which doesn't seem logically
possible but we add logic to handle that case as well.
2023-03-28 17:01:31 -07:00
Tim Abbott b75b40cfa3 compose: Hide compose loading spinner after all failures.
The compose send button spinner (which disables the send button while
present) was correctly hidden in both the happy case of a sent message
as well as for all locally echoed message, in both cases via
clear_compose_box to reset the compose box for a new message.

But for a message that was not locally echoed, and failed to send,
nothing hid the compose spinner, resulting in the user being unable to
attempt to resend the message.
2023-03-28 16:47:12 -07:00
Tim Abbott 43fe61df1f compose: Fix disabled state for compose send button.
Disabling the send button was intended to prevent sending the same
message twice in immediate succession via the enter key.

Since a13058223d, this logic duplicates
the compose_spinner_visible check inside finish(), and more
importantly, was not cleaned up correctly if the message fails to send
without having been locally echoed, resulting in the compose box not
allowing you to send further messages after such a failure.

For successfully sent messages, the disabled state was cleared by
clear_compose_box calling check_overflow_text, which unconditionally
sets the disabled state on the send button based on whether the
message is too long.

Rather than try to clean this state up in the right places, remove
this duplicate mechanism for disabling the compose box.
2023-03-28 16:47:12 -07:00
Joelute a2a9e53423 integration: Refactor `get_issue_event_message` to use kwarg.
Previously, some call sites for the function provided optional
arguments as positional arguments. These changes will allow the
arguments to be passed as keyword arguments to the function and
fix up the call sites of the function to pass keyword arguments
instead.
2023-03-28 15:51:43 -07:00
Joelute a2c578e84d integration: Refactor `get_pull_request_event_message` to use kwarg.
Previously, some call sites for the function provided optional
arguments as positional arguments. These changes will allow the
arguments to be passed as keyword arguments to the function and
fix up the call sites of the function to pass keyword arguments
instead.
2023-03-28 15:51:43 -07:00
nzai 97ff259506 ts: Migrate narrow_error to TypeScript.
This commit migrates narrow_error.js to TypeScript by inferring the
required types in the file and defining types in types.ts.
2023-03-28 15:04:57 -07:00
Daniil Fadeev 602be3ed68 popovers: Refactor compose_enter_sends popover. 2023-03-28 14:51:56 -07:00
Daniil Fadeev 39936dee5d popovers: Refactor compose_control_buttons visibility checking. 2023-03-28 14:51:56 -07:00
Daniil Fadeev 729d3cfc30 popovers: Refactor compose_mobile_button visible check logic. 2023-03-28 14:51:56 -07:00
Daniil Fadeev 2bc6fdca23 popovers: Refactor stream_settings popover keyboard handling. 2023-03-28 14:51:56 -07:00
Daniil Fadeev a0c98bc70a popovers: Refactor message_actions popover keyboard handling. 2023-03-28 14:51:56 -07:00
Daniil Fadeev 1337c0fec1 popovers: Migrate "all messages" popover to Tippy. 2023-03-28 14:51:56 -07:00
Daniil Fadeev edb293c3da popovers: Migrate "drafts" popover to Tippy. 2023-03-28 14:51:56 -07:00
Daniil Fadeev 22561e2f3b popovers: Refactor keyboard handling for starred messages popover. 2023-03-28 14:51:56 -07:00
Daniil Fadeev 1f24addb88 popovers: Add shared keyboard handling for popovers.
This new system lets us handle detection and keyboard navigation in
popovers with just a a few lines of simple code for each individual
popover.
2023-03-28 14:51:56 -07:00
Daniil Fadeev db61dd71e3 popovers: Extract default tippy options for the left sidebar. 2023-03-28 14:51:56 -07:00
Ujjawal Modi f404dbddb2 recent_conversations: Exclude muted user PMs from recent conversations.
Earlier muted private conversations were shown in recent
conversations. This commit excludes them from recent conversations.

Fixes #24299.
2023-03-28 14:40:50 -07:00
Ujjawal Modi bfc5092082 recent_conversations: Change name of muted user in group PMs huddle.
Earlier in recent conversations panel full name
was displayed in group PMs huddle even if the user
was muted.
This commit change the display name of such users to
`Muted Users`.
2023-03-28 14:40:50 -07:00
Ujjawal Modi 87215d1a98 recent_conversations: Parsing of user_ids is done using function call.
This commit refactors the code for parsing the user_ids in
`pm_conversations.js` by making a function call to parse user_ids.
2023-03-28 14:40:50 -07:00
Lauryn Menard 7b225245c0 tests: Update ZulipTestCase.tearDown to remove local uploads.
Previously, tests that exercised code paths that added local
uploads did not always clean up `settings.LOCAL_UPLOADS_DIR`
after the test was complete.

Updates the `ZulipTestCase` class to remove any local uploads
in the unique `settings.LOCAL_UPLOADS_DIR` in `tearDown` for
all tests.
2023-03-28 14:38:06 -07:00
Sahil Batra a6fd41e012 migrations: Fix comment in 0403.
This commit fixes the file name in comment in
0403_create_role_based_groups_for_internal_realms.py.
2023-03-28 14:26:22 -07:00
Sahil Batra bed2bf64c4 user_groups: Add "Nobody" system user group.
This commit adds code to create a "Nobody" system user group
to realms which will be used in settings to represent "Nobody"
option.

We also add a migration to add this group to existing realms.
2023-03-28 14:26:22 -07:00
Pranav2612000 ecead64718 markdown: Render larger emojis inside headings
Previously, the emoji size was fixed to 20px by 20px irrespective of
whether the emojis were inside a heading or not. This looked weird when
a small emoji was rendered next to a large h1 text.

This commit fixes that by setting the emoji height to 1.4em
which proportionately increases the size of the emojis as the text size
increases for different headings.

Fixes #12857
2023-03-28 09:17:02 -07:00
Sahil Batra 0c8f74d6e2 streams: Fix dropdown-list-widget menu in stream creation form.
The dropdown-menu for "Who can unsubscribe others" was not wide
enough to fit the options in stream creation form. This commit
fixes it to be wide enough to fit the options like we do in
stream edit form.
2023-03-28 09:14:54 -07:00
Sahil Batra 00abffda98 settings: Fix dropdown-list-widget menu for short options.
The dropdown menu for notification stream, default code block
language, etc. was not looking good for short options due to
width being set to fit-content. This commit adds min-width
property to make them look good for short options as well.
2023-03-28 09:14:54 -07:00
Sahil Batra c5ff78a933 bootstrap: Remove width property for inputs.
This commit removes the width property for inputs from
bootstrap.css. We have already set the width for the
specific text inputs in previous commits. For other
type of inputs (like checkbox, radio, file, etc.),
there is no need to set the width as they are hidden
or we already set width for them.

This is a part of bootstrap removal project.
2023-03-27 22:34:30 -07:00
Sahil Batra 40f2865328 integrations_dev_panel: Add width CSS property for text inputs.
This commit adds width property CSS rule for text inputs in
integrations_dev_panel.css to 206px, as we are going to remove
the bootstrap CSS rule which sets width in further commits.
2023-03-27 22:34:30 -07:00
Sahil Batra 30f8c77151 billing: Add width property CSS for text inputs.
This commit adds width property CSS rule for text inputs
in billing.css to 206px, as we are going to remove the
bootstrap CSS rule which sets width to 206px in further
commits.
2023-03-27 22:34:30 -07:00
Sahil Batra 00ec5a3752 activity: Add width property CSS for inputs.
This commit adds width property CSS rule for text
inputs in activity.css to 206px, as we are going to
remove the bootstrap CSS rule which sets width to
206px in further commits.
2023-03-27 22:34:30 -07:00
Sahil Batra 9615d4ba05 widgets: Add CSS to set width of inputs.
This commit adds CSS to set width of text inputs in
poll and todo widgets to 206px as we will be removing
the bootstrap CSS rule which sets width of inputs to
206px in further commits.
2023-03-27 22:34:30 -07:00
Sahil Batra 52619657ca css: Add width property to CSS for #inline_topic_edit element.
This commit adds width property to CSS for "#inline_topic_edit"
element in zulip.css to set it to 206px, as we will be removing
the bootstrap CSS for it in further commits.
2023-03-27 22:34:30 -07:00
Sahil Batra e1877ce57e settings: Add settings_text_input class to text inputs.
This commit adds settings_text_input class to text inputs in
settings, stream settings and user group settings pages. This
class is used to set the width of inputs to 206px, as we will
be removing the boostrap rule which sets width of the input
in further commits.
2023-03-27 22:34:30 -07:00
Sahil Batra 1c6bed55e4 modals: Add modal_text_input class to text inputs.
This commit adds modal_text_input class to text inputs
in modals to set width of them as set by bootstrap.
This class is used to set the width of inputs to 206px,
as we will be removing the boostrap rule which sets width
of the input in further commits.
2023-03-27 22:34:30 -07:00
Sahil Batra dcce524376 settings: Increase width of url field in edit custom field form.
This commit increases the width of url field, displayed for
custom external account type fields, in edit profile field
form. The width of the input is increased as urls are generally
long enough and did not fit in the width set previously in most
cases. We increase the width to match the width in add custom
profile field form.
2023-03-27 22:34:30 -07:00
sbansal1999 a8b5167f89 ts: Convert portico/team.js to TypeScript.
This commit converts "portico/team.js" to TypeScript as well
as adds the required type definitions.

Some values were extracted into variables for type-checking.
2023-03-27 22:33:54 -07:00
sbansal1999 cc6661f777 team: Pop contributors from page_params.
Avoiding access to the "page_params" results in a cleaner interface
for conversion to TypeScript.
2023-03-27 22:33:54 -07:00
sbansal1999 23ff970cf5 portico: Add missing tab_name parameter in teams page.
The `tab_name` parameter is supposed to ensure that if you're looking
at a tab for repository that's not zulip/zulip, that the GitHub links
for authors without an associated GitHub username goes to the commits
for that repository.
2023-03-27 22:33:54 -07:00
Tim Abbott 50b91fe5c7 portico: Fix incorrect fallback contributors data type.
Previously, using this without having run fetch-contributors-data
would throw an exception trying to call .filter on an empty
dictionary.
2023-03-27 22:33:54 -07:00
Anders Kaseorg eb572e525a stream_color: Fix duplicate ids for colored privacy icons.
This also fixes the color on these icons in the stream-specific rows
of the notification settings table.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-27 22:24:45 -07:00
Karl Stolley deabb8ed53 docs: Document preference for hyphenated class and ID values.
This clarifies that kebab case should be the preferred style for
multiword classes in HTML and CSS.
2023-03-27 17:31:31 -07:00