{# -*- coding: utf-8 -*- This file is part of Invenio. Copyright (C) 2016-2024 CERN. Copyright (C) 2024-2026 Northwestern University. Copyright (C) 2025 Graz University of Technology. Invenio is free software; you can redistribute it and/or modify it under the terms of the MIT License; see LICENSE file for more details. #} {%- from "invenio_theme/macros/truncate.html" import truncate_text %} {%- from "invenio_communities/details/macros/access-status-label.html" import access_status_label -%} {% macro button_for_membership(community_ui) %} {# Macro to display the button related to membership (request or discussion) #} {# Ths conditionals try hard to reduce the need for a DB hit #} {% if config.COMMUNITIES_ALLOW_MEMBERSHIP_REQUESTS %} {% if community_ui["access"]["member_policy"] == "open" %} {# TODO: Create a new temporary and off-the-books community role for pending members and leverage it in permission checks to forego the need to hit the database every time. #} {% set request_id_of_pending_member = get_request_id_of_pending_member(g.identity, community_ui["id"]) %} {# None if no pending membership or invitation request #} {% if request_id_of_pending_member %} {{ _("Membership discussion") }} {% elif permissions.can_request_membership %}
{% endif %}