def linkTo(self, obj, role): if not self.user or self.user.is_deleted: return link = self.user.link_to(obj, role) if link and redis_write_client: event = avatar_links.event_from_obj(obj) if event: avatar_links.add_link(self.user, event, '{}_{}'.format(link.type, link.role))
def unlinkTo(self, obj, role): if not self.user or self.user.is_deleted: return links = self.user.unlink_to(obj, role) if redis_write_client: for link in links: event = avatar_links.event_from_obj(obj) if event: avatar_links.del_link(self.user, event, '{}_{}'.format(link.type, link.role))
def linkTo(self, obj, role): # deleted users shouldn't be able to be linked # TODO: log deleted users? if not self.user.is_deleted: link = self.user.link_to(obj, role) if link and redis_write_client: event = avatar_links.event_from_obj(obj) if event: avatar_links.add_link(self, event, '{}_{}'.format(link.type, link.role))