Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dont allow posts to deleted / removed communities. Fixes #1827 #1828

Merged
merged 6 commits into from
Oct 14, 2021

Conversation

dessalines
Copy link
Member

No description provided.

@Nutomic
Copy link
Member

Nutomic commented Oct 12, 2021

I think it is also possible to comment in deleted/removed posts. Could you add a check for that as well while you're at it? And for federation, you can do these same checks in CreateOrUpdatePost::verify() and CreateOrUpdateComment::verify().

@@ -56,6 +57,7 @@ impl PerformCrud for CreateComment {
let community_id = post.community_id;

check_community_ban(local_user_view.person.id, community_id, context.pool()).await?;
check_community_deleted_or_removed(community_id, context.pool()).await?;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment check is here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean that it also needs to check here if the post was deleted/removed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

K I added this, but I'm not exactly sure how to extract the post in the CreateOrUpdateComment::verify() function.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to call self.object.get_parents()

@dessalines dessalines force-pushed the dont_allow_posts_to_deleted_or_removed_communities branch from 4ae3c30 to ec9e359 Compare October 14, 2021 01:58
@@ -73,7 +73,7 @@ impl Note {
Ok(&self.id)
}

async fn get_parents(
pub async fn get_parents(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use pub(crate) please.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, my bad

@Nutomic Nutomic merged commit 2402515 into main Oct 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants