...
 
Commits (2)
......@@ -194,8 +194,12 @@ def set_matrix_avatar(user):
try:
matrix_api.set_avatar_url(matrix_id, ul['content_uri'])
avatar = Avatars(pnut_user=user.username, avatar=user.content.avatar_image.link)
db_session.add(avatar)
avatar = Avatars.query.filter(Avatars.pnut_user == user.username).one_or_none()
if avatar is None:
avatar = Avatars(pnut_user=user.username, avatar=user.content.avatar_image.link)
db_session.add(avatar)
else:
avatar.avatar = user.content.avatar_image.link
db_session.commit()
except MatrixRequestError:
......@@ -254,7 +258,7 @@ def on_message(ws, message):
new_message(pmsg)
def on_error(ws, error):
logger.debug("on_error: !!! ERROR !!!")
logger.error("on_error: !!! ERROR !!!")
logger.error(error)
def on_close(ws):
......