mirror of https://github.com/zulip/zulip.git
page_params: Add community_topic_editing_limit_seconds.
This was previously hardcoded with agreement between the Zulip backend and frontend as 86400 seconds (1 day). Now, it's still hardcoded in the backend, but arranged in a way where we could add a setting without any changes to the mobile and terminal apps to update logic. Fixes #15278.
This commit is contained in:
parent
5deaae14b3
commit
e242ddc848
|
@ -1,5 +1,7 @@
|
||||||
set_global('document', null);
|
set_global('document', null);
|
||||||
set_global('page_params', {});
|
set_global('page_params', {
|
||||||
|
realm_community_topic_editing_limit_seconds: 86400,
|
||||||
|
});
|
||||||
|
|
||||||
global.stub_out_jquery();
|
global.stub_out_jquery();
|
||||||
|
|
||||||
|
@ -75,6 +77,7 @@ run_test('get_editability', () => {
|
||||||
realm_allow_community_topic_editing: true,
|
realm_allow_community_topic_editing: true,
|
||||||
realm_allow_message_editing: true,
|
realm_allow_message_editing: true,
|
||||||
realm_message_content_edit_limit_seconds: 0,
|
realm_message_content_edit_limit_seconds: 0,
|
||||||
|
realm_community_topic_editing_limit_seconds: 86400,
|
||||||
is_admin: false,
|
is_admin: false,
|
||||||
};
|
};
|
||||||
message.timestamp = current_timestamp - 60;
|
message.timestamp = current_timestamp - 60;
|
||||||
|
|
|
@ -47,9 +47,9 @@ function is_topic_editable(message, edit_limit_seconds_buffer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// If you're using community topic editing, there's a deadline.
|
// If you're using community topic editing, there's a deadline.
|
||||||
// TODO: Change hardcoded value (24 hrs) to be realm setting. Currently, it is
|
return page_params.realm_community_topic_editing_limit_seconds
|
||||||
// DEFAULT_COMMUNITY_TOPIC_EDITING_LIMIT_SECONDS
|
+ edit_limit_seconds_buffer
|
||||||
return 86400 + edit_limit_seconds_buffer + now.diffSeconds(message.timestamp * 1000) > 0;
|
+ now.diffSeconds(message.timestamp * 1000) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_editability(message, edit_limit_seconds_buffer) {
|
function get_editability(message, edit_limit_seconds_buffer) {
|
||||||
|
|
|
@ -10,6 +10,13 @@ below features are supported.
|
||||||
|
|
||||||
## Changes in Zulip 2.2
|
## Changes in Zulip 2.2
|
||||||
|
|
||||||
|
**Feature level 11**
|
||||||
|
|
||||||
|
* [`POST /register`](/api/register-queue): Added
|
||||||
|
`realm_community_topic_editing_limit_seconds` to the response, the
|
||||||
|
time limit before community topic editing is forbidden. A `null`
|
||||||
|
value means no limit.
|
||||||
|
|
||||||
**Feature level 10**
|
**Feature level 10**
|
||||||
|
|
||||||
* [`GET users/me`](/api/get-profile): Added `avatar_version`, `is_guest`,
|
* [`GET users/me`](/api/get-profile): Added `avatar_version`, `is_guest`,
|
||||||
|
|
|
@ -147,6 +147,8 @@ def fetch_initial_state_data(user_profile: UserProfile,
|
||||||
state['realm_allow_message_deleting'] = realm.allow_message_deleting
|
state['realm_allow_message_deleting'] = realm.allow_message_deleting
|
||||||
state['realm_message_content_edit_limit_seconds'] = realm.message_content_edit_limit_seconds
|
state['realm_message_content_edit_limit_seconds'] = realm.message_content_edit_limit_seconds
|
||||||
state['realm_message_content_delete_limit_seconds'] = realm.message_content_delete_limit_seconds
|
state['realm_message_content_delete_limit_seconds'] = realm.message_content_delete_limit_seconds
|
||||||
|
state['realm_community_topic_editing_limit_seconds'] = \
|
||||||
|
Realm.DEFAULT_COMMUNITY_TOPIC_EDITING_LIMIT_SECONDS
|
||||||
state['realm_icon_url'] = realm_icon_url(realm)
|
state['realm_icon_url'] = realm_icon_url(realm)
|
||||||
state['realm_icon_source'] = realm.icon_source
|
state['realm_icon_source'] = realm.icon_source
|
||||||
state['max_icon_file_size'] = settings.MAX_ICON_FILE_SIZE
|
state['max_icon_file_size'] = settings.MAX_ICON_FILE_SIZE
|
||||||
|
|
|
@ -134,6 +134,7 @@ class HomeTest(ZulipTestCase):
|
||||||
"realm_bot_creation_policy",
|
"realm_bot_creation_policy",
|
||||||
"realm_bot_domain",
|
"realm_bot_domain",
|
||||||
"realm_bots",
|
"realm_bots",
|
||||||
|
"realm_community_topic_editing_limit_seconds",
|
||||||
"realm_create_stream_policy",
|
"realm_create_stream_policy",
|
||||||
"realm_default_code_block_language",
|
"realm_default_code_block_language",
|
||||||
"realm_default_external_accounts",
|
"realm_default_external_accounts",
|
||||||
|
|
Loading…
Reference in New Issue