Send a notification when a follow action happens

This commit is contained in:
2018-07-09 14:32:38 +02:00
parent 379a5b1bb0
commit 3bd381692b
2 changed files with 14 additions and 1 deletions

View File

@@ -24,6 +24,7 @@ from warnings import warn
from flask_babelex import lazy_gettext
from flask_security import UserMixin, RoleMixin
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy.ext.hybrid import hybrid_property
from sqlalchemy.orm.exc import NoResultFound
from sqlalchemy_utils.types.choice import ChoiceType
@@ -519,6 +520,11 @@ class Notification(db.Model):
return item_class.query.get(self.item_id)
@item.setter
def item(self, value):
self.item_type = value.__class__.__name__
self.item_id = value.id
@property
def message(self):
"""Get the translated message for ``key``