From 961d1d0a68d26e5402eccb2b58f934866c3ba35c Mon Sep 17 00:00:00 2001 From: Aman Agrawal Date: Tue, 5 Jan 2021 05:22:08 +0000 Subject: [PATCH] community_topic_edit: Increase time limit to 3 days. 24hrs is a small time in an asynchronous conversation. Increased time limit of topic editing for non-admins to 3 days. --- docs/overview/changelog.md | 1 + frontend_tests/node_tests/message_edit.js | 4 ++-- templates/zerver/api/changelog.md | 6 ++++++ templates/zerver/help/community-topic-edits.md | 4 +++- zerver/models.py | 2 +- zerver/tests/test_message_edit.py | 4 ++-- 6 files changed, 15 insertions(+), 6 deletions(-) diff --git a/docs/overview/changelog.md b/docs/overview/changelog.md index 4ce56b2f04..fa6ffd9977 100644 --- a/docs/overview/changelog.md +++ b/docs/overview/changelog.md @@ -27,6 +27,7 @@ in bursts. #### Full feature changelog +- Community topic editing time limit increased to 3 days for members. - Removed HipChat import tool. - Added support for moving topics to private streams. - Added support for subscribing another stream's membership to a stream. diff --git a/frontend_tests/node_tests/message_edit.js b/frontend_tests/node_tests/message_edit.js index e4bea2a9e2..f31466ed63 100644 --- a/frontend_tests/node_tests/message_edit.js +++ b/frontend_tests/node_tests/message_edit.js @@ -7,7 +7,7 @@ const {run_test} = require("../zjsunit/test"); set_global("document", null); set_global("page_params", { - realm_community_topic_editing_limit_seconds: 86400, + realm_community_topic_editing_limit_seconds: 259200, }); stub_out_jquery(); @@ -92,7 +92,7 @@ run_test("get_editability", () => { realm_allow_community_topic_editing: true, realm_allow_message_editing: true, realm_message_content_edit_limit_seconds: 0, - realm_community_topic_editing_limit_seconds: 86400, + realm_community_topic_editing_limit_seconds: 259200, is_admin: false, }); message.timestamp = current_timestamp - 60; diff --git a/templates/zerver/api/changelog.md b/templates/zerver/api/changelog.md index ff41e7bd34..f7076351b1 100644 --- a/templates/zerver/api/changelog.md +++ b/templates/zerver/api/changelog.md @@ -10,6 +10,12 @@ below features are supported. ## Changes in Zulip 4.0 +**Feature level 38** + +* [`POST /register`](/api/register-queue): Increased + `realm_community_topic_editing_limit_seconds` time limit value + to 259200s (3 days). + **Feature level 37** * Consistently provide `subscribers` in stream data when diff --git a/templates/zerver/help/community-topic-edits.md b/templates/zerver/help/community-topic-edits.md index 7c6473f9b7..b6401c84e7 100644 --- a/templates/zerver/help/community-topic-edits.md +++ b/templates/zerver/help/community-topic-edits.md @@ -4,7 +4,9 @@ By default, anyone can edit any message topic. This is useful because it allows the community to keep conversations organized, even if some members -are still learning how to use topics effectively. +are still learning how to use topics effectively. Note that non-admin members +cannot edit topic of a message after 3 days even if community topic editing +is enabled. Organization administrators can turn off community topic editing. Note that users may still be able to edit the topic of messages with **(no topic)**; see diff --git a/zerver/models.py b/zerver/models.py index 18cdf375af..14768a4c91 100644 --- a/zerver/models.py +++ b/zerver/models.py @@ -321,7 +321,7 @@ class Realm(models.Model): # Whether users have access to message edit history allow_edit_history: bool = models.BooleanField(default=True) - DEFAULT_COMMUNITY_TOPIC_EDITING_LIMIT_SECONDS = 86400 + DEFAULT_COMMUNITY_TOPIC_EDITING_LIMIT_SECONDS = 259200 allow_community_topic_editing: bool = models.BooleanField(default=True) # Defaults for new users diff --git a/zerver/tests/test_message_edit.py b/zerver/tests/test_message_edit.py index 999c54cc86..b4eb3ca9dd 100644 --- a/zerver/tests/test_message_edit.py +++ b/zerver/tests/test_message_edit.py @@ -633,8 +633,8 @@ class EditMessageTest(ZulipTestCase): self.login('cordelia') do_edit_message_assert_error(id_, 'D', "Your organization has turned off message editing") - # non-admin users cannot edit topics sent > 24 hrs ago - message.date_sent = message.date_sent - datetime.timedelta(seconds=90000) + # non-admin users cannot edit topics sent > 72 hrs ago + message.date_sent = message.date_sent - datetime.timedelta(seconds=290000) message.save() self.login('iago') set_message_editing_params(True, 0, True)