Commit Graph

19720 Commits

Author SHA1 Message Date
Anders Kaseorg
cb0560d734 narrow: Add access restrictions to get_base_query_for_search.
This mirrors the restrictions in
zerver.lib.message.bulk_access_stream_messages_query, in order to
prevent leftover UserMessage rows from granting access to messages the
user was previously allowed to access but no longer is.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-03-14 16:24:34 -07:00
Anders Kaseorg
dc22b5d4bf narrow: Remove get_base_query_for_search need_message optimization.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-03-14 16:24:34 -07:00
Anders Kaseorg
7e75166b5f message_fetch: Use get_base_query_for_search in messages_in_narrow_backend.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-03-14 16:24:34 -07:00
Anders Kaseorg
5a56b53689 narrow: Add flags column outside get_base_query_for_search.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2025-03-14 16:24:34 -07:00
Prakhar Pratyush
7cd0fc645b onboarding: Add navigation_tour_video_text in initial DM by welcome bot.
This commit adds a line in the initial DM sent to new users by
the welcome bot regarding the new navigation tour video.
2025-03-13 14:38:16 -07:00
Prakhar Pratyush
5f3896710f onboarding_steps: Add 'navigation_tour_video' for new users.
This commit adds a one-time modal to display navigation tour
video to new users.

Includes an `NAVIGATION_TOUR_VIDEO_URL` server-setting to specify
the video's URL. When set to None, the modal is not displayed.

Fixes #29304.
2025-03-13 14:38:16 -07:00
Prakhar Pratyush
c70a3ffb0a populate_db: Mark onboarding steps as seen for existing users.
This commit updates populate_db to mark all onboarding steps as seen
for existing users to avoid unnecessary popups during development.

Developers should create a new user in development environment
to test the onboarding steps.
2025-03-13 14:38:16 -07:00
Vector73
b31024be47 saved_snippets: Add support for editing saved snippets.
Fixes #33708.
2025-03-13 10:58:36 -07:00
Alex Vandiver
75cf33079a filters: Do not report AVATAR_SALT, or other salts. 2025-03-13 09:36:07 -07:00
roanster007
2c548d4856 settings: Allow "resolve topic" permissions to be managed independently.
This commit separates the "resolve topic" permissions from the
topic editing permissions, through the introduction of setting -
"can_resolve_topics_group" which user group whose members
can resolve topics.

Fixes #21811
2025-03-12 19:32:35 -07:00
Sahil Batra
0053c64f37 groups: Anonymous group member and subgroup IDs should be sorted.
We now return the members and subgroups ID list sorted for
settings that are set to anonymous groups. This is needed to
make sure we do not show save discard buttons when only pill
order is changed.
2025-03-12 17:18:05 -07:00
Sahil Batra
943e754a90 streams: Do not include deactivated users in group setting values.
This commit fixes the code to not include deactivated groups in
stream setting values when the setting is set to an anonymous
group. This is consistent with what we do for realm and user
group settings.

As a result, we also deduplicate some code by using existing
function used for realm and group settings.
2025-03-12 17:14:05 -07:00
Aman Agrawal
eae11d9056 user-group: Use 2 user cog icon for user group settings. 2025-03-12 09:14:37 -07:00
Tim Abbott
887e3faa31 narrow: Fix -in:home logic when nothing is muted.
This didn't have test coverage, and was incorrectly a noop.
2025-03-11 23:18:07 -07:00
opmkumar
4f462970e4 search: Add is-muted search operator.
Add the `is:muted` search operator.
`-is:muted` is an alias for the `in:home` operator.

Co-authored-by: Kenneth <Kenneth012004@outlook.com>

Fixes #16943
2025-03-11 23:18:07 -07:00
Tim Abbott
9849048d6e message_edit: Add last_moved_timestamp to API message objects.
This will allow clients to display MOVED/EDITED indicators, and their
tooltips, without interacting with the `edit_history` section of
message objects, which we plan to remove in the future.

Supporting that requires both introducing both last_moved_timestamp,
and changing the definition of last_edit_timestamp to not include
message moves, which involves recalculating it at the API layer.

The last_moved_timestamp is not present if the topic moves for the
message are for resolving or unresolving the topic. It is always
present for channel moves.

Co-authored-by: Lauryn Menard <lauryn@zulip.com>
2025-03-11 16:42:28 -07:00
Lauryn Menard
345ea92b01 help: Document org setting to allow viewing only message moves.
Documents organization setting that configures what message edit
history can be viewed: content edits and topic/channel moves, only
topic/channel moves, or disabling viewing edit history completely.

Renames article to match new help article header and creates URL
redirect for previous article header.

Also, clean up and consolidate related articles.

Fixes #33684.

