Skip to content

Commit 764083d

Browse files
prakhar1144timabbott
authored andcommitted
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 zulip#31201.
1 parent fb888ba commit 764083d

12 files changed

+74
-2
lines changed

api_docs/changelog.md

+6
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ format used by the Zulip server that they are interacting with.
2020

2121
## Changes in Zulip 10.0
2222

23+
**Feature level 293**
24+
25+
* [`POST /register`](/api/register-queue), [`PATCH /settings`](/api/update-settings):
26+
Added a new `allow_private_data_export` setting to allow users to decide
27+
whether to let administrators export their private data.
28+
2329
**Feature level 292**
2430

2531
* [`POST /register`](/api/register-queue), [`GET

version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
# new level means in api_docs/changelog.md, as well as "**Changes**"
3535
# entries in the endpoint's documentation in `zulip.yaml`.
3636

37-
API_FEATURE_LEVEL = 292 # Last bumped for `namedusergroup_creator_date_created`.
37+
API_FEATURE_LEVEL = 293 # Last bumped for `allow_private_data_export` setting.
3838

3939
# Bump the minor PROVISION_VERSION to indicate that folks should provision
4040
# only when going from an old version of the code to a newer version. Bump

web/src/realm_user_settings_defaults.ts

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {z} from "zod";
33
import type {StateData} from "./state_data";
44

55
export const realm_default_settings_schema = z.object({
6+
allow_private_data_export: z.boolean(),
67
automatically_follow_topics_policy: z.number(),
78
automatically_follow_topics_where_mentioned: z.boolean(),
89
automatically_unmute_topics_in_muted_streams_policy: z.number(),

web/src/server_events_dispatch.js

+1
Original file line numberDiff line numberDiff line change
@@ -717,6 +717,7 @@ export function dispatch_normal_event(event) {
717717
"send_read_receipts",
718718
"presence_enabled",
719719
"email_address_visibility",
720+
"allow_private_data_export",
720721
];
721722

722723
if (privacy_settings.includes(event.property)) {

web/src/settings.js

+3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ export let settings_label;
2929
function setup_settings_label() {
3030
settings_label = {
3131
// settings_notification
32+
allow_private_data_export: $t({
33+
defaultMessage: "Let administrators export my private data",
34+
}),
3235
presence_enabled: $t({
3336
defaultMessage: "Display my availability to other users",
3437
}),

web/src/user_settings.ts

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export const user_settings_schema = stream_notification_settings_schema
3434
.merge(pm_notification_settings_schema)
3535
.merge(followed_topic_notification_settings_schema)
3636
.extend({
37+
allow_private_data_export: z.boolean(),
3738
automatically_follow_topics_policy: z.number(),
3839
automatically_follow_topics_where_mentioned: z.boolean(),
3940
automatically_unmute_topics_in_muted_streams_policy: z.number(),

web/templates/settings/account_settings.hbs

+6
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@
9494
label_parens_text=settings_label.presence_enabled_parens_text
9595
help_link="/help/status-and-availability"
9696
prefix="user_"}}
97+
{{> settings_checkbox
98+
setting_name="allow_private_data_export"
99+
is_checked=settings_object.allow_private_data_export
100+
label=settings_label.allow_private_data_export
101+
help_link="/help/export-your-organization#full-export-with-member-consent"
102+
}}
97103
</div>
98104
<div class="input-group">
99105
<label for="email_address_visibility" class="settings-field-label">{{t "Who can access your email address" }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Generated by Django 5.0.8 on 2024-09-09 08:57
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
dependencies = [
8+
("zerver", "0584_namedusergroup_creator_date_created_backfill"),
9+
]
10+
11+
operations = [
12+
migrations.AddField(
13+
model_name="realmuserdefault",
14+
name="allow_private_data_export",
15+
field=models.BooleanField(default=False),
16+
),
17+
migrations.AddField(
18+
model_name="userprofile",
19+
name="allow_private_data_export",
20+
field=models.BooleanField(default=False),
21+
),
22+
]

zerver/models/users.py

+2
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ class UserBaseSettings(models.Model):
267267
send_stream_typing_notifications = models.BooleanField(default=True)
268268
send_private_typing_notifications = models.BooleanField(default=True)
269269
send_read_receipts = models.BooleanField(default=True)
270+
allow_private_data_export = models.BooleanField(default=False)
270271

271272
# Whether the user wants to see typing notifications.
272273
receives_typing_notifications = models.BooleanField(default=True)
@@ -347,6 +348,7 @@ class UserBaseSettings(models.Model):
347348
send_private_typing_notifications=bool,
348349
send_read_receipts=bool,
349350
send_stream_typing_notifications=bool,
351+
allow_private_data_export=bool,
350352
web_mark_read_on_scroll_policy=int,
351353
web_channel_default_view=int,
352354
user_list_style=int,

zerver/openapi/zulip.yaml

+24
Original file line numberDiff line numberDiff line change
@@ -14873,6 +14873,13 @@ paths:
1487314873
read messages.
1487414874

1487514875
**Changes**: New in Zulip 5.0 (feature level 105).
14876+
allow_private_data_export:
14877+
type: boolean
14878+
description: |
14879+
Whether organization administrators are allowed to
14880+
export your private data.
14881+
14882+
**Changes**: New in Zulip 10.0 (feature level 293).
1487614883
email_address_visibility:
1487714884
$ref: "#/components/schemas/EmailAddressVisibility"
1487814885
web_navigate_to_sent_message:
@@ -17370,6 +17377,13 @@ paths:
1737017377
read messages.
1737117378

1737217379
**Changes**: New in Zulip 5.0 (feature level 105).
17380+
allow_private_data_export:
17381+
type: boolean
17382+
description: |
17383+
Whether organization administrators are allowed to
17384+
export your private data.
17385+
17386+
**Changes**: New in Zulip 10.0 (feature level 293).
1737317387
email_address_visibility:
1737417388
$ref: "#/components/schemas/EmailAddressVisibility"
1737517389
web_navigate_to_sent_message:
@@ -18672,6 +18686,14 @@ paths:
1867218686
**Changes**: New in Zulip 5.0 (feature level 105).
1867318687
type: boolean
1867418688
example: true
18689+
allow_private_data_export:
18690+
description: |
18691+
Whether organization administrators are allowed to
18692+
export your private data.
18693+
18694+
**Changes**: New in Zulip 10.0 (feature level 293).
18695+
type: boolean
18696+
example: true
1867518697
email_address_visibility:
1867618698
description: |
1867718699
The [policy][permission-level] this user has selected for [which other
@@ -18807,6 +18829,8 @@ paths:
1880718829
contentType: application/json
1880818830
send_read_receipts:
1880918831
contentType: application/json
18832+
allow_private_data_export:
18833+
contentType: application/json
1881018834
email_address_visibility:
1881118835
contentType: application/json
1881218836
web_navigate_to_sent_message:

zerver/tests/test_realm.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -2175,7 +2175,12 @@ def test_update_default_realm_settings(self) -> None:
21752175
# duplicate code. default_language is currently present in Realm table also and thus
21762176
# is updated using '/realm' endpoint, but this will be removed in future and the
21772177
# settings in RealmUserDefault table will be used.
2178-
if prop in ["default_language", "enable_login_emails", "enable_marketing_emails"]:
2178+
if prop in [
2179+
"default_language",
2180+
"enable_login_emails",
2181+
"enable_marketing_emails",
2182+
"allow_private_data_export",
2183+
]:
21792184
continue
21802185
if prop in ["dense_mode"]:
21812186
# Testing this is complicated, see test_update_default_information_density_settings.

zerver/views/user_settings.py

+1
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ def json_change_settings(
314314
send_private_typing_notifications: Json[bool] | None = None,
315315
send_stream_typing_notifications: Json[bool] | None = None,
316316
send_read_receipts: Json[bool] | None = None,
317+
allow_private_data_export: Json[bool] | None = None,
317318
user_list_style: Annotated[
318319
Json[int], check_int_in_validator(UserProfile.USER_LIST_STYLE_CHOICES)
319320
]

0 commit comments

Comments
 (0)