actions: Remove 'topic_name is None' check from can_edit_content_or_topic.

We do not need the 'topic_name is None' check in this function as this is
called only when atleast one of the content and topic_name is not None,
and this condition cannot be true as there is 'content is not None'
check just before it.

Thus, 'if topic_name is None' condition being true means that both content
and topic_name are None which is not possible as this function itself will
not be called in such case. An assert statement is added to check that
topic_name is not None to make sure that it is handled when the function
is called in some other way later.
This commit is contained in:
sahil839 2021-06-04 13:41:49 +05:30 committed by Tim Abbott
parent f26a76a9d8
commit 283a3a5c28
1 changed files with 1 additions and 3 deletions

View File

@ -2810,9 +2810,7 @@ def can_edit_content_or_topic(
if content is not None:
return False
# If no topic change is requested, we're done.
if topic_name is None: # nocoverage
return True
assert topic_name is not None
# The following cases are the various reasons a user might be
# allowed to edit topics.