aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2020-06-14 00:26:38 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2020-06-14 00:39:30 +0200
commitde5d7818e61f240be5faa5482059e36d7fdc3cb0 (patch)
tree9573da0bf4d4f228d3482f3a374dffd4cbaaae10 /wee_slack.py
parentf8f63511675c26df61c214e74bb90661496ceb0e (diff)
downloadwee-slack-de5d7818e61f240be5faa5482059e36d7fdc3cb0.tar.gz
Refactor to if/else for SlackThreadChannel.formatted_name
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/wee_slack.py b/wee_slack.py
index e5620ac..2f75b52 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -2468,12 +2468,14 @@ class SlackThreadChannel(SlackChannelCommon):
def formatted_name(self, style="default"):
thread_hash = self.parent_message.hash
- styles = {
- "default": "{}.{}".format(self.parent_channel.formatted_name(), thread_hash),
- "long_default": "{}.{}".format(self.parent_channel.formatted_name(style="long_default"), thread_hash),
- "sidebar": " +{}".format(self.label or thread_hash),
- }
- return styles[style]
+ if style == "sidebar":
+ return " +{}".format(self.label or thread_hash)
+ elif style == "long_default":
+ channel_name = self.parent_channel.formatted_name(style="long_default")
+ return "{}.{}".format(channel_name, thread_hash)
+ else:
+ channel_name = self.parent_channel.formatted_name()
+ return "{}.{}".format(channel_name, thread_hash)
def mark_read(self, ts=None, update_remote=True, force=False, post_data={}):
if not self.parent_message.subscribed: