message: Fix the edit topic bug by removing leading \n from msg content.

The reason for this bug is because of different striping
processes in the backend and frontend, i.e The frontend
checks if the message's `raw_content` has changed to
decide if the `content` of the message should be sent in
the request to the backend, or not. So, it removes the
leading new line ('\n') from the message `raw_content`
when checking it, which is causing the "Error saving edit:
You don't have permission to edit this message" error.

This commit fixes it by removing the leading new line
when cleaning message content.

The bug was explained by @punchagan and its solution
by @timabbott.
This commit is contained in:
Riken Shah
2021-07-05 15:55:02 +00:00
committed by Tim Abbott
parent 17eed06eb1
commit a96c614420
5 changed files with 39 additions and 24 deletions

View File

@@ -20,7 +20,7 @@ from zerver.lib.timestamp import timestamp_to_datetime
from zerver.lib.validator import check_list, check_string
from zerver.models import UserProfile
MISSING_EVENT_HEADER_MESSAGE = """
MISSING_EVENT_HEADER_MESSAGE = """\
Hi there! Your bot {bot_name} just sent an HTTP request to {request_path} that
is missing the HTTP {header_name} header. Because this header is how
{integration_name} indicates the event type, this usually indicates a configuration