aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--_pytest/test_unfurl.py4
-rw-r--r--wee_slack.py8
2 files changed, 5 insertions, 7 deletions
diff --git a/_pytest/test_unfurl.py b/_pytest/test_unfurl.py
index be3e958..0ca3cd0 100644
--- a/_pytest/test_unfurl.py
+++ b/_pytest/test_unfurl.py
@@ -85,10 +85,10 @@ import pytest
))
def test_unfurl_refs(case, realish_eventrouter):
wee_slack.EVENTROUTER = realish_eventrouter
+ wee_slack.config.unfurl_auto_link_display = case.get('auto_link_display')
result = wee_slack.unfurl_refs(
case['input'],
- ignore_alt_text=case.get('ignore_alt_text', False),
- auto_link_display=case.get('auto_link_display', 'both'),
+ ignore_alt_text=case.get('ignore_alt_text', False)
)
assert result == case['output']
diff --git a/wee_slack.py b/wee_slack.py
index 5837171..889c53e 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -3421,7 +3421,7 @@ def unfurl_block_element(text):
return "{} ({})".format(text["image_url"], text["alt_text"])
-def unfurl_refs(text, ignore_alt_text=None, auto_link_display=None):
+def unfurl_refs(text, ignore_alt_text=None):
"""
input : <@U096Q7CQM|someuser> has joined the channel
ouput : someuser has joined the channel
@@ -3435,8 +3435,6 @@ def unfurl_refs(text, ignore_alt_text=None, auto_link_display=None):
if ignore_alt_text is None:
ignore_alt_text = config.unfurl_ignore_alt_text
- if auto_link_display is None:
- auto_link_display = config.unfurl_auto_link_display
def unfurl_ref(match):
ref = match.group(1)
@@ -3460,9 +3458,9 @@ def unfurl_refs(text, ignore_alt_text=None, auto_link_display=None):
url, desc = ref.split('|', 1)
match_url = r"^\w+:(//)?{}$".format(re.escape(desc))
url_matches_desc = re.match(match_url, url)
- if url_matches_desc and auto_link_display == "text":
+ if url_matches_desc and config.unfurl_auto_link_display == "text":
display_text = desc
- elif url_matches_desc and auto_link_display == "url":
+ elif url_matches_desc and config.unfurl_auto_link_display == "url":
display_text = url
else:
display_text = "{} ({})".format(url, desc)