-
Notifications
You must be signed in to change notification settings - Fork 85
Closed
Labels
Milestone
Description
Problem
See #1286 for an explanation of how a Message system works.
Once we have created a Message and it's associated Conversation, any side of the conversation can post a reply.
Each of these replies then creates a ConversationPart containing its contents.
Since editing would be part of the expected flow, we need an edit endpoint. It's likely not of highest priority, though
Subtasks
- implement
update_changeset- we keep putting this into the schema module, but I really think that does not fit well with the context paradigm, so I'm open to suggestions on where to put it. I'm thinking
Messages.ConversationPart. Could even be private - casts
[:body, :read_at] - if no
:read_atvalue provided, set to current timestamp
- we keep putting this into the schema module, but I really think that does not fit well with the context paradigm, so I'm open to suggestions on where to put it. I'm thinking
- test
update_changeset, or testingMessages.update_conversation_part/2might be enough - implement
Policy.ConversationPart.update?current_useris authorized ifcurrent_user.id == record.author_id
- write tests for
Policy.ConversationPart.update? - implement
Messages.update_conversation_part(record, params)- probably delegates to
Messages.ConversationPart.update/2 - uses
update_changeset
- probably delegates to
- test
Messages.update_conversation_part(record, params)- if
update_changesetis private, make sure to test casting behavior to
- if
- implement
ConversationPartController:updateendpoint- fetches by id
- authorizes using policy
- updates record using
Messages.update_conversation_part/2
- write tests for
:updateendpoint
Questions
Do we want to allow editing old parts? Are there any restrictions?
I'm thinking we disable it in the client UI (only the last item can be edited by the author of it), and additionally, add a validation to the update changeset to prevent further editing through direct requests.
References
Requires work on #1278, #1286 to be merged before work here can be done