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

fixes the logic for avatar save checks #2734

Merged
merged 1 commit into from
Nov 8, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/avatar/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@ def save(self, *args, force_insert=False, force_update=False, **kwargs):
"""Override the save to perform change comparison against PNG and SVG fields."""
if (self.svg != self.__previous_svg) or (self.svg and not self.custom_avatar_png):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alternatively we could just remove the if statement and update every single time

# If the SVG has changed, perform PNG conversion.
self.__previous_svg = self.svg
self.convert_custom_svg()
if (self.png != self.__previous_png) or (self.png and not self.github_svg):
# If the PNG has changed, perform SVG conversion.
self.__previous_png = self.png
self.convert_github_png()

super(Avatar, self).save(force_insert, force_update, *args, **kwargs)
self.__previous_svg = self.svg
self.__previous_png = self.png

def get_color(self, key='Background', with_hashbang=False):
if key not in ['Background', 'ClothingColor', 'HairColor', 'ClothingColor', 'SkinTone']:
Expand Down