mirror of https://github.com/zulip/zulip.git
webhooks/slack_incoming: Update regex to correctly convert emphasis.
This was a bug where we were converting _text_ to **text**. For emphasis we use the *text* format.
This commit is contained in:
parent
1cf1d147aa
commit
8d158852fd
|
@ -5,7 +5,7 @@
|
|||
"type": "section",
|
||||
"text": {
|
||||
"type": "mrkdwn",
|
||||
"text": "Danny Torrence left the following review for your property:"
|
||||
"text": "Danny Torrence left the following _review_ for your property:"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
@ -34,7 +34,7 @@ Hello, world.
|
|||
def test_message_with_actions(self) -> None:
|
||||
expected_topic = "C1H9RESGL"
|
||||
expected_message = """
|
||||
Danny Torrence left the following review for your property:
|
||||
Danny Torrence left the following *review* for your property:
|
||||
|
||||
[Overlook Hotel](https://google.com) \n :star: \n Doors had too many axe holes, guest in room 237 was far too rowdy, whole place felt stuck in the 1920s.
|
||||
[Haunted hotel image](https://is5-ssl.mzstatic.com/image/thumb/Purple3/v4/d3/72/5c/d3725c8f-c642-5d69-1904-aa36e4297885/source/256x256bb.jpg)
|
||||
|
|
|
@ -99,5 +99,5 @@ def replace_formatting(text: str) -> str:
|
|||
text = re.sub(r"([^\w])\*(?!\s+)([^\*^\n]+)(?<!\s)\*([^\w])", r"\1**\2**\3", text)
|
||||
|
||||
# Slack uses _text_ for emphasis, whereas Zulip interprets that as nothing
|
||||
text = re.sub(r"([^\w])[_](?!\s+)([^\_\^\n]+)(?<!\s)[_]([^\w])", r"\1**\2**\3", text)
|
||||
text = re.sub(r"([^\w])[_](?!\s+)([^\_\^\n]+)(?<!\s)[_]([^\w])", r"\1*\2*\3", text)
|
||||
return text
|
||||
|
|
Loading…
Reference in New Issue