From 2a7f81389ee4a3e8988b2d9c01cc78992a8e1024 Mon Sep 17 00:00:00 2001 From: Flancian <0@flancia.org> Date: Mon, 16 Nov 2020 21:29:37 +0100 Subject: [PATCH] User pages now start with their README. --- app/agora.py | 2 +- app/db.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/agora.py b/app/agora.py index 857583f..25b4343 100644 --- a/app/agora.py +++ b/app/agora.py @@ -56,7 +56,7 @@ def today(): @bp.route('/user/') @bp.route('/@') def user(user): - return render_template('user.html', user=user, subnodes=db.subnodes_by_user(user)) + return render_template('user.html', user=user, readmes=db.user_readmes(user), subnodes=db.subnodes_by_user(user)) @bp.route('/garden/') def garden(garden): diff --git a/app/db.py b/app/db.py index 8f9fcdf..6643bcb 100644 --- a/app/db.py +++ b/app/db.py @@ -181,6 +181,12 @@ def subnodes_by_user(user): subnodes = [subnode for subnode in all_subnodes() if subnode.user == user] return subnodes +def user_readmes(user): + # hack hack + # fix duplication. + subnodes = [subnode for subnode in all_subnodes() if subnode.user == user and re.search('readme', subnode.wikilink, re.IGNORECASE)] + return subnodes + def subnode_by_uri(uri): subnode = [subnode for subnode in all_subnodes() if subnode.uri == uri] if subnode: