From: Michael Tremer
Date: Wed, 26 Jul 2023 14:27:24 +0000 (+0000)
Subject: blog: Drop authors page and link to user's page
X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1f1533961826b753f0ef94da72534392cd26ea3f;p=ipfire.org.git
blog: Drop authors page and link to user's page
Signed-off-by: Michael Tremer
---
diff --git a/Makefile.am b/Makefile.am
index 33d4eec2..8b276632 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -145,7 +145,6 @@ templates_auth_modules_DATA = \
templates_auth_modulesdir = $(templates_authdir)/modules
templates_blog_DATA = \
- src/templates/blog/author.html \
src/templates/blog/compose.html \
src/templates/blog/delete.html \
src/templates/blog/drafts.html \
diff --git a/src/templates/blog/author.html b/src/templates/blog/author.html
deleted file mode 100644
index 86af62dd..00000000
--- a/src/templates/blog/author.html
+++ /dev/null
@@ -1,50 +0,0 @@
-{% extends "../base.html" %}
-
-{% block title %}{{ author }}{% end block %}
-
-{% block container %}
-
-
-
-
-
-
-
-
-
-
-
-
-
{{ author }}
-
- {% if author.description %}
-
- {% module Markdown(author.description) %}
-
- {% end %}
-
-
-
-
-
-
-
-
- {{ _("Posts") }}
-
- {% module BlogList(posts, show_author=True) %}
-
-
-{% end block %}
diff --git a/src/templates/blog/modules/list.html b/src/templates/blog/modules/list.html
index 6d704b42..3980591a 100644
--- a/src/templates/blog/modules/list.html
+++ b/src/templates/blog/modules/list.html
@@ -12,7 +12,7 @@
{% if "lightningwirelabs.com" in post.tags %}
{{ _("by Lightning Wire Labs") }}
{% elif show_author and post.author %}
- {{ _("by %s") % post.author }}
+ {{ _("by %s") % post.author }}
{% end %}
diff --git a/src/templates/blog/modules/post.html b/src/templates/blog/modules/post.html
index 004e7bbb..41e4b4d9 100644
--- a/src/templates/blog/modules/post.html
+++ b/src/templates/blog/modules/post.html
@@ -12,7 +12,7 @@
{{ _("by") }}
{% if isinstance(post.author, accounts.Account) %}
- {{ post.author.name }},
+ {{ post.author.name }},
{% else %}
{{ post.author }},
{% end %}
diff --git a/src/templates/blog/post.html b/src/templates/blog/post.html
index 8865998f..be74862d 100644
--- a/src/templates/blog/post.html
+++ b/src/templates/blog/post.html
@@ -60,7 +60,7 @@
{{ _("by") }}
{% if isinstance(post.author, accounts.Account) %}
- {{ post.author.name }},
+ {{ post.author.name }},
{% else %}
{{ post.author }},
{% end %}
diff --git a/src/web/__init__.py b/src/web/__init__.py
index 4c59132f..9041b861 100644
--- a/src/web/__init__.py
+++ b/src/web/__init__.py
@@ -126,7 +126,6 @@ class Application(tornado.web.Application):
# Blog
(r"/blog", blog.IndexHandler),
- (r"/blog/authors/(\w+)", blog.AuthorHandler),
(r"/blog/compose", blog.ComposeHandler),
(r"/blog/drafts", blog.DraftsHandler),
(r"/blog/feed.xml", blog.FeedHandler),
@@ -195,6 +194,7 @@ class Application(tornado.web.Application):
(r"/api/check/uid", auth.APICheckUID),
# Handle old pages that have moved elsewhere
+ (r"/blog/authors/(\w+)", tornado.web.RedirectHandler, { "url" : "/users/{0}" }),
(r"/donation", tornado.web.RedirectHandler, { "url" : "/donate" }),
(r"/download", tornado.web.RedirectHandler, { "url" : "/downloads" }),
(r"/download/([0-9a-z\-\.]+)", tornado.web.RedirectHandler, { "url" : "/downloads/{0}" }),
diff --git a/src/web/blog.py b/src/web/blog.py
index 365888f4..fe88fdae 100644
--- a/src/web/blog.py
+++ b/src/web/blog.py
@@ -29,24 +29,6 @@ class IndexHandler(base.BaseHandler):
self.render("blog/index.html", q=q, posts=posts, latest_post=latest_post)
-class AuthorHandler(base.BaseHandler):
- def get(self, uid):
- author = self.accounts.get_by_uid(uid)
- if not author:
- raise tornado.web.HTTPError(404, "User is unknown")
-
- # Get all posts from this author
- posts = self.backend.blog.get_by_author(author)
- if not posts:
- raise tornado.web.HTTPError(404, "User has no posts")
-
- # Allow this to be cached for 10 minutes
- if not self.current_user:
- self.set_expires(600)
-
- self.render("blog/author.html", author=author, posts=posts)
-
-
class FeedHandler(base.BaseHandler):
def get(self):
posts = self.backend.blog.get_newest(limit=10)