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

Deleting a post doesn't clear parent's "parent" status #3419

Closed
RaisingK opened this issue Dec 5, 2017 · 2 comments
Closed

Deleting a post doesn't clear parent's "parent" status #3419

RaisingK opened this issue Dec 5, 2017 · 2 comments
Labels

Comments

@RaisingK
Copy link
Collaborator

RaisingK commented Dec 5, 2017

If I delete an only child post, its parent keeps its "parent" border until I remove/readd the parent/child link.

@RaisingK RaisingK added the Bug label Dec 5, 2017
@evazion
Copy link
Member

evazion commented Dec 5, 2017

https://github.com/r888888888/danbooru/blob/feb3ec07500586e0e9d3dc5594414f3b59766349/app/models/post.rb#L1369-L1388

This happens when the Move favorites to parent? option is used.

The cause is that give_favorites_to_parent also moves the votes, and moving the votes has the side effect of reloading the post (to get the new score). But reloading the post wipes out the is_deleted_changed? flag, which is used by update_parent_on_save.

@evazion evazion closed this as completed in acd49be Dec 6, 2017
@evazion
Copy link
Member

evazion commented Dec 6, 2017

Fixed in acd49be. A better fix would be to not call reload inside Post#vote! / Post#unvote!, but that's difficult to avoid without duplicating code.

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

No branches or pull requests

2 participants