[plugin] Plugins should have an unique ID

This commit is contained in:
Ferdinand Thiessen 2021-11-11 15:22:15 +01:00
parent 2dabd1dd34
commit 3d833fb6af
2 changed files with 3 additions and 1 deletions

View File

@ -33,6 +33,7 @@ class Plugin:
blueprint = None # You have to override
permissions = [] # You have to override
id = "dev.flaschengeist.plugin" # You have to override
name = "plugin" # You have to override
models = None # You have to override
@ -94,7 +95,7 @@ class Plugin:
db.session.commit()
def notify(self, user, text: str, data=None):
n = Notification(text=text, data=data, plugin=self.name, user_=user)
n = Notification(text=text, data=data, plugin=self.id, user_=user)
db.session.add(n)
db.session.commit()

View File

@ -11,6 +11,7 @@ from . import permissions, models
class EventPlugin(Plugin):
name = "events"
id = "dev.flaschengeist.events"
plugin = LocalProxy(lambda: current_app.config["FG_PLUGINS"][EventPlugin.name])
permissions = permissions.permissions
blueprint = Blueprint(name, __name__)