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

FIX: TL4 users can see their deleted posts #13364

Merged
merged 1 commit into from
Jun 21, 2021
Merged

FIX: TL4 users can see their deleted posts #13364

merged 1 commit into from
Jun 21, 2021

Conversation

nbianca
Copy link
Member

@nbianca nbianca commented Jun 11, 2021

They were able to delete their posts, but then could not recover them because they did not have the permissions to see them.

@@ -233,7 +233,7 @@ def can_see_post?(post)
return true if is_admin?
return false unless can_see_topic?(post.topic)
return false unless post.user == @user || Topic.visible_post_types(@user).include?(post.post_type)
return false if !(is_moderator? || is_category_group_moderator?(post.topic.category)) && post.deleted_at.present?
return false if !(is_moderator? || is_category_group_moderator?(post.topic.category)) && (post.deleted_at.present? && post.deleted_by != @user)
Copy link
Member

Choose a reason for hiding this comment

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

this logic is getting a bit too complicated ... instead maybe?

return true if is_moderator || is_category_group_moderator?(post.topic.category)
return true post.deleted_at.present? && post_deleted_by_id == @user&.id
false

@SamSaffron
Copy link
Member

Since this is specifically about TL4 for extra safety I would recommend checking for TL4

@nbianca nbianca merged commit e70e8d8 into master Jun 21, 2021
@nbianca nbianca deleted the fix_tl4_users branch June 21, 2021 16:10
@discoursebot
Copy link

This pull request has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/tl4-cant-undelete-their-own-posts/217913/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants