message_edit: Check 'topic_name is not None' and not 'content is None'.

Previously when enforcing the check to do not allow editing topics
after a certain time, we were checking whether 'content is None' and
considering it as that if content is None then there must be topic
edit.

But after adding support for moving messages between streams it can be
the case that we are neither changing topic nor content and just moving
streams, and the original code raises error if this is done after the
time limit of editing topics, which is wrong.

This commit fixes this by actually checking 'topic_name is not None'.
This commit is contained in:
sahil839 2021-05-26 12:31:46 +05:30 committed by Tim Abbott
parent e2835d3f4f
commit 6be232aa42

View File

@ -2798,7 +2798,7 @@ def check_update_message(
# sent the message, they are not the admin, and the time limit for editing
# topics is passed, raise an error.
if (
content is None
topic_name is not None
and message.sender != user_profile
and not user_profile.is_realm_admin
and not is_no_topic_msg