I have a Laravel app where users can subscribe to a blog tags and they need to receive notifications when an article is added to the tags they subscribed to. But we have specific needs that make it more complex :
- An article can have many tags (added anytime)
- An article can have a publishing date in the future
- An article can have a draft state and so it's not yet visible for the visitors
So if an admin create an article in draft mode, we shouldn't send notification until it remove it from draft mode and the publication date has arrived.
My problem is that because I don't know when the admin will remove the draft mode I can't create queued notification with a delay. Also because he can add a tag anytime I can't just send all the notifications when the draft mode is removed because he can come back later and add an other tag...
The only option that I have in mind is to save in a pivot table any changes that happend before it was published and when it's published send all notifications. But it feels a little weird.
I hope some of you had this kind of multi-state model that need to release some notifications, or do some actions, when it's visible to the users...