Co-authored-by: Alya Abbott <alya@zulip.com>
2025-03-11 12:26:21 -07:00
Lauryn Menard
ba21796cb4 middleware-test: Use "restrict-wildcard-mentions" for admonition test.
Use "restrict-wildcard-mentions" for open graph test of admonition
and link in the help article main description, instead of
"disable-message-edit-history" since that help article will be
revised to use a shared intro include file.
2025-03-11 12:26:21 -07:00
Vector73
58f16468ca api_docs: Add Changes entry for removing is_billing_admin. 2025-03-11 09:38:36 -07:00
Alex Vandiver
721fd26442 send_email: Set the Date header according to local enqueue time.
Email clients tend to sort emails by the "Date" header, which is not
when the email was received -- emails can be arbitrarily delayed
during relaying.  Messages without a Date header (as all Zulip
messages previously) have one inserted by the first mailserver they
encounter.  As there are now multiple email-sending queues, we would
like the view of the database, as presented by the emails that are
sent out, to be consistent based on the Date header, which may not be
the same as when the client gets the email in their inbox.

Insert a Date header of when the Zulip system inserted the data into
the local queue, as that encodes when the full information was pulled
from the database.  This also opens the door to multiple workers
servicing the email_senders queue, to limit backlogging during large
notifications, without having to worry about inconsistent delivery
order between those two workers.

Messages which are sent synchronously via `send_email()` get a Date
header of when we attempt to send the message; this is, in practice,
no different from Django's default behaviour of doing so, but makes
the behaviour slightly more consistent.
2025-03-10 16:48:08 -07:00
Sahil Batra
e2d9d069e0 settings: Remove dense_mode setting. 2025-03-10 16:07:37 -07:00
Sahil Batra
d8bc2f350e settings: Remove conditions for dense_mode setting. 2025-03-10 16:07:37 -07:00
Mateusz Mandera
c031cf9275 import: Fix export/import of SavedSnippet.
This table's export and import weren't working:
1. It didn't have a Config in export.py, so it wasn't exported at all.
2. Its `date_created` wasn't registered in `DATE_FIELDS`.
3. It wasn't registered in `ID_MAPS` in import_realm.py, so having any
   SavedSnippets in the export would cause the import to fail with an
   exception.
4. It was missing a `fix_datetime_fields` call in its import codepath.
2025-03-10 13:07:56 -07:00
Mateusz Mandera
acb1731bf9 export: Fix export of child tables when exporting mirror dummy users.
Without this change, the child tables of UserProfile didn't get their
objects exported if those objects were tied to a mirror dummy user.

For example, a `Recipient` of type `PERSONAL`, or the associated
`Subscription` would not get exported. Same for other tables with
foreign keys to `UserProfile` - such as `UserPresence`.

This happened because the Configs for the export are defined as follows:

```python
user_profile_config = Config(
    custom_tables=[
        "zerver_userprofile",
        "zerver_userprofile_mirrordummy",
    ],
    # set table for children who treat us as normal parent
    table="zerver_userprofile",
    virtual_parent=realm_config,
    custom_fetch=custom_fetch_user_profile,
)

user_subscription_config = Config(
    table="_user_subscription",
    model=Subscription,
    normal_parent=user_profile_config,
    filter_args={"recipient__type": Recipient.PERSONAL},
    include_rows="user_profile_id__in",
)

Config(
    table="_user_recipient",
    model=Recipient,
    virtual_parent=user_subscription_config,
    id_source=("_user_subscription", "recipient"),
)
```

while in `export_from_config` we have:
```python
    elif config.normal_parent:
        # In this mode, our current model is figuratively Article,
        # and normal_parent is figuratively Blog, and
        # now we just need to get all the articles
        # contained by the blogs.
        model = config.model
        assert parent is not None
        assert parent.table is not None
        assert config.include_rows is not None
        parent_ids = {r["id"] for r in response[parent.table]}
```

This meant that when processing a table with
`normal_parent=user_profile_config`, the `parent_ids` above would only
have the ids of `UserProfile` objects under the `zerver_userprofile` key in
the exported data - completely missing those in
`zerver_userprofile_mirrordummy`.
2025-03-10 13:07:56 -07:00
Tim Abbott
f4bb1ac30f realms: Require a non-empty set of users who can manage billing.
This isn't a configuration that's useful, and it seems marginally
helpful to make it hard to end up in a state where this is the empty
set.
2025-03-10 11:50:22 -07:00
Tim Abbott
4cfaf18145 api: Increment API feature level to 363. 2025-03-10 09:36:30 -07:00
Vector73
c049259d07 user: Remove is_billing_admin user property.
Removed `is_billing_admin` user property as it is no longer used since
billing permissions are now determined by `can_manage_billing_group`
realm setting.
2025-03-10 09:36:30 -07:00
Tim Abbott
e9334abbf4 events: Reorder fetch_initial_state_data. 2025-03-10 09:36:30 -07:00
Vector73
158fd58cde settings: Add "can_manage_billing_group" realm setting.
Added "can_manage_billing_group" realm group permission setting
to control who can manage billing and plans in the organization.

