aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2020-02-19 21:03:59 +0100
committerTrygve Aaberge <trygveaa@gmail.com>2020-02-20 22:49:34 +0100
commit6c07fb93e5c0ea8e481bebce4664bc4bfb28ac1f (patch)
tree282885d293047731497213d8ed8233111380a8e2 /wee_slack.py
parent1fe556f16751889d6ca92d7ecea408eea6d3d4fa (diff)
downloadwee-slack-6c07fb93e5c0ea8e481bebce4664bc4bfb28ac1f.tar.gz
Remove auto_link_display parameter from unfurl_refs
This is only used in tests, and there we can override the config instead.
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py8
1 files changed, 3 insertions, 5 deletions
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)