def generate_integration_bots_avatars(check_missing: bool = False) -> None: missing = set() for integration in INTEGRATIONS.values(): if not integration.logo_path: continue bot_avatar_path = integration.get_bot_avatar_path() if bot_avatar_path is None: continue bot_avatar_path = os.path.join(ZULIP_PATH, "static", bot_avatar_path) if check_missing: if not os.path.isfile(bot_avatar_path): missing.add(integration.name) else: create_integration_bot_avatar(static_path(integration.logo_path), bot_avatar_path) if missing: print( "ERROR: Bot avatars are missing for these webhooks: {}.\n" "ERROR: Run ./tools/setup/generate_integration_bots_avatars.py " "to generate them.\nERROR: Commit the newly generated avatars to " "the repository.".format(", ".join(missing)) ) sys.exit(1)
def add_integrations_context(context: Dict[str, Any]) -> None: alphabetical_sorted_categories = OrderedDict(sorted(CATEGORIES.items())) alphabetical_sorted_integration = OrderedDict(sorted(INTEGRATIONS.items())) enabled_integrations_count = len(list(filter(lambda v: v.is_enabled(), INTEGRATIONS.values()))) # Subtract 1 so saying "Over X integrations" is correct. Then, # round down to the nearest multiple of 10. integrations_count_display = ((enabled_integrations_count - 1) // 10) * 10 context["categories_dict"] = alphabetical_sorted_categories context["integrations_dict"] = alphabetical_sorted_integration context["integrations_count_display"] = integrations_count_display
def add_integrations_context(context: Dict[str, Any]) -> None: alphabetical_sorted_categories = OrderedDict(sorted(CATEGORIES.items())) alphabetical_sorted_integration = OrderedDict(sorted(INTEGRATIONS.items())) enabled_integrations_count = len( list(filter(lambda v: v.is_enabled(), INTEGRATIONS.values()))) # Subtract 1 so saying "Over X integrations" is correct. Then, # round down to the nearest multiple of 10. integrations_count_display = ((enabled_integrations_count - 1) // 10) * 10 context['categories_dict'] = alphabetical_sorted_categories context['integrations_dict'] = alphabetical_sorted_integration context['integrations_count_display'] = integrations_count_display if "html_settings_links" in context and context["html_settings_links"]: settings_html = '<a href="../../#settings">Zulip settings page</a>' subscriptions_html = '<a target="_blank" href="../../#streams">streams page</a>' else: settings_html = 'Zulip settings page' subscriptions_html = 'streams page' context['settings_html'] = settings_html context['subscriptions_html'] = subscriptions_html
def test_check_if_every_integration_has_logo_that_exists(self) -> None: for integration in INTEGRATIONS.values(): self.assertTrue( os.path.isfile(settings.DEPLOY_ROOT + integration.logo_url), integration.name)
def test_check_if_every_integration_has_logo_that_exists(self) -> None: for integration in INTEGRATIONS.values(): self.assertTrue(os.path.isfile(os.path.join(DEPLOY_ROOT, integration.logo)))