]> git.ipfire.org Git - ipfire.org.git/commitdiff
lists: Remove stuff for Mailman
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 5 Mar 2025 16:37:11 +0000 (16:37 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 5 Mar 2025 16:37:11 +0000 (16:37 +0000)
We are moving away from mailman and therefore don't need this any more.

I don't think that the new solution will have some API that we can use
instead, so all of it is going for now.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
src/backend/accounts.py
src/backend/base.py
src/backend/lists.py [deleted file]
src/templates/lists/index.html [deleted file]
src/templates/lists/subscribe.html [deleted file]
src/templates/lists/unsubscribe.html [deleted file]
src/web/__init__.py
src/web/lists.py [deleted file]

index 9c127b5e7d8128e489e727f47d42f02d016eb70b..097bbd8d3db54b4c7ce06d096870b7ad9ac28718 100644 (file)
@@ -63,7 +63,6 @@ backend_PYTHON = \
        src/backend/httpclient.py \
        src/backend/hwdata.py \
        src/backend/iuse.py \
-       src/backend/lists.py \
        src/backend/messages.py \
        src/backend/mirrors.py \
        src/backend/misc.py \
@@ -95,7 +94,6 @@ web_PYTHON = \
        src/web/fireinfo.py \
        src/web/handlers.py \
        src/web/iuse.py \
-       src/web/lists.py \
        src/web/location.py \
        src/web/nopaste.py \
        src/web/ui_modules.py \
@@ -278,11 +276,6 @@ templates_location_how_to_use_DATA = \
 
 templates_location_how_to_usedir = $(templates_locationdir)/how-to-use
 
-templates_lists_DATA = \
-       src/templates/lists/index.html
-
-templates_listsdir = $(templatesdir)/lists
-
 templates_messages_DATA = \
        src/templates/messages/base.html \
        src/templates/messages/base-promo.html \
index 8928033ceb8ca4edd6ffa0b36a09784b1d246940..5ffc66a56a2cc024b4c8466131ecb9116d9d1573 100644 (file)
@@ -1569,11 +1569,6 @@ class Account(LDAPObject):
                # Disable the user
                await user.disable(text)
 
-       # Mailman
-
-       async def get_lists(self):
-               return await self.backend.lists.get_subscribed_lists(self)
-
 
 class Groups(Object):
        hidden_groups = (
index 7131127e1d85f6ae9dafeb041f04208f984a4624..cfe7a78fdc4c2bdc014fd86ed42a20cd3fab7636 100644 (file)
@@ -20,7 +20,6 @@ from . import database
 from . import fireinfo
 from . import httpclient
 from . import iuse
-from . import lists
 from . import messages
 from . import mirrors
 from . import netboot
@@ -205,10 +204,6 @@ class Backend(object):
        def groups(self):
                return accounts.Groups(self)
 
-       @lazy_property
-       def lists(self):
-               return lists.Lists(self)
-
        @lazy_property
        def messages(self):
                return messages.Messages(self)
diff --git a/src/backend/lists.py b/src/backend/lists.py
deleted file mode 100644 (file)
index d2adff4..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-#!/usr/bin/python3
-
-import json
-import urllib.parse
-
-from . import accounts
-from . import misc
-
-class Lists(misc.Object):
-       @property
-       def url(self):
-               """
-                       Returns the base URL of a Mailman instance
-               """
-               return self.settings.get("mailman-url")
-
-       @property
-       def username(self):
-               return self.settings.get("mailman-username")
-
-       @property
-       def password(self):
-               return self.settings.get("mailman-password")
-
-       async def _request(self, method, url, data=None):
-               headers, body = {}, None
-
-               # URL
-               url = urllib.parse.urljoin(self.url, url)
-
-               # For GET requests, append query arguments
-               if method == "GET":
-                       if data:
-                               url = "%s?%s" % (url, urllib.parse.urlencode(data))
-
-               # For POST/PUT encode all arguments as JSON
-               elif method in ("POST", "PUT", "PATCH"):
-                       headers |= {
-                               "Content-Type" : "application/json",
-                       }
-
-                       body = json.dumps(data)
-
-               # Send the request and wait for a response
-               res = await self.backend.http_client.fetch(url, method=method,
-                       headers=headers, body=body,
-
-                       # Authentication
-                       auth_username=self.username, auth_password=self.password,
-               )
-
-               # Decode JSON response
-               body = json.loads(res.body)
-
-               # XXX handle errors
-
-               return body
-
-       # Lists
-
-       async def _get_lists(self, *args, **kwargs):
-               lists = []
-
-               # Fetch the response
-               response = await self._request(*args, **kwargs)
-
-               # Fetch entries
-               for entry in response.get("entries", []):
-                       list = List(self.backend, **entry)
-                       lists.append(list)
-
-               return lists
-
-       async def get_lists(self):
-               """
-                       Fetches all available lists
-               """
-               data = {
-                       "advertised" : True,
-               }
-
-               return await self._get_lists("GET", "/api/3.1/lists", data=data)
-
-       async def get_subscribed_lists(self, account):
-               data = {
-                       "subscriber" : account.email,
-                       "role"       : "member",
-               }
-
-               return await self._get_lists("GET", "/api/3.1/members/find", data=data)
-
-
-class List(misc.Object):
-       def init(self, list_id, **kwargs):
-               self.list_id = list_id
-
-               # Store all other data
-               self.data = kwargs
-
-       def __repr__(self):
-               return "<List %s>" % self.list_id
-
-       def __str__(self):
-               return self.display_name
-
-       def __eq__(self, other):
-               if isinstance(other, self.__class__):
-                       return self.list_id == other.list_id
-
-               return NotImplemented
-
-       def __lt__(self, other):
-               if isinstance(other, self.__class__):
-                       return self.list_id < other.list_id
-
-               return NotImplemented
-
-       def __len__(self):
-               return self.data.get("member_count")
-
-       @property
-       def display_name(self):
-               return self.data.get("display_name")
-
-       @property
-       def description(self):
-               return self.data.get("description")
-
-       @property
-       def archive_url(self):
-               return "https://lists.ipfire.org/hyperkitty/list/%s/" % self.list_id
-
-       async def subscribe(self, account):
-               pass # XXX TODO
-
-       async def unsubscribe(self, account):
-               pass # XXX TODO
diff --git a/src/templates/lists/index.html b/src/templates/lists/index.html
deleted file mode 100644 (file)
index eb90ab5..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-{% extends "../base.html" %}
-
-{% block title %}{{ _("Lists") }}{% end block %}
-
-{% block head %}
-       {% module OpenGraph(
-               title=_("IPFire - Mailing Lists"),
-               description="A Collection of every IPFire Mailing List",
-       ) %}
-{% end block %}
-
-{% block container %}
-       <section class="hero is-primary">
-               <div class="hero-body">
-                       <div class="container">
-                               <nav class="breadcrumb" aria-label="breadcrumbs">
-                                       <ul>
-                                               <li>
-                                                       <a href="/">
-                                                               {{ _("Home") }}
-                                                       </a>
-                                               </li>
-                                               <li class="is-active">
-                                                       <a href="#" aria-current="page">{{ _("Mailing Lists") }}</a>
-                                               </li>
-                                       </ul>
-                               </nav>
-
-                               <h1 class="title">{{ _("Mailing Lists") }}</h1>
-                       </div>
-               </div>
-       </section>
-
-       <section class="section">
-               <div class="container">
-                       {% for list in sorted(lists) %}
-                               <div class="block">
-                                       <div class="box">
-                                               <h4 class="title is-4">
-                                                       {{ list }}
-                                               </h4>
-
-                                               <h6 class="subtitle is-6">
-                                                       {{ list.description }}
-                                               </h6>
-
-                                               <div class="buttons">
-                                                       <a class="button is-light" href="{{ list.archive_url }}">
-                                                               <span class="icon-text">
-                                                                       <span class="icon">
-                                                                               <i class="fa-solid fa-inbox"></i>
-                                                                       </span>
-                                                                       <span>{{ _("Archive") }}</span>
-                                                               </span>
-                                                       </a>
-
-                                                       {% if current_user %}
-                                                               {% if list in subscribed_lists %}
-                                                                       <a class="button is-success is-outlined" href="/lists/{{ list.list_id }}/unsubscribe">
-                                                                               {{ _("Subscribed") }}
-                                                                       </a>
-                                                               {% else %}
-                                                                       <a class="button is-success" href="/lists/{{ list.list_id }}/subscribe">
-                                                                               {{ _("Subscribe") }}
-                                                                       </a>
-                                                               {% end %}
-                                                       {% end %}
-                                               </div>
-                                       </div>
-                               </div>
-                       {% end %}
-               </div>
-       </section>
-{% end block %}
diff --git a/src/templates/lists/subscribe.html b/src/templates/lists/subscribe.html
deleted file mode 100644 (file)
index ef7c2d6..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-{% extends "../base.html" %}\r
-\r
-{% block title %}{{ _("Subscribe To %s") }} % {{ list }}{% end block %}\r
-\r
-{% block head %}\r
-    {% module OpenGraph(\r
-        title=_("IPFire - Subscribe to %s") % list,\r
-        description="Subscribe and you will receive emails concerning %s!" % list",\r
-    ) %}\r
-{% end block %}\r
-\r
-{% block container %}\r
-       <div class="columns is-centered">\r
-               <div class="column is-one-third-desktop">\r
-                       <div class="notification my-auto">\r
-                               <h5 class="title is-5">{{ _("Subscribe To %s") }} % {{ list }}</h5>\r
-\r
-                               <div class="content">\r
-                                       <p>\r
-                                               {{ _("Subscribe and you will receive emails concerning %s!") }} % {{ list }}\r
-                                       </p>\r
-\r
-                    {% if list.description %}\r
-                        <p>\r
-                            {{ list.description }}\r
-                        </p>\r
-                    {% end %}\r
-                               </div>\r
-\r
-                               <!-- Hier sollte dann wahrscheinlich noch ein Button zum subscriben bzw. unsubscriben hin -->\r
-                       </div>\r
-               </div>\r
-       </div>\r
-{% end block %}\r
diff --git a/src/templates/lists/unsubscribe.html b/src/templates/lists/unsubscribe.html
deleted file mode 100644 (file)
index d2a74b9..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-{% extends "../base.html" %}\r
-\r
-{% block title %}{{ _("Unsubscribe from %s") }} % {{ list }}{% end block %}\r
-\r
-{% block head %}\r
-    {% module OpenGraph(\r
-        title=_("IPFire - Unsubscribe from %s") % list,\r
-        description="Unsubscribe and you will no longer receive Emails concerning %s!" % list,\r
-    ) %}\r
-{% end block %}\r
-\r
-{% block container %}\r
-       <div class="columns is-centered">\r
-               <div class="column is-one-third-desktop">\r
-                       <div class="notification my-auto">\r
-                               <h5 class="title is-5">{{ _("We'd Be Sorry To See You Go") }}</h5>\r
-\r
-                               <div class="content">\r
-                                       <p>\r
-                                               {{ _("If you unsubscribe, you will no longer receive important emails concerning %s") }} % {{ list }}\r
-                                               {{ _("There are plenty of benefits to remain subscribed:") }}\r
-                                       </p>\r
-\r
-                    {% if list.description %}\r
-                        <p>\r
-                            {{ list.description }}\r
-                        </p>\r
-                    {% end %}\r
-                               </div>\r
-\r
-                <!-- Hier sollte dann wahrscheinlich noch ein Button zum subscriben bzw. unsubscriben hin -->\r
-                       </div>\r
-               </div>\r
-       </div>\r
-{% end block %}\r
index 2d0efca4efb5d6e466f7046776f9c22d2db2b6a1..52a1fe36b6dc1c4a6cbe85a37798689f7bb8a98b 100644 (file)
@@ -23,7 +23,6 @@ from . import donate
 from . import downloads
 from . import fireinfo
 from . import iuse
-from . import lists
 from . import location
 from . import nopaste
 from . import ui_modules
@@ -188,9 +187,6 @@ class Application(tornado.web.Application):
                        (r"/fireinfo/processors", fireinfo.ProcessorsHandler),
                        (r"/fireinfo/releases", fireinfo.ReleasesHandler),
 
-                       # Lists
-                       (r"/lists", lists.IndexHandler),
-
                        # Confirm Email
                        (r"/confirm-email/([a-z_][a-z0-9_-]{0,31})/(\w+)", auth.ConfirmEmailHandler),
 
diff --git a/src/web/lists.py b/src/web/lists.py
deleted file mode 100644 (file)
index 1425603..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/usr/bin/python3
-
-import tornado.web
-
-from . import base
-
-class IndexHandler(base.BaseHandler):
-       @tornado.web.authenticated
-       async def get(self):
-               # Fetch all available lists
-               lists = await self.backend.lists.get_lists()
-
-               # Fetch all subscribed lists
-               subscribed_lists = await self.current_user.get_lists()
-
-               self.render("lists/index.html", lists=lists, subscribed_lists=subscribed_lists)