From 18429cfd29507582cdedce298226a3d2f271f81d Mon Sep 17 00:00:00 2001 From: sahil839 Date: Fri, 12 Jun 2020 00:46:53 +0530 Subject: [PATCH] realm: Allow only owners to set message retention policy for a realm. This commits adds restriction on admins to set message retention policy. We now only allow only organization owners to set message retention policy. Dropdown for changing retention policy is disabled in UI for admins also. --- static/js/settings_org.js | 1 + static/templates/settings/organization_settings_admin.hbs | 5 ++++- templates/zerver/help/message-retention-policy.md | 2 ++ zerver/tests/test_realm.py | 8 +++++++- zerver/views/realm.py | 2 ++ 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/static/js/settings_org.js b/static/js/settings_org.js index de719bb45e..5fe8b3fa76 100644 --- a/static/js/settings_org.js +++ b/static/js/settings_org.js @@ -23,6 +23,7 @@ exports.maybe_disable_widgets = function () { if (page_params.is_admin) { $("#deactivate_realm_button").attr("disabled", true); + $("#org-message-retention").find("input, select").attr("disabled", true); return; } diff --git a/static/templates/settings/organization_settings_admin.hbs b/static/templates/settings/organization_settings_admin.hbs index dd3f1ca9f7..13d34c03ba 100644 --- a/static/templates/settings/organization_settings_admin.hbs +++ b/static/templates/settings/organization_settings_admin.hbs @@ -150,7 +150,10 @@
- +