-
Jano authored
Some bell notifications need to be removed at a specific time without an event happening at this specific time. Others need to be updated then, as attributes change, for example their count. This commit implements a call in the listBells() method of the BellGateway class, that calls the newly introduced BellUpdateTrigger to update expired bells before they are delivered to the client. This implementation stands in contrast to our immediate bell updates via the webSocket, but the expiration updates would require a cron job or a tricky client side implementation to be triggered immediately, that's why it's triggered every time bells are fetched from the database now, which means that it will happen after every page reloading and after anything else that triggers an update of the bells. The BellUpdateTrigger is a service, that all classes that need to update their bells when they expire, should subscribe to. For that, they need to implement the updateExpiredBells function of the BellUpdaterInterface. After they subscribed, their implementations of the updateExpiredBells() function will be called every time the someone calls the BellUpdateTrigger::triggerUpdate() function (which, as already mentioned, currently happens before bells are fetched from the database). This implementation allows to easily change the trigger for the updates, for example, we could easily move it to a cronjob or to an Xhr function that gets called by the frontend. It also makes it easily possible for every class to become a bell updater and send bells with an expiration date to update them later.
08500547