django-comments-xtd
django-comments-xtd copied to clipboard
Ability to delete own comment
Creating a separate ticket as discussed in https://github.com/danirus/django-comments-xtd/issues/162.
Users should be able to delete their own comments.
Any workaround till then?
Thanks @sabyasachi.
An initial description of the user story could be:
- Enable comment deletion by setting
COMMENTS_XTD_ALLOW_COMMENT_DELETION = True
. - Add a "Delete" link in the footer of the comment.
- Create a
remove.html
andremoved.html
templates. They will be used when not using the JavaScript plugin. - The comment object will not be remove from the DB, as that would break the comment tree, but rather marked as
removed
by setting theis_removed
attribute of the comment toTrue
. - It should be possible to connect to a new signal
comment_removal_received
to allow other apps do something additional when the a user sends a comment removal: maybe deleting the content of thecomment
attribute, or whatnot. So that signal must be sent within the user-request-comment-removal controller. - If the user is authenticated, and the
comment.user
matches the authenticated user, theremove.html
template will display a confirmation button to remove the comment. Once the user clicks the button, theremoved.html
template will confirm the user that comment has been removed. - If the user is not authenticated the
remove.html
template should request the user to provide the email used to post the comment. In the controller, if the email provided doesn't match the comment'suser_email
attribute, it should simply ignore the request, but will inform the user that a confirmation email has been sent. The confirmation email shall be requested only when the email address provided by the user matches the comment'suser_email
. - Add the required routes to the
urlpatterns
. - There should be an implementation of this logic in the JavaScript plugin.
Let me know if I missed anything important. We could go further in detail. That's just a bullet point description of what shall be done. If anyone feels like working on it, please, feel free to ask. Otherwise I will do it sometime in the future.
@danirus Is this issue still open ? if yes, I can definitely work on this.
Sounds good @callmeUmer. I assign it to you. Feel free to reach out here or by email (it is in my commits).