def toggle_favourite(self): """Favourite or unfavourite selected status.""" status = self.get_selected_status() assert status app, user = self.app, self.user if not app or not user: self.footer.draw_message("You must be logged in to favourite", Color.RED) return status_id = status['id'] if status['favourited']: self.footer.draw_message("Undoing favourite status...", Color.YELLOW) api.unfavourite(app, user, status_id) self.footer.draw_message("✓ Status unfavourited", Color.GREEN) else: self.footer.draw_message("Favourite status...", Color.YELLOW) api.favourite(app, user, status_id) self.footer.draw_message("✓ Status favourited", Color.GREEN) status['favourited'] = not status['favourited'] self.right.draw(status)
def unfavourite(app, user, args): api.unfavourite(app, user, args.status_id) print_out("<green>✓ Status unfavourited</green>")
def _unfavourite(): logger.info("Unfavouriting {}".format(status)) api.unfavourite(self.app, self.user, status.id)