-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add support for downloading avatars from gravatar #1906
Conversation
this is a draft (no linting, no tests), based on a WIP branch i'm using locally to improve photo coverage in my address book. because gravatar requires the email field, i found the current abstraction layer for the social providers needed some iteration to be more flexible about what parts of a contact card are needed to do photo lookups. also, because gravatar relies on the email field, i found it quite common that a contact card has multiple email fields, but only one of those would have a gravatar profile photo associated with it. thus, supporting multiple lookups (as opposed to just using the first one, irrespective of if it returns a photo or not) was important. i've modified the social provider abstraction to both support being more general about what fields are needed for the profile photo lookup and to also support looking up an array of the same fields, if the first one doesn't return a valid profile photo. is their appetite to see this feature land? if so, i'ld be happy to invest time in improving code quality if i can get some guidance on some of the decisions made currently and high level ideas about what to test. |
Can you also add support for libravatar? I think it uses the same URL scheme but a different domain and is free-er. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! I am very happy to see this feature evolving.
Thank you also for finding and fixing some errors in this PR.
I only found a typo and did not yet have the chance to try it out, but the code looks good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check the indentation too :)
22b0260
to
f652b3f
Compare
adding support for gravatar to the current social providers/services. because gravatar relies on email instead of the x-socialprofile carddav field, this requires re-working the current abstraction for how social providers work. also in this change is improved support for when a contact card has multiple fields of the same type (as might be common with email) thus they all can be checked for profile photos if one of them doesn't result in a valid photo Signed-off-by: leith abdulla <online-nextcloud@eleith.com>
f652b3f
to
296ebf7
Compare
adopted linting/style, addressed some minor feedback and will begin working on unit testing |
Just in case someone else also does not have any contacts using gravatar, you can use this email address for testing: wzueyuqgwqsgeiiqsr@niwghx.online |
Codecov Report
@@ Coverage Diff @@
## master #1906 +/- ##
=============================================
+ Coverage 33.69% 66.85% +33.15%
- Complexity 178 249 +71
=============================================
Files 21 22 +1
Lines 546 691 +145
=============================================
+ Hits 184 462 +278
+ Misses 362 229 -133
Continue to review full report at Codecov.
|
c452f09
to
529bb95
Compare
@call-me-matt code coverage dropped because off pushing more of the there aren't any existing unit tests for the social providers, so i haven't taken a stab at those yet. with that said, if there was an obvious place to abstract some of the otherwise, linting and unit tests are now done (and test coverage of |
Signed-off-by: leith abdulla <online-nextcloud@eleith.com>
529bb95
to
da321c1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job, thank you
this commit adds unit tests for all providers while also reducing some redundancy in looking up social fields minor feedback was addressed as well as some minor bugs fixed Signed-off-by: leith abdulla <online-nextcloud@eleith.com>
fd82342
to
ca1c40a
Compare
use a gravatar logo instead of a wordpress logo Signed-off-by: leith abdulla <online-nextcloud@eleith.com>
@call-me-matt all feedback has been addressed. given there was a bug in one of the providers, i went ahead and added unit tests for all of the other providers and this PR should increase code coverage overall now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, works nicely, great job!
@call-me-matt can i merge this myself, or does someone else need to? (the merge button does highlight for me, but wanted to double check...) |
I guess so, but usually I wait for @skjnldsv as the maintainer of this app for feedback. Normally, he also does the merge right away. |
If it's green, please do! 💪✨ |
thanks everyone. pleasure working with you both on this one. |
adding support for gravatar to the current social providers/services.
because gravatar relies on email instead of the x-socialprofile carddav
field, this requires re-working the current abstraction for how social
providers work.
also in this change is improved support for when a contact card has
multiple fields of the same type (as might be common with email) thus
they all can be checked for profile photos if one of them doesn't result
in a valid photo
fixes #1905