Adding usernotes.

This commit is contained in:
Michael House 2022-05-16 11:53:24 -05:00 committed by GitHub
parent 957edab4dc
commit 19903cccb5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 484 additions and 10 deletions

View file

@ -130,6 +130,7 @@ class User(Base):
authorizations = relationship("ClientAuth", viewonly=True)
awards = relationship("AwardRelationship", primaryjoin="User.id==AwardRelationship.user_id", viewonly=True)
referrals = relationship("User", viewonly=True)
notes = relationship("UserNote", foreign_keys='UserNote.reference_user', back_populates="user")
def __init__(self, **kwargs):
@ -509,6 +510,7 @@ class User(Base):
'post_count': 0 if self.shadowbanned and not (v and (v.shadowbanned or v.admin_level > 2)) else self.post_count,
'comment_count': 0 if self.shadowbanned and not (v and (v.shadowbanned or v.admin_level > 2)) else self.comment_count,
'badges': [x.path for x in self.badges],
'notes': [x.json() for x in self.notes]
}
return data