Compare commits

..

No commits in common. "239faac7dd9de9bb073ba817c47616c621ab7132" and "5b3f63cd0ad9f980a51ae011d714bae559170035" have entirely different histories.

2 changed files with 4 additions and 5 deletions

View File

@ -10,7 +10,7 @@ from .user import User
class Notification(db.Model, ModelSerializeMixin): class Notification(db.Model, ModelSerializeMixin):
__tablename__ = "notification" __tablename__ = "notification"
id: int = db.Column("id", Serial, primary_key=True) id: int = db.Column("id", Serial, primary_key=True)
plugin: str = db.Column(db.String(127), nullable=False) plugin: str = db.Column(db.String(30), nullable=False)
text: str = db.Column(db.Text) text: str = db.Column(db.Text)
data: Any = db.Column(db.PickleType(protocol=4)) data: Any = db.Column(db.PickleType(protocol=4))
time: datetime = db.Column(UtcDateTime, nullable=False, default=UtcDateTime.current_utc) time: datetime = db.Column(UtcDateTime, nullable=False, default=UtcDateTime.current_utc)

View File

@ -102,10 +102,9 @@ class Plugin:
db.session.commit() db.session.commit()
def notify(self, user, text: str, data=None): def notify(self, user, text: str, data=None):
if not user.deleted: n = Notification(text=text, data=data, plugin=self.id, user_=user)
n = Notification(text=text, data=data, plugin=self.id, user_=user) db.session.add(n)
db.session.add(n) db.session.commit()
db.session.commit()
def serialize(self): def serialize(self):
"""Serialize a plugin into a dict """Serialize a plugin into a dict