Open bval opened 9 years ago
Heavily related to #100 ... shame @jfryman isn't accepting his invite :scream:
This also would help accomplish a few other things:
tickets_controller
(it's huge) by abstracting some of the notification linesMay need to whiteboard this a bit.
Some thoughts. The idea of splitting it out into a separate model would make notification triggers a bit easier (such as traversing all upcoming events with unfulfilled TicketRequest
s). It would also make the accounting aspect clearer, as these would become the actual ledger entries.
TicketRequest
model
key id
int ticket_id
int transfer_to
int transfer_from
decimal cost
text transfer_method
text transfer_details
time transfer_completed
text payment_method
text payment_details
text notes
timestamps
TicketRequest
is created each time a user who does not own a viewed ticket clicks request
.user_id
is updated on the ticket accordinglyTicketRequest
is an optional step - the owner can simply update the assignment without using a request to bypass accounting system (such as to themselves)TicketRequest
can be generated to create an obligation to the target userLike this. Suggest we use a state machine gem to implement this as it'll model the state transitions appropriately and give us places to hook in for emitting events to the relevant parties when a request changes state. Have used the pluginaweek/state_machine
gem before but there are others we could look into.
Looking at implementing this to power the notification system: https://github.com/mailboxer/mailboxer
Would appreciate a quick gut check from others before I do. Biggest pros appear to be:
Cons appear to be:
Currently ticket requests and other types of notifications are not modeled or stored anywhere. This will make doing true push notifications tricky. We need some way to model and store these, and acknowledge them / delete them when they have been viewed.
It would also be nice to have an index view of read / unread notifications that link to the relevant ticket or whatever they concern so you can login to the app and see what requires your attention.