aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2020-02-19 22:09:15 +0100
committerTrygve Aaberge <trygveaa@gmail.com>2020-02-20 22:59:04 +0100
commitc0035aa9766e4b20ac597a146cea8b0c69dbedb1 (patch)
tree56b9346cce71e5bdbe770af34952499dde806374
parent5b40e22b1a6d8cd44f72195d3a15338e72fe2ec7 (diff)
downloadwee-slack-c0035aa9766e4b20ac597a146cea8b0c69dbedb1.tar.gz
Support unfurling date refs by using the fallback
-rw-r--r--_pytest/test_unfurl.py4
-rw-r--r--wee_slack.py2
2 files changed, 6 insertions, 0 deletions
diff --git a/_pytest/test_unfurl.py b/_pytest/test_unfurl.py
index fe1fc3d..9523bc6 100644
--- a/_pytest/test_unfurl.py
+++ b/_pytest/test_unfurl.py
@@ -101,6 +101,10 @@ import pytest
{
'input': "<!subteam^UNKNOWN|@othersubteam> This is announcement for the dev team",
'output': "@othersubteam This is announcement for the dev team"
+ },
+ {
+ 'input': "Ends <!date^1584573568^{date_short} at {time}|Mar 18, 2020 at 23:19 PM>.",
+ 'output': "Ends Mar 18, 2020 at 23:19 PM."
}
))
def test_unfurl_refs(case, realish_eventrouter):
diff --git a/wee_slack.py b/wee_slack.py
index 0e08ef5..9370740 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -3448,6 +3448,8 @@ def unfurl_refs(text):
elif ref.startswith("!subteam"):
prefix = "@" if not fallback.startswith("@") else ""
return prefix + fallback
+ elif ref.startswith("!date"):
+ return fallback
else:
match_url = r"^\w+:(//)?{}$".format(re.escape(fallback))
url_matches_desc = re.match(match_url, ref)