get_user_status() -> get_user_modes(), filter in format_activity.py

This commit is contained in:
jesopo 2019-09-12 22:39:21 +01:00
parent 5b538eb5b6
commit 60ced118a0
2 changed files with 3 additions and 2 deletions

View file

@ -9,8 +9,9 @@ class Module(ModuleManager.BaseModule):
minimal=minimal, **kwargs)
def _mode_symbols(self, user, channel, server):
modes = list(channel.get_user_status(user))
modes = list(channel.get_user_modes(user))
if modes:
modes = [mode for mode in modes if mode in server.prefix_modes]
modes.sort(key=lambda x: list(server.prefix_modes.keys()).index(x))
return server.prefix_modes[modes[0]]
return ""

View file

@ -238,5 +238,5 @@ class Channel(IRCObject.Object):
def has_mode(self, user: IRCUser.User, mode: str) -> bool:
return user in self.modes.get(mode, [])
def get_user_status(self, user: IRCUser.User) -> typing.Set:
def get_user_modes(self, user: IRCUser.User) -> typing.Set:
return self.user_modes.get(user, set([]))