message_edit: Use move_messages_within_stream_limit_seconds in webapp.

We now use realm_move_messages_within_stream_limit_seconds setting in
webapp to check topic edit permission replacing the 3-day limit.
As was the case previously, there is no limit for admins and
moderators.
This commit is contained in:
Sahil Batra
2022-10-11 23:05:46 +05:30
committed by Tim Abbott
parent 2c4e076fef
commit d514f2455f
2 changed files with 8 additions and 3 deletions

View File

@@ -68,9 +68,14 @@ export function is_topic_editable(message, edit_limit_seconds_buffer = 0) {
return true;
}
if (page_params.realm_move_messages_within_stream_limit_seconds === null) {
// This means no time limit for editing topics.
return true;
}
// If you're using community topic editing, there's a deadline.
return (
page_params.realm_community_topic_editing_limit_seconds +
page_params.realm_move_messages_within_stream_limit_seconds +
edit_limit_seconds_buffer +
(message.timestamp - Date.now() / 1000) >
0