fix user delete profile pic
This commit is contained in:
parent
da53b7fa00
commit
013a94d1e9
|
@ -55,12 +55,12 @@ 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)
|
||||||
|
db.session.flush()
|
||||||
user.profile_picture_id = None
|
|
||||||
db.session.flush()
|
|
||||||
else:
|
else:
|
||||||
raw_data = base64.decodebytes(data["profile_picture"].encode())
|
raw_data = base64.decodebytes(data["profile_picture"].encode())
|
||||||
file_path = random_string(30)
|
file_path = random_string(30)
|
||||||
|
|
|
@ -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