diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2023-09-30 23:15:44 +0200 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2024-02-18 11:32:54 +0100 |
commit | a9265419397256cb6c3bd944aab38b7f1d4a6990 (patch) | |
tree | a35b7c81901233d380d7c87c278c2097de792716 /slack | |
parent | 85eb57898a510d6a1d9b3b8b0e0b736b9a598a55 (diff) | |
download | wee-slack-a9265419397256cb6c3bd944aab38b7f1d4a6990.tar.gz |
Support overriding display_reaction_nicks per buffer
Diffstat (limited to 'slack')
-rw-r--r-- | slack/config.py | 2 | ||||
-rw-r--r-- | slack/slack_conversation.py | 8 | ||||
-rw-r--r-- | slack/slack_message.py | 2 |
3 files changed, 10 insertions, 2 deletions
diff --git a/slack/config.py b/slack/config.py index 38a069b..3933aef 100644 --- a/slack/config.py +++ b/slack/config.py @@ -159,7 +159,7 @@ class SlackConfigSectionLook: self.display_reaction_nicks = WeeChatOption( self._section, "display_reaction_nicks", - "display the name of the reacting user(s) after each reaction", + "display the name of the reacting user(s) after each reaction; can be overridden per buffer with the buffer localvar display_reaction_nicks", False, ) diff --git a/slack/slack_conversation.py b/slack/slack_conversation.py index d3f7763..2d6fc3b 100644 --- a/slack/slack_conversation.py +++ b/slack/slack_conversation.py @@ -380,6 +380,14 @@ class SlackConversation(SlackBuffer): return bool(weechat.config_string_to_boolean(buffer_value)) return shared.config.look.display_thread_replies_in_channel.value + def display_reaction_nicks(self) -> bool: + buffer_value = weechat.buffer_get_string( + self.buffer_pointer, "localvar_display_reaction_nicks" + ) + if buffer_value: + return bool(weechat.config_string_to_boolean(buffer_value)) + return shared.config.look.display_reaction_nicks.value + def should_display_message(self, message: SlackMessage) -> bool: return ( not message.is_reply diff --git a/slack/slack_message.py b/slack/slack_message.py index 1e7637e..0771b60 100644 --- a/slack/slack_message.py +++ b/slack/slack_message.py @@ -602,7 +602,7 @@ class SlackMessage: assert_never(shared.config.look.render_emoji_as.value) async def _create_reaction_string(self, reaction: SlackMessageReaction) -> str: - if shared.config.look.display_reaction_nicks: + if self.conversation.display_reaction_nicks(): # TODO: initialize_items? users = await gather( *(self.workspace.users[user_id] for user_id in reaction["users"]) |