fix user delete profile pic
This commit is contained in:
parent
da53b7fa00
commit
013a94d1e9
|
@ -55,11 +55,11 @@ def update_user_info():
|
||||||
if data["profile_picture"] is None:
|
if data["profile_picture"] is None:
|
||||||
if user.profile_picture_id:
|
if user.profile_picture_id:
|
||||||
file = user.profile_picture
|
file = user.profile_picture
|
||||||
|
user.profile_picture_id = None
|
||||||
|
db.session.flush()
|
||||||
if file:
|
if file:
|
||||||
File.delete(file.id)
|
File.delete(file.id)
|
||||||
s3.delete(file.path)
|
s3.delete(file.path)
|
||||||
|
|
||||||
user.profile_picture_id = None
|
|
||||||
db.session.flush()
|
db.session.flush()
|
||||||
else:
|
else:
|
||||||
raw_data = base64.decodebytes(data["profile_picture"].encode())
|
raw_data = base64.decodebytes(data["profile_picture"].encode())
|
||||||
|
|
|
@ -30,6 +30,7 @@ from app.email_utils import (
|
||||||
)
|
)
|
||||||
from app.extensions import db
|
from app.extensions import db
|
||||||
from app.models import User, CustomDomain, Alias, Contact, EmailLog
|
from app.models import User, CustomDomain, Alias, Contact, EmailLog
|
||||||
|
|
||||||
# flake8: noqa: E101, W191
|
# flake8: noqa: E101, W191
|
||||||
from tests.utils import login
|
from tests.utils import login
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue