05/22 Enhance codes and fix bugs 2
This commit is contained in:
@@ -242,10 +242,15 @@ def inbox():
|
||||
.order_by(SharedItem.created_at.desc())
|
||||
.all()
|
||||
)
|
||||
owner_ids = {s.owner_id for s in shares}
|
||||
owners = (
|
||||
{u.id: u for u in User.query.filter(User.id.in_(owner_ids)).all()}
|
||||
if owner_ids else {}
|
||||
)
|
||||
result = []
|
||||
for s in shares:
|
||||
d = s.to_dict()
|
||||
owner = db.session.get(User, s.owner_id)
|
||||
owner = owners.get(s.owner_id)
|
||||
d['owner_email'] = owner.email if owner else 'Unknown'
|
||||
d['owner_public_key'] = owner.sharing_public_key if owner else None
|
||||
result.append(d)
|
||||
|
||||
Reference in New Issue
Block a user