Fixes #32745.
2025-03-10 09:36:30 -07:00
Alex Vandiver
2a0f3c9746 message_send: Do not attempt to place a set into a message event.
This would have triggered exceptions in production, since orjson
cannot serialize sets.
2025-03-10 09:35:02 -07:00
Alex Vandiver
583ec00db7 zulip_update_announcements: Add missing close-paren. 2025-03-10 09:19:51 -07:00
Tim Abbott
f50235098e api_docs: Document API changes to archived channels. 2025-03-07 18:08:41 -08:00
sanchi-t
200606902a stream: Send archived channels for non-subscribed channels.
Allows admins to view archived streams of non-subscribed
channels in the channel settings.
2025-03-07 18:08:41 -08:00
Tim Abbott
c58f14b159 streams: Allow editing subscriptions in archived channels.
Since this does impact the ability to access the channel's content, it
makes sense to permit changing subscriptions, just like other
permissions settings on the archived channel.
2025-03-07 18:08:41 -08:00
Tim Abbott
5b2bd07612 streams: Require content access to change channel privacy.
This code path had not been properly updated for the new ways of
having content access to a channel.

Also adjust the error messages for missing content access.
2025-03-07 18:08:41 -08:00
Tim Abbott
494f28c64e streams: Add require_active_channel access parameter. 2025-03-07 18:08:41 -08:00
Tim Abbott
f68692a893 access_stream: Use mandatory kwargs. 2025-03-07 18:08:41 -08:00
Tim Abbott
e92d68fffe streams: Remove require_active in access_stream code path.
This was confusingly doing an assertion about the subscription being
active, not the channel. We could rename it to
require_active_subscription. But it was only passed with a non-default
value in b2cb443d24, and that call was
removed in 378062cc83.
2025-03-07 18:08:41 -08:00
Tim Abbott
322199efeb test_subs: Fix stale stream object in archive tests. 2025-03-07 18:08:41 -08:00
Alya Abbott
931dc92f93 help: Split out call provider config into separate page. 2025-03-06 13:31:13 -08:00
Karl Stolley
80dcd53b59 youtube: Request medium-quality preview images. 2025-03-05 13:59:58 -08:00
Niloth P
c32e6f4940 integrations: Improve the branch filtering in Git-related integrations.
- Made the branch-filtering checks uniform across all the integrations,
by adding a helper function to git.py, and re-using it.
- Instead of checking if the name of the branch that generated the
event is a substring of the "branches" parameter, we now check if
there's an exact match.
For example, if there are two branches named "main" and
"release/v1.0-main", and the user wants to track pushes to only the
"release/v1.0-main" branch, they wouldn't have been able to
previously, it will always track pushes to both branches. There was no
way to filter out the smaller named branch when there were overlaps.
2025-03-05 10:39:13 -08:00
Niloth P
b7e79715cc integration-docs: Combine two macros that are always used together.
Edited the git-append-branches.md macro to match the previous
git-branches-additional-feature.md macro, and moved it inside the
webhook-url-with-bot-email.md macro, as it's only ever used
immediately after that macro.
2025-03-05 10:39:13 -08:00
Niloth P
8f564b2053 integration-docs: Update branch filtering instructions.
Updated the Git-related integrations that support branch filtering:
- Removed the branch-filtering configuration option, and its macro.
- Added a new macro that integrates the branch-filtering instruction
with the Generate-URL step.

The new macro `generate-webhook-url-with-branch-filtering` builds off of
the `generate-webhook-url-basic` macro, adding only the branch filtering
instruction. But, it does not re-use the macro, instead duplicates it,
to avoid the newline break that would be added otherwise.
2025-03-05 10:39:13 -08:00
Niloth P
136b852749 integrations: Use branch-filtering UI for Git-related integrations.
The integration-URL modal uses the branch-filtering UI for the
integrations that have the config option "branches".

Fixes: #33738.
2025-03-05 10:39:13 -08:00
Niloth P
0df3dcdde9 integration-docs: Remove unnecessary instruction from Wekan doc.
A branch filtering instruction that has nothing to do with Wekan has
been present in the Wekan doc since the addition of the integration.
2025-03-05 10:39:13 -08:00
Saubhagya Patel
9d726699e1 zerver: Use Pydantic for MessageEditHistoryVisibilityPolicyEnum.
This commit ensures the `message_edit_history_visibility_raw`
parameter is validated using the policy names defined in the
`MessageEditHistoryVisibilityPolicyEnum`, used in the
`update_realm()` function in the `zerver/views/realm.py` file.

Follow up of #32840.
2025-03-05 10:32:40 -08:00
Alex Vandiver
34f0e3b621 cache: Do not fail the request on cache-set failures.
Failure to update the cache should log an exception but continue.
2025-03-05 09:48:58 -08:00
Alex Vandiver
c4701fa8d5 cache: Switch delete_user_profile_caches to using an iterator. 2025-03-05 09:48:19 -08:00
Alex Vandiver
e54dab50f2 cache: Switch cache_delete_many to deleting 10k at a time.
This also switches to making use of the input possibly being an
iterator, to only store 10k of the keys at once.
2025-03-05 09:48:19 -08:00