GNU bug report logs -
#39965
[PATCH] Add support for multiple gravatar-like services
Previous Next
Reported by: Philip K <philip <at> warpmail.net>
Date: Sat, 7 Mar 2020 00:12:02 UTC
Severity: normal
Tags: patch
Fixed in version 28.1
Done: Robert Pluim <rpluim <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your message dated Tue, 24 Mar 2020 18:00:55 +0100
with message-id <m2imithem0.fsf <at> gmail.com>
and subject line Re: bug#39965: [PATCH] Add support for multiple gravatar-like services
has caused the debbugs.gnu.org bug report #39965,
regarding [PATCH] Add support for multiple gravatar-like services
to be marked as done.
(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)
--
39965: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=39965
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
Specifically, the non-proprietary services libravatar (now default)
and unicornify have been added. The behaviour is customised via the
new variable `gravatar-service'.
---
lisp/image/gravatar.el | 19 +++++++++++++++----
test/lisp/image/gravatar-tests.el | 1 +
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/lisp/image/gravatar.el b/lisp/image/gravatar.el
index b8542bc3c3..c1ae0cefe3 100644
--- a/lisp/image/gravatar.el
+++ b/lisp/image/gravatar.el
@@ -118,9 +118,16 @@ gravatar-force-default
:version "27.1"
:group 'gravatar)
-(defconst gravatar-base-url
- "https://www.gravatar.com/avatar"
- "Base URL for getting gravatars.")
+(defcustom gravatar-service 'libravatar
+ "Symbol denoting gravatar-like service to use."
+ :type '(choice (const libravatar)
+ (const gravatar)
+ (const unicornify))
+ :version "27.1"
+ :link '(url-link "https://www.libravatar.org/")
+ :link '(url-link "https://unicornify.pictures/")
+ :link '(url-link "https://gravatar.com/")
+ :group 'gravatar)
(defun gravatar-hash (mail-address)
"Return the Gravatar hash for MAIL-ADDRESS."
@@ -142,7 +149,11 @@ gravatar-build-url
"Return the URL of a gravatar for MAIL-ADDRESS."
;; https://gravatar.com/site/implement/images/
(format "%s/%s?%s"
- gravatar-base-url
+ (cond ((eq gravatar-service 'gravatar)
+ "https://www.gravatar.com/avatar")
+ ((eq gravatar-service 'unicornify)
+ "https://unicornify.pictures/avatar/")
+ (t "https://seccdn.libravatar.org/avatar"))
(gravatar-hash mail-address)
(gravatar--query-string)))
diff --git a/test/lisp/image/gravatar-tests.el b/test/lisp/image/gravatar-tests.el
index e66b5c6803..31a28293fa 100644
--- a/test/lisp/image/gravatar-tests.el
+++ b/test/lisp/image/gravatar-tests.el
@@ -65,6 +65,7 @@ gravatar-build-url
"Test `gravatar-build-url'."
(let ((gravatar-default-image nil)
(gravatar-force-default nil)
+ (gravatar-service 'gravatar)
(gravatar-size nil))
(should (equal (gravatar-build-url "foo") "\
https://www.gravatar.com/avatar/acbd18db4cc2f85cedef654fccc4a4d8?r=g"))))
--
2.20.1
[Message part 3 (message/rfc822, inline)]
>>>>> On Tue, 17 Mar 2020 19:06:19 +0100, philip <at> warpmail.net (Philip K.) said:
Philip> Robert Pluim <rpluim <at> gmail.com> writes:
>> This one still checks only the avatar record (and is it avatar-sec or
>> avatar_sec?).
Philip> Oops, I seem to have selected the wrong patch. I double checked this
Philip> time. And regarding your question, according to [0] it has to be
Philip> "avatar-sec.". Sorry for all the trouble!
Thanks. Pushed to master as 421eeff243 (with my typo in NEWS fixed).
Closing bug.
Robert
This bug report was last modified 5 years and 118 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.