diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2021-03-06 13:50:17 +0100 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2021-03-06 14:11:36 +0100 |
commit | 249853a0366a055078eb6b5286adf96596fa0cd6 (patch) | |
tree | 13b3297b565d906718a3696f3f2ddef519cdf71f /wee_slack.py | |
parent | 99b49540a148d59adfe8f9ec67a1ed97eb66a98e (diff) | |
download | wee-slack-249853a0366a055078eb6b5286adf96596fa0cd6.tar.gz |
Fallback to user identifier if we can't find a name in get_sender
I don't like displaying the user identifier, but if all of the steps in
get_sender fails, it's better to fallback to the identifier rather than
an empty string, so you can at least distinguish between different
users.
It falls back to an empty string again if user_identifier is None,
because some messages in the tests doesn't even have a user_identifier.
Though, I don't think any messages the Slack servers are sending now are
missing user_identifier.
After the last commit, hopefully this fallback to user identifier will
never be used though.
Diffstat (limited to 'wee_slack.py')
-rw-r--r-- | wee_slack.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/wee_slack.py b/wee_slack.py index e083939..b6cc2f8 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -2837,7 +2837,7 @@ class SlackMessage(object): return name else: return "{} :]".format(name) - return "" + return self.user_identifier or "" @property def sender(self): |