@@ -465,6 +465,9 @@
{%- if snippet_html %}
{{ faicon(icon='search', css_class="search-icon", baseline=false) }} {{ snippet_html }}
{% endif %}
+ {%- if is_member %}
+
{{ faicon(icon='crown-solid', baseline=true, css_class="mui--text-success fa-icon--right-margin") }}{% trans %}Member{% endtrans %}
+ {% endif %}
{% trans tcount=account.published_project_count, count=account.published_project_count|numberformat %}One project{% pluralize tcount %}{{ count }} projects{% endtrans %}
{% trans %}Explore{% endtrans %}
diff --git a/funnel/templates/project_layout.html.jinja2 b/funnel/templates/project_layout.html.jinja2
index 3c7aedaec..b2992d663 100644
--- a/funnel/templates/project_layout.html.jinja2
+++ b/funnel/templates/project_layout.html.jinja2
@@ -51,7 +51,7 @@
{% macro project_header(project) %}
{%- if project.livestream_urls %}
- {% if (project.is_restricted_video and project.current_roles.participant) or not project.is_restricted_video %}
+ {% if (project.is_restricted_video and project.current_roles.account_member) or not project.is_restricted_video %}
{% if project.livestream_urls|length >= 2 %}
@@ -125,7 +125,7 @@
{% endif %}
{{ project.account.title }}
- {% if project.features.subscription and project.current_roles.participant %}
+ {% if project.features.subscription and project.current_roles.account_member %}
{{ faicon(icon='crown-solid', baseline=true, css_class="mui--text-success fa-icon--right-margin") }}{% trans %}Member{% endtrans %}
{% elif project.features.subscription %}
{{ faicon(icon='lock-alt', baseline=true, css_class="fa-icon--right-margin") }}{% trans %}For members{% endtrans %}
diff --git a/funnel/views/account.py b/funnel/views/account.py
index a28a7f8bc..283534470 100644
--- a/funnel/views/account.py
+++ b/funnel/views/account.py
@@ -117,7 +117,7 @@ def organizations_as_admin(
owner: bool = False,
limit: int | None = None,
order_by_grant: bool = False,
-) -> list[RoleAccessProxy]:
+) -> list[RoleAccessProxy[Account]]:
"""Return organizations that the user is an admin of."""
if owner:
orgmems = obj.active_organization_owner_memberships
@@ -139,7 +139,7 @@ def organizations_as_admin(
@Account.views()
def organizations_as_owner(
obj: Account, limit: int | None = None, order_by_grant: bool = False
-) -> list[RoleAccessProxy]:
+) -> list[RoleAccessProxy[Account]]:
"""Return organizations that the user is an owner of."""
return obj.views.organizations_as_admin(
owner=True, limit=limit, order_by_grant=order_by_grant
@@ -173,6 +173,18 @@ def recent_organization_memberships(
)
+@Account.views(cached_property=True)
+def organizations_as_member(obj: Account) -> list[RoleAccessProxy[Account]]:
+ """Return organizations that the user has a membership in."""
+ return [
+ acc.access_for(actor=obj, datasets=('primary', 'related'))
+ for acc in Account.query.filter(
+ Account.name_in(app.config['FEATURED_ACCOUNTS'])
+ ).all()
+ if 'member' in acc.roles_for(obj)
+ ]
+
+
@Account.views('avatar_color_code', cached_property=True)
def avatar_color_code(obj: Account) -> int:
"""Return a colour code for the user's autogenerated avatar image."""
diff --git a/funnel/views/index.py b/funnel/views/index.py
index 31d789c7f..070e6f3f3 100644
--- a/funnel/views/index.py
+++ b/funnel/views/index.py
@@ -151,7 +151,7 @@ def home(self) -> ReturnRenderWith:
'featured_project_sessions': scheduled_sessions_list,
'featured_project_schedule': featured_project_schedule,
'featured_accounts': [
- p.access_for(roles={'all'}, datasets=('primary', 'related'))
+ p.current_access(datasets=('primary', 'related'))
for p in featured_accounts
],
}