Skip to content
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

feat: change avatar management #2112

Merged
merged 162 commits into from
Aug 17, 2019
Merged

feat: change avatar management #2112

merged 162 commits into from
Aug 17, 2019

Conversation

djaiss
Copy link
Member

@djaiss djaiss commented Nov 28, 2018

This PR completely changes how avatars are managed.

  • We now have different avatar choices:
    • the default avatar that is now an image
    • adorable avatar
    • gravatar
    • photo that you upload
    • one of the photos on the contact page
  • Default avatars are now an image that is created based on the initials of the contact. This image is stored on the filesystem. I've decided to use an image inside of HTML, so we can actually link to it, and therefore, the API will always return an image regardless of the avatar you use. Before, clients had to figure out which avatar they would use if the user didn't upload an avatar image.
  • There is a new avatar that is pulled from http://avatars.adorable.io. This avatar is unique per contact (and uses a random UUID to identify it so no information is shared)
  • The choice of using a gravatar in the Change avatar screen only appears if an email on the profile contact page is recognized by Gravatar.
  • Any photo can be set as avatar
  • If you delete a photo that is used as avatar, the avatar defaults back to the default one for this contact
  • Rewrote how contacts are created and updated, using services

This close #2032
This close #2145
This close #715
This close #702
This close #703

Note: ⚠️after migrating data, you need to run php artisan monica:moveavatarstophotosdirectory to move all the current avatars to the new Photo directory, as avatars are now actually Photo objects.

There are several things to do in another PR once we merge this PR:

  • remove gravatar_url, avatar_location, avatar_file_name, avatar_external_url, has_avatar from the DB, which will be not used anymore. We first need to migrate all avatars to remove them completely, so it's better to do it in another PR.
  • rewrite contact creation and update API calls. they still use the old methods but if I do it in this PR, the PR will be way too big.
  • when destroying a contact, delete uploaded documents and photos. Again, for the sake of having the shorter PR, I didn't do it here.

Tasks remaining to be done

  • Clean up some tests files which use the old avatar
  • Take care of backward compatibility to the mobile app
  • Make sure the seeder works with the new avatar
  • Update the Contact resource with the new avatar properties
  • Also, fix the API
  • Migrate existing photo avatars to a Photo object
  • Replace all avatars on the dashboard
  • Replace avatars on the contact list
  • Replace avatars on the journal
  • Avatar in search
  • Make sure exporting account data as SQL is still working.
  • Make sure your changes do not break importing data with vCard and .csv files.
    • especially the use of the method updateGravatar()
    • all gravatar_url, avatar_location, avatar_file_name, avatar_external_url, has_avatar properties
  • Make sure account reset and deletion still work.
  • CHANGELOG entry added, if necessary, under UNRELEASED.
  • If it's relevant and worth mentioning, create a changelog entry for this change. The changelog entry will appear inside the UI for all users to see. To know if your change is worth the creation of a changelog entry, read the documentation.

@asbiin asbiin merged commit 72ff0d3 into master Aug 17, 2019
@asbiin asbiin deleted the 2018-11-17-new-avatars branch August 23, 2019 22:30
@scott-joe
Copy link

Does this address the variable avatar height issue?
Without extra Stylus added CSS
Screen Shot 2019-11-20 at 16 47 21
With extra Stylus added CSS
Screen Shot 2019-11-20 at 16 47 42

div.avatar-search.avatar-initials {
    line-height: 31px;
    padding-bottom: 6px;
    border-radius: 2px;
    width: 43px;
}

@scott-joe
Copy link

Oh, it's been merged already. Guess not?

@asbiin
Copy link
Member

asbiin commented Nov 20, 2019

@scott-joe the problem is still there, but as there are now 1 avatar file per contact, you can't see it. Your solution is nice, I will fix it as soon as possible.

@scott-joe
Copy link

@scott-joe the problem is still there, but as there are now 1 avatar file per contact, you can't see it. Your solution is nice, I will fix it as soon as possible.

Cool! Happy to help :) I'd love to get the thing running locally to help. Just gotta find some free time :P

@SyntaxBlitz
Copy link

It took me some digging to find this issue so I could migrate my avatars after updating monica (from v2.14). Is there a way to get this built into the main php artisan monica:update --force migration script? I was surprised to have to do it manually.

@github-actions
Copy link

This pull request has been automatically locked since there
has not been any recent activity after it was closed.
Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
5 participants