Commit Graph

59575 Commits

Author SHA1 Message Date
Anders Kaseorg 48202389b8 ruff: Bump target-version from py38 to py310.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-07-13 22:28:22 -07:00
Anders Kaseorg 3f29bc42b1 ruff: Fix B905 `zip()` without an explicit `strict=` parameter.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-07-13 22:28:22 -07:00
Anders Kaseorg 1464009fae ruff: Fix UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)`.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-07-13 22:28:22 -07:00
Anders Kaseorg 0fa5e7f629 ruff: Fix UP035 Import from `collections.abc`, `typing` instead.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-07-13 22:28:22 -07:00
Anders Kaseorg 531b34cb4c ruff: Fix UP007 Use `X | Y` for type annotations.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-07-13 22:28:22 -07:00
Anders Kaseorg e08a24e47f ruff: Fix UP006 Use `list` instead of `List` for type annotation.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-07-13 22:28:22 -07:00
Anders Kaseorg c2214b3904 test_typed_endpoint: Inline pointless type variable.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-07-13 22:28:22 -07:00
Anders Kaseorg f04e7fc625 test_openapi: Make get_standardized_argument_type understand X | Y.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-07-13 22:28:22 -07:00
Anders Kaseorg a2fad74a28 typed_endpoint: Make is_optional understand T | None.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-07-13 22:28:22 -07:00
evykassirer f23fdede67 search pills: Align icons on top row.
This reverts #30804. We need a followup PR to address the
issue that PR was trying to solve without breaking icon
alignment.
2024-07-13 11:38:11 -07:00
Vector73 d895ca287f tooltips: Make size of tooltips consistent.
Uses a variable for defining font-size on tooltips instead of `1em`.
2024-07-13 07:34:21 -07:00
Tim Abbott b747bd4487 narrow_state: Disable coverage requirement for unlikely case.
I'm not actually sure if this is possible; it's been copy/pasted from
the channel/topic code path, but even with that one, it seems like the
topic being `undefined` is impossible (that's not how operators work),
and the channel being undefined might be something that should fail in
`Filter` initialization, not here.
2024-07-13 07:28:52 -07:00
Aman Agrawal 70be9e8c51 narrow: Implement rendering of `with` narrow operators.
Adds server and web app support for processing the new `with`
search operator.

Fixes part of #21505.

Co-authored-by: roanster007 <rohan.gudimetla07@gmail.com>
Co-authored-by: Tim Abbott <tabbott@zulip.com>
2024-07-13 07:18:24 -07:00
bedo bfd54e27b1 custom_profile_fields: Bulk fetch of UserProfile.
bulk fetch query of UserPfrofile against which
user_ids are validated, instead of looping
over user_ids and fetchingeach UserPfrofile resulting
in O(n) queries.
2024-07-13 07:05:13 -07:00
Vector73 e9b796c0be group_settings: Change tooltip on add members input box. 2024-07-13 07:04:08 -07:00
Aman Agrawal b5b3391d0d typeahead: Fix alignment of secondary text of typeahead. 2024-07-13 07:03:46 -07:00
Aman Agrawal a46b075e0e typeahead: Restore line height to original value.
e5e5ba6cea reduce the line height
of the typeaheads, which doesn't look for stream typeaheads. We
restore it back to original value.
2024-07-13 07:03:46 -07:00
Alya Abbott bd04a30bbc updates: Add update message (level=6). 2024-07-12 16:40:41 -07:00
Alya Abbott 30cc561d61 help: Note more flexible DM permissions. 2024-07-12 16:40:41 -07:00
Alya Abbott 118fe2b1f8 help: Update documentation on linking to topics and channels. 2024-07-12 16:09:07 -07:00
Shubham Padia 054f08c6df user_group_pill: Exclude inactive members from pill.
While using the pill in `stream_create`, it was noticed that deactivated
users were also part of the user_ids returned by the user_group_pill,
which we do not want to do.
This pill is used in two areas: compose box and stream create/edit.
This commit will only affect stream create/edit since compose box was
just using the typeahead data from user_group_pill and nothing else.
Stream and user pill handle inactive users already, so no change is
needed there.
2024-07-12 15:22:50 -07:00
Shubham Padia e9166fe6f7 user_group_pill: Internationalize display_pill string. 2024-07-12 15:22:50 -07:00
Shubham Padia 5b57ed959e user_pill: Use group pills to add all users.
Fixes #30690.

Before this, we were adding all users to subscriber list without adding
any pill. But, since we want pills to be the source of truth for adding
the subscribers, we will just add the `role:everyone` pill from now on
whenever `Add all users` is clicked.

While we can just directly call `pill_widget.appendValue` in
`stream_create_subscribers`, it's better to expose an API from
`add_subscribers_pill` and use that. This lets us control how appending
an item would work for subscriber pill in a single place.
2024-07-12 15:22:50 -07:00
Shubham Padia 2b572628d0 user_group_popover: Don't show group settings link for system groups.
System groups are immutable and that's why we should remove the group
settings link from the group popover for system groups.
2024-07-12 15:22:50 -07:00
Shubham Padia 20f83b944f user_group_popover: Add support for displaying subgroup members.
We list all the members of a group including recursive subgroup members
in the user group popover.

We also add another change in this commit to show `Everyone` if the
group name is `role:everyone` by using
`user_groups.get_display_group_name`.
2024-07-12 15:22:50 -07:00
Shubham Padia be5e0d4648 user_group_pill: Hardcode `Everyone` in display name.
For system groups, the directive is that we should use the description
as the display name. But in case of `role:everyone`, the description is
`Admins, moderators, members and guests`, while for the
`user_group_pill`, we want to display a simpler and succinct message:
`Everyone`. We've only hardcoded this for user_group_pill since we don't
want to display the name as `Everyone` anywhere else yet.

We've also exposed a method called `get_display_group_name` which will
be used in later commits to get the group display name.
2024-07-12 15:22:50 -07:00
Shubham Padia 458038b384 user_group_pill: Add support for subgroups.
While the support to include all members of a subgroup is needed only in
the `stream_create` context for now, we have added the support for
subgroups to `user_group_pill` for all cases. We have done this because
that is still going to be the correct behaviour if we add similar
support to other pill inputs.

In terms of calculating and populating the recursive member list, it was
decided not to do it when initializing the user_groups data. One reason
for that was it would introduce a lot more complexity when adding or
removing members from any of the subgroups to keep the recursive member
list updated. Keeping in line with the general pattern of calculating
recursive subgroups on the fly too, it was decided to calculate the
recursive list of members on the fly too.

Also changes the `get_group_ids` tests to make sure that subgroup ids
are not part of the result of `get_group_ids`. Since it is used to
calculated taken_groups, we don't want to filter out subgroups as part
of taken_groups and their typeahead should still be visible.
2024-07-12 15:22:50 -07:00
Shubham Padia 9f7dc596f8 user_groups: Add get_recursive_group_members.
This function goes through all subgroups recursively and returns the
resultant set of the members of those subgroups in addition to the
members of our target_group.

This function is required in order to add the `everyone` pill to create
channel flow.

For the tests written in this commit, it uses the same pattern as the
`get_recursive_subgroups` test.

`is_user_in_group` could have been technically refactored to use
`get_recursive_group_members`, but since the former returns early for
direct members, I've let it be for now.
2024-07-12 15:22:50 -07:00
Shubham Padia c7e59ed761 user_group_pill: Remove unnecessary truthy filter on user_ids.
The filter was not doing anything to the user_id array, not sure why it
was introduced in ce4cf66f3f.
2024-07-12 15:22:50 -07:00
Kislay Verma ffd49ac35b compose: Transform stream/topic urls on paste.
Transforming valid stream/topic urls  to the #**stream>topic**
syntax.
- A valid url contains a stream and optionally a topic
 but nothing else, and in that order.
 It must belong to the same origin as the Zulip server.
 The stream id present in the pasted url should
  correspond to an actual stream in the current
  server.
- `near` links are not transformed.
- Use-mention distinction is respected by
  not transforming a valid url if pasted using
  `Ctrl+Shift+V`.
- No transformation occurs inside a code block.
-  On pressing `Ctrl+Z` after pasting,
  the actual pasted link is restored.
- No transformation occurs if the url is pasted over an
 existing url in a markdown link syntax.
- No transformation occurs if the stream or topic name
contained in the pasted url is known to produce broken
 stream/topic syntax links (as per #30071).

Fixes #29136
2024-07-12 15:15:10 -07:00
Lauryn Menard 759c066d05 help: Suggest invitation link for Cloud email invite rate limit. 2024-07-12 15:14:54 -07:00
evykassirer 2e3f11134e search: Fix bug where exit button jumps when clicked. 2024-07-12 15:14:05 -07:00
adnan-td 6f4d14ddde stream_pill: Add channel privacy icons in input_pill.
Modify stream pills to add channel privacy decorations inside
input pills for areas eg: the UI for adding members to a channel.

Partly fixes: #25257.
2024-07-12 15:00:02 -07:00
evykassirer 9e096382cd search pills: Fix bug closing multiple pills on fresh open.
`on_search_contents_changed` resets the search bar on input
change in the "freshly opened" state. We shouldn't be calling
this when removing pills, since removing pills should always
remove the freshly opened state, not reset the search bar.

This bug was reported on CZO:
https://chat.zulip.org/#narrow/stream/9-issues/topic/.F0.9F.8E.AF.20message.20search.20'x'.2Fdelete/near/1883828
2024-07-12 14:59:03 -07:00
evykassirer 31ed5d597b search: Enlargen x button in search bar. 2024-07-12 13:36:42 -07:00
Alex Vandiver 4df9b03451 migrations: Re-thumbnail and rename existing emoji. 2024-07-12 13:26:47 -07:00
Alex Vandiver 0385e5bab9 emoji: Store in S3 with a long public cache-control. 2024-07-12 13:26:47 -07:00
Alex Vandiver 0442e95276 emoji: Use a non-predictable filename.
We use a truncated SHA256 of the id and a server-side secret to make
emoji have non-guessable filenames, while also making collisions
unlikely.

We also adjust the Slack import to use the same SHA-based name,
instead of taking the same name as it had in Slack.
2024-07-12 13:26:47 -07:00
Alex Vandiver 49c0f7306e thumbnail: Increase logging level to ERROR and above.
Warnings are quite common when dealing with bogus image data.
2024-07-12 13:26:47 -07:00
Alex Vandiver 262689da76 thumbnail: Fix MAX_EMOJI_GIF_FILE_SIZE_BYTES check to be post-resize.
This check was intended to check the post-resized image size, not the
pre-resized image.
2024-07-12 13:26:47 -07:00
Alex Vandiver 544d3df057 thumbnail: Stop applying MAX_EMOJI_GIF_FILE_SIZE_BYTES before resizing.
b14a33c659 attempted to make the 128k limit apply _after_ resizing,
but left this check, which examines the pre-resized image size.
2024-07-12 13:26:47 -07:00
Alex Vandiver 54f2fabac0 thumbnail: Still emoji are always pngs. 2024-07-12 13:26:47 -07:00
Alex Vandiver 6110ac7339 emoji: Use a transaction, rather than create and delete-on-fail. 2024-07-12 13:26:47 -07:00
Alex Vandiver 2b3da0e70f fixup! thumbnail: Fix MAX_EMOJI_GIF_FILE_SIZE_BYTES check to be post-resize. 2024-07-12 13:26:47 -07:00
Alex Vandiver f6b99171ce emoji: Derive the file extension from a limited set of content-types.
We thumbnail and serve emoji with the same format as they were
uploaded.  However, we preserved the original extension, which might
mismatch with the provided content-type.

Limit the content-type to a subset which is both (a) an image format
we can thumbnail, and (b) a media format which is widely-enough
supported that we are willing to provide it to all browsers.  This
prevents uploading a `.tiff` emoji, for instance.

Based on this limited content-type, we then reverse to find the
reasonable extension to use when storing it.  This is particularly
important because the local file storage uses the file extension to
choose what content-type to re-serve the emoji as.

This does nothing for existing emoji, which may have odd or missing
file extensions.
2024-07-12 13:26:47 -07:00
Alex Vandiver 62a0611ddb emoji: Pass down content-type, rather than guessing from extension. 2024-07-12 13:26:47 -07:00
Alex Vandiver f3473defe1 transfer: Log when local emoji files are missing. 2024-07-12 13:26:47 -07:00
Alex Vandiver fa28e3aa0f tests: Split up test_upload.EmojiTest into test_thumbnail. 2024-07-12 13:26:47 -07:00
evykassirer 57cb4321b1 search pills: Align typeahead text with pills. 2024-07-12 13:25:36 -07:00
PieterCK f5a834c2d6 integration-docs: Update Jotform for new doc format.
Part of #29592.
2024-07-12 13:21:07 -07:00