Skip to content

Commit

Permalink
refactor(PostDisapproveView): création du BlockedPost dans post()
Browse files Browse the repository at this point in the history
  • Loading branch information
calummackervoy committed Jun 7, 2024
1 parent c4e3dfd commit 434373c
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions lacommunaute/forum_moderation/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,8 @@ def post(self, request, *args, **kwargs):
self.request,
"l'adresse email de l'utilisateur est déjà dans la liste des emails bloqués.",
)
return self.disapprove(request, *args, **kwargs)

def disapprove(self, request, *args, **kwargs):
"""
Extends Machina's post disapproval behaviour to save the rejected post before deleting
"""
self.object = self.get_object()
self.object.update_reason = BlockedPostReason.MODERATOR_DISAPPROVAL.value
BlockedPost.create_from_post(self.object)
return super().disapprove(request, *args, **kwargs)
post.update_reason = BlockedPostReason.MODERATOR_DISAPPROVAL.value
BlockedPost.create_from_post(post)

return self.disapprove(request, *args, **kwargs)

0 comments on commit 434373c

Please sign in to comment.