def _get_last_msg_data( self, chat: Dict[str, Any]) -> Tuple[Optional[str], Optional[str]]: user, last_msg = get_last_msg(chat, self.model.users) if user: last_msg_sender = self.model.users.get_user_label(user) chat_type = get_chat_type(chat) if chat_type and is_group(chat_type): return last_msg_sender, last_msg return None, last_msg
def _get_action_label(users: UserModel, chat: Dict[str, Any]) -> Optional[str]: actioner, action = users.get_user_action(chat["id"]) if actioner and action: label = f"{action}..." chat_type = get_chat_type(chat) if chat_type and is_group(chat_type): user_label = users.get_user_label(actioner) label = f"{user_label} {label}" return label return None