def viewers(self): viewers = self.info.get('viewers', []) user_ids = set() out = [] is_public = False for user_id in viewers: if str(user_id).lower().strip() == 'public': is_public = True elif user_id and user_id not in user_ids: user_ids.add(user_id) user_info = api.get_owner_info_from_uuid(user_id) if user_info.id: out.append(user_info) out.sort(key=lambda k: k.is_group()) if is_public: out.append(api.get_owner_info_from_uuid('public')) return out
def message(self): if self.is_system_message(): msg = self.info.get('message') if msg.get('group_id'): msg['group'] = api.get_owner_info_from_uuid(msg['group_id']) if msg.get('user_id'): msg['user'] = api.get_owner_info_from_uuid(msg['user_id']) return msg if self.is_file(): return File(self.info).name if self.is_event(): return self.info.get('name', '') if self.is_email(): return self.info.get('subject', '') message = self.info.get('message', '') return message
def owner(self): return api.get_owner_info_from_uuid(self.info.get('owner'))
def owner(self): return api.get_owner_info_from_uuid(self.info.get('owner'), db_name=self.db_name)