Closed brylie closed 2 years ago
Hi, This issue looks good for my level. Can I work on this if not urgent?
@ritikBhandari, sure thanks! I'll assign you. I can also provide some guidance on the task.
So eventually we have to solve #24 right?
I've updated the issue description with a specification to clarify the intent and some code examples that could be useful to follow.
@ritikBhandari, yes, #24 is related to this issue. We can include this issue as part of #24 or handle them separately if desired. What would be your recommendation?
I guess we can include this issue as part of #24 since it is part of the UI settings proposal and we can have a clarity on what all tasks have been completed from the same #24
I've updated the issue description with a specification to clarify the intent and some code examples that could be useful to follow.
Yup this is quite good. Atleast provides a fair ground on where to start resolving from.
OK, there is also a pattern we can follow with the modal dialogue for #24
The modal dialogue will basically have three action buttons:
Companion
instanceCompanion
instanceI'm a bit concerned about deleting the Companion
instance without any confirmation, but don't want to overcomplicate the task(s).
If we can cancel the dialogue and click the back
button(which is already present in the main window), we dont need to add a delete
one and over-complicate things. What do u think?
And if we really want to delete
the existing instance, we should create the button in the main window rather than having it in modal dialogue.
Yes, let's just create the button on the main view for now with a confirmation modal. We can improve the user experience later if needed.
Yes, let's just create the button on the main view for now with a confirmation modal. We can improve the user experience later if needed.
delete
one right?
Yes. The user flow would be:
CompanionDeleteView
with logic described above Edit: changed "delete" to "remove" in UI texts.
That's cool!
Some companionship relationships may be temporary. As such, the care coordinator may need to remove existing companions.
Task
Specification
CompanionDeleteView
, based on the Django generic [View]() class-based viewCompanionDeleteView
takes only apost
requestCompanionDeleteView
validates that user one ofPerson
'sorganizers
or throwsNotAuthorized
errorCompanionDeleteView
post method will redirect to thePersonDetailView
for the relevant personExample code
The following code snippets may be useful as examples related to this task.
Checking if request
User
is one ofPerson
's organizers https://github.com/GeriLife/companionship-care/blob/d7cdcdc1a37e5bd08f9c7b6a26a8116b9571ce5e/project/people/templates/people/person_detail.html#L104Preventing a user from removing themself by checking equality (in our case, it should be
!=
) https://github.com/GeriLife/companionship-care/blob/d7cdcdc1a37e5bd08f9c7b6a26a8116b9571ce5e/project/people/templates/people/person_activity.html#L70Linking to a specific view, using the view
name
and optional arguments https://github.com/GeriLife/companionship-care/blob/d7cdcdc1a37e5bd08f9c7b6a26a8116b9571ce5e/project/people/templates/people/person_detail.html#L130-L132Ensuring only a
Person
's organizer can perform database operations related to that person https://github.com/GeriLife/companionship-care/blob/d7cdcdc1a37e5bd08f9c7b6a26a8116b9571ce5e/project/people/views.py#L130-L137Redirect to
Person
's detail view after removing the companion: https://github.com/GeriLife/companionship-care/blob/d7cdcdc1a37e5bd08f9c7b6a26a8116b9571ce5e/project/people/views.py#L154