Add support for using forum profile pictures

This commit is contained in:
rubenwardy
2018-12-25 19:28:32 +00:00
parent f94885a58f
commit 21960f2404
6 changed files with 94 additions and 18 deletions

View File

@@ -25,7 +25,7 @@ import urllib.request
from urllib.parse import urlparse, quote_plus
@celery.task()
def checkForumAccount(username, token=None):
def checkForumAccount(username):
try:
profile = getProfile("https://forum.minetest.net", username)
except OSError:
@@ -47,6 +47,10 @@ def checkForumAccount(username, token=None):
user.github_username = github_username
needsSaving = True
pic = profile.avatar
needsSaving = needsSaving or pic != user.profile_pic
user.profile_pic = pic
# Save
if needsSaving:
db.session.commit()