Services you subscribe to
+ {% for service in active_services %}
+ {% empty %}
+
You are not subscribed to any service.
+ {% endfor %}
Available services
+ {% for service in non_active_services %}
-
-
-
Mastodon
-
Mastodon is a service where you can write things to people around the world.
-
Read more …
-
-
Subscribe
-
-
-
+ {% endfor %}
- {% endcomment %}
{% endblock %}
diff --git a/src/project/views.py b/src/project/views.py
index 26db680..b7ad26f 100644
--- a/src/project/views.py
+++ b/src/project/views.py
@@ -1,3 +1,5 @@
+from membership.models import ServiceAccess
+from services.registry import ServiceRegistry
from utils.view_utils import render
@@ -6,4 +8,28 @@ def index(request):
def services_overview(request):
- return render(request, "services_overview.html")
+ active_services = [
+ access.service_implementation
+ for access in ServiceAccess.objects.filter(
+ user=request.user,
+ )
+ ]
+
+ active_service_classes = [service.__class__ for service in active_services]
+
+ services = [
+ service
+ for _, service in ServiceRegistry.get_items()
+ if service not in active_service_classes
+ ]
+
+ context = {
+ "non_active_services": services,
+ "active_services": active_services,
+ }
+
+ return render(
+ request=request,
+ template_name="services_overview.html",
+ context=context,
+ )
diff --git a/src/services/registry.py b/src/services/registry.py
index 8fc430e..f80926d 100644
--- a/src/services/registry.py
+++ b/src/services/registry.py
@@ -13,6 +13,10 @@ class ServiceInterface(Interface):
registry = ServiceRegistry
+ name: str
+ description: str
+ url: str
+
public: bool = False
# TODO: add a way to add a something which defines the required fields for a service
diff --git a/src/services/services.py b/src/services/services.py
index e5580ac..f5e4998 100644
--- a/src/services/services.py
+++ b/src/services/services.py
@@ -3,25 +3,43 @@ from .registry import ServiceInterface
class MailService(ServiceInterface):
slug = "mail"
+ name = "Mail"
+ url = "https://mail.data.coop"
+ description = "Mail service for data.coop"
class MatrixService(ServiceInterface):
slug = "matrix"
+ name = "Matrix"
+ url = "https://matrix.data.coop"
+ description = "Matrix service for data.coop"
class MastodonService(ServiceInterface):
slug = "mastodon"
+ name = "Mastodon"
+ url = "https://social.data.coop"
+ description = "Mastodon service for data.coop"
class NextcloudService(ServiceInterface):
slug = "nextcloud"
+ name = "Nextcloud"
+ url = "https://cloud.data.coop"
+ description = "Nextcloud service for data.coop"
class HedgeDocService(ServiceInterface):
slug = "hedgedoc"
+ name = "HedgeDoc"
+ url = "https://pad.data.coop"
public = True
+ description = "HedgeDoc service for data.coop"
class RalllyService(ServiceInterface):
slug = "rallly"
+ name = "Rallly"
+ url = "https://when.data.coop"
public = True
+ description = "Rallly service for data.coop"