GNU bug report logs - #70871
[PATCH] Show avatars from Libravatar.

Previous Next

Package: mumi;

Reported by: Felix Lechner <felix.lechner <at> lease-up.com>

Date: Sat, 11 May 2024 03:21:02 UTC

Severity: normal

Tags: patch

Done: Arun Isaac <arunisaac <at> systemreboot.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: noe <at> xn--no-cja.eu
To: 70871 <at> debbugs.gnu.org
Cc: Noé Lopez <noelopez <at> free.fr>
Subject: bug#70871: [PATCH v2 2/2] web: Show avatars from Libravatar.
Date: Sat,  2 Nov 2024 16:34:50 +0100
From: Noé Lopez <noelopez <at> free.fr>

* configure.ac: New dependency.
* mumi/web/view/html.scm: Use Libavatar images as avatars.
---
 configure.ac           |  5 +++++
 mumi/web/view/html.scm | 11 ++++++++---
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 5981682..ff754b4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -74,6 +74,11 @@ if test "x$have_kolam" != "xyes"; then
   AC_MSG_ERROR([Guile kolam is missing; please install it.])
 fi
 
+GUILE_MODULE_AVAILABLE([have_avatar], [(avatar url)])
+if test "x$have_avatar" != "xyes"; then
+  AC_MSG_ERROR([Guile avatar is missing; please install it.])
+fi
+
 guilemoduledir="${datarootdir}/guile/site/${GUILE_EFFECTIVE_VERSION}"
 AC_SUBST([guilemoduledir])
 AC_SUBST([GUILE_EFFECTIVE_VERSION])
diff --git a/mumi/web/view/html.scm b/mumi/web/view/html.scm
index 661f248..a037a74 100644
--- a/mumi/web/view/html.scm
+++ b/mumi/web/view/html.scm
@@ -19,6 +19,7 @@
 ;;; <http://www.gnu.org/licenses/>.
 
 (define-module (mumi web view html)
+  #:use-module (avatar url)
   #:use-module (email email)
   #:use-module (mumi config)
   #:use-module (mumi debbugs)
@@ -427,12 +428,16 @@ failed to process associated messages.")
 (define* (avatar sender
 		 #:optional
 		 (participants (list (sender-email sender))))
-  `(div (@ (class "avatar")
+  `(img (@ (class "avatar")
            (style ,(string-append
 		    "background-color:"
 		    (avatar-color (sender-email sender)
-				  participants))))
-	,(string-upcase (string-take (sender-name sender) 1))))
+				  participants)))
+	   (src ,(libravatar-url (sender-email sender)
+				 #:default "404"
+				 #:height 48))
+	   (alt ,(string-upcase (string-take (sender-name sender) 1)))
+	   (aria-hidden "true"))))
 
 (define* (issue-page bug #:key flash-message plain?)
   "Render the conversation for the given BUG."
-- 
2.46.0





This bug report was last modified 92 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.