Skip to content

Disable posts likes and edits for hidden posts without permission #2021

@rafalp

Description

@rafalp

It doesn't make sense to be able to like/unlike or edit hidden posts.

Permissions to check:

  • check_see_thread_post_permission
  • check_see_private_thread_post_permission

To fix, override get_thread_post method on a view accessing post:

class ThreadPostSomethingView: def get_thread_post( self, request: HttpRequest, thread: Thread, post_id: int ) -> Post: post = super().get_thread_post(request, thread, post_id) check_see_thread_post_permission( request.user_permissions, post.category, post.thread, post ) return post

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: backendThis issue involves Python, Django or dependency (eg. database)bug

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions