settings: Add 'allow_private_data_export' user setting.

This commit adds a user-setting to allow users to decide
whether to let administrators export their private data.

Fixes part of #31201.
This commit is contained in:
Prakhar Pratyush 2024-09-09 16:21:38 +05:30 committed by Tim Abbott
parent fb888ba9ab
commit 764083d31b
12 changed files with 74 additions and 2 deletions

View File

@ -20,6 +20,12 @@ format used by the Zulip server that they are interacting with.
## Changes in Zulip 10.0
**Feature level 293**
* [`POST /register`](/api/register-queue), [`PATCH /settings`](/api/update-settings):
Added a new `allow_private_data_export` setting to allow users to decide
whether to let administrators export their private data.
**Feature level 292**
* [`POST /register`](/api/register-queue), [`GET

View File

@ -34,7 +34,7 @@ DESKTOP_WARNING_VERSION = "5.9.3"
# new level means in api_docs/changelog.md, as well as "**Changes**"
# entries in the endpoint's documentation in `zulip.yaml`.
API_FEATURE_LEVEL = 292 # Last bumped for `namedusergroup_creator_date_created`.
API_FEATURE_LEVEL = 293 # Last bumped for `allow_private_data_export` setting.
# Bump the minor PROVISION_VERSION to indicate that folks should provision
# only when going from an old version of the code to a newer version. Bump

View File

@ -3,6 +3,7 @@ import {z} from "zod";
import type {StateData} from "./state_data";
export const realm_default_settings_schema = z.object({
allow_private_data_export: z.boolean(),
automatically_follow_topics_policy: z.number(),
automatically_follow_topics_where_mentioned: z.boolean(),
automatically_unmute_topics_in_muted_streams_policy: z.number(),

View File

@ -717,6 +717,7 @@ export function dispatch_normal_event(event) {
"send_read_receipts",
"presence_enabled",
"email_address_visibility",
"allow_private_data_export",
];
if (privacy_settings.includes(event.property)) {

View File

@ -29,6 +29,9 @@ export let settings_label;
function setup_settings_label() {
settings_label = {
// settings_notification
allow_private_data_export: $t({
defaultMessage: "Let administrators export my private data",
}),
presence_enabled: $t({
defaultMessage: "Display my availability to other users",
}),

View File

@ -34,6 +34,7 @@ export const user_settings_schema = stream_notification_settings_schema
.merge(pm_notification_settings_schema)
.merge(followed_topic_notification_settings_schema)
.extend({
allow_private_data_export: z.boolean(),
automatically_follow_topics_policy: z.number(),
automatically_follow_topics_where_mentioned: z.boolean(),
automatically_unmute_topics_in_muted_streams_policy: z.number(),

View File

@ -94,6 +94,12 @@
label_parens_text=settings_label.presence_enabled_parens_text
help_link="/help/status-and-availability"
prefix="user_"}}
{{> settings_checkbox
setting_name="allow_private_data_export"
is_checked=settings_object.allow_private_data_export
label=settings_label.allow_private_data_export
help_link="/help/export-your-organization#full-export-with-member-consent"
}}
</div>
<div class="input-group">
<label for="email_address_visibility" class="settings-field-label">{{t "Who can access your email address" }}

View File

@ -0,0 +1,22 @@
# Generated by Django 5.0.8 on 2024-09-09 08:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("zerver", "0584_namedusergroup_creator_date_created_backfill"),
]
operations = [
migrations.AddField(
model_name="realmuserdefault",
name="allow_private_data_export",
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name="userprofile",
name="allow_private_data_export",
field=models.BooleanField(default=False),
),
]

View File

@ -267,6 +267,7 @@ class UserBaseSettings(models.Model):
send_stream_typing_notifications = models.BooleanField(default=True)
send_private_typing_notifications = models.BooleanField(default=True)
send_read_receipts = models.BooleanField(default=True)
allow_private_data_export = models.BooleanField(default=False)
# Whether the user wants to see typing notifications.
receives_typing_notifications = models.BooleanField(default=True)
@ -347,6 +348,7 @@ class UserBaseSettings(models.Model):
send_private_typing_notifications=bool,
send_read_receipts=bool,
send_stream_typing_notifications=bool,
allow_private_data_export=bool,
web_mark_read_on_scroll_policy=int,
web_channel_default_view=int,
user_list_style=int,

View File

@ -14873,6 +14873,13 @@ paths:
read messages.
**Changes**: New in Zulip 5.0 (feature level 105).
allow_private_data_export:
type: boolean
description: |
Whether organization administrators are allowed to
export your private data.
**Changes**: New in Zulip 10.0 (feature level 293).
email_address_visibility:
$ref: "#/components/schemas/EmailAddressVisibility"
web_navigate_to_sent_message:
@ -17370,6 +17377,13 @@ paths:
read messages.
**Changes**: New in Zulip 5.0 (feature level 105).
allow_private_data_export:
type: boolean
description: |
Whether organization administrators are allowed to
export your private data.
**Changes**: New in Zulip 10.0 (feature level 293).
email_address_visibility:
$ref: "#/components/schemas/EmailAddressVisibility"
web_navigate_to_sent_message:
@ -18672,6 +18686,14 @@ paths:
**Changes**: New in Zulip 5.0 (feature level 105).
type: boolean
example: true
allow_private_data_export:
description: |
Whether organization administrators are allowed to
export your private data.
**Changes**: New in Zulip 10.0 (feature level 293).
type: boolean
example: true
email_address_visibility:
description: |
The [policy][permission-level] this user has selected for [which other
@ -18807,6 +18829,8 @@ paths:
contentType: application/json
send_read_receipts:
contentType: application/json
allow_private_data_export:
contentType: application/json
email_address_visibility:
contentType: application/json
web_navigate_to_sent_message:

View File

@ -2175,7 +2175,12 @@ class RealmAPITest(ZulipTestCase):
# duplicate code. default_language is currently present in Realm table also and thus
# is updated using '/realm' endpoint, but this will be removed in future and the
# settings in RealmUserDefault table will be used.
if prop in ["default_language", "enable_login_emails", "enable_marketing_emails"]:
if prop in [
"default_language",
"enable_login_emails",
"enable_marketing_emails",
"allow_private_data_export",
]:
continue
if prop in ["dense_mode"]:
# Testing this is complicated, see test_update_default_information_density_settings.

View File

@ -314,6 +314,7 @@ def json_change_settings(
send_private_typing_notifications: Json[bool] | None = None,
send_stream_typing_notifications: Json[bool] | None = None,
send_read_receipts: Json[bool] | None = None,
allow_private_data_export: Json[bool] | None = None,
user_list_style: Annotated[
Json[int], check_int_in_validator(UserProfile.USER_LIST_STYLE_CHOICES)
]