drafts: Add support for toggling drafts synchronization.

With changes mostly to the API documentation by tabbott.
This commit is contained in:
Hemanth V. Alluri
2021-07-24 10:26:56 +05:30
committed by Tim Abbott
parent 4d3b10d84d
commit c00089ac28
9 changed files with 114 additions and 2 deletions

View File

@@ -197,6 +197,7 @@ from zerver.models import (
CustomProfileFieldValue,
DefaultStream,
DefaultStreamGroup,
Draft,
EmailChangeStatus,
Message,
MultiuseInvite,
@@ -5101,6 +5102,13 @@ def do_set_user_display_setting(
active_user_ids(user_profile.realm_id),
)
if setting_name == "enable_drafts_synchronization" and setting_value is False:
# Delete all of the drafts from the backend but don't send delete events
# for them since all that's happened is that we stopped syncing changes,
# not deleted every previously synced draft - to do that use the DELETE
# endpoint.
Draft.objects.filter(user_profile=user_profile).delete()
def lookup_default_stream_groups(
default_stream_group_names: List[str], realm: Realm