aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2020-02-20 22:51:32 +0100
committerTrygve Aaberge <trygveaa@gmail.com>2020-02-20 22:51:32 +0100
commitcc6459415bbf117353564cc709da0343434dcf23 (patch)
tree63d6ff15fb45fb57148a3d6cc2f896dd26ad178b
parent6c07fb93e5c0ea8e481bebce4664bc4bfb28ac1f (diff)
downloadwee-slack-cc6459415bbf117353564cc709da0343434dcf23.tar.gz
Remove ignore_alt_text parameter from unfurl_refs
This is only used in tests and in render_topic, and I don't see why render_topic shouldn't follow the global config that is set.
-rw-r--r--_pytest/test_unfurl.py6
-rw-r--r--wee_slack.py9
2 files changed, 5 insertions, 10 deletions
diff --git a/_pytest/test_unfurl.py b/_pytest/test_unfurl.py
index 0ca3cd0..6178bbb 100644
--- a/_pytest/test_unfurl.py
+++ b/_pytest/test_unfurl.py
@@ -85,10 +85,8 @@ import pytest
))
def test_unfurl_refs(case, realish_eventrouter):
wee_slack.EVENTROUTER = realish_eventrouter
+ wee_slack.config.unfurl_ignore_alt_text = case.get('ignore_alt_text')
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)
- )
+ result = wee_slack.unfurl_refs(case['input'])
assert result == case['output']
diff --git a/wee_slack.py b/wee_slack.py
index 889c53e..b081a03 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -1692,7 +1692,7 @@ class SlackChannel(SlackChannelCommon):
topic = self.topic['value']
if not topic and fallback_to_purpose:
topic = self.slack_purpose['value']
- return unhtmlescape(unfurl_refs(topic, ignore_alt_text=False))
+ return unhtmlescape(unfurl_refs(topic))
def set_topic(self, value=None):
if value is not None:
@@ -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):
+def unfurl_refs(text):
"""
input : <@U096Q7CQM|someuser> has joined the channel
ouput : someuser has joined the channel
@@ -3433,15 +3433,12 @@ def unfurl_refs(text, ignore_alt_text=None):
# - <!subteam^U2147483697|@group>
# Test patterns lives in ./_pytest/test_unfurl.py
- if ignore_alt_text is None:
- ignore_alt_text = config.unfurl_ignore_alt_text
-
def unfurl_ref(match):
ref = match.group(1)
id = ref.split('|')[0]
display_text = ref
if ref.find('|') > -1:
- if ignore_alt_text:
+ if config.unfurl_ignore_alt_text:
display_text = resolve_ref(id)
else:
if id.startswith("#"):