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

/posts/:id/events: list is_resolved correctly for appeals. #2927

Merged
merged 1 commit into from Mar 20, 2017

Conversation

evazion
Copy link
Member

@evazion evazion commented Mar 20, 2017

Fixes an issue reported in https://danbooru.donmai.us/forum_topics/13831 ("Why are appeals made on deleted posts automatically resolved?"):

/posts/:id/events incorrectly lists appeals as always being resolved. This is because events UNION together appeals and flags, which doesn't quite work because for appeals is_resolved is a method, not an
attribute. is_resolved was hardcoded to true so it'd work in the UNION.

This changes PostEvent to be a wrapper object around PostFlag / PostAppeal, instead of a UNION. PostEvent delegates everything to the inner flag/appeals object, so that is_resolved works correctly.

Also, this incidentally fixes a problem with /posts/:id/event.xml not serializing correctly (see https://danbooru.donmai.us/posts/2651416/events.xml).

/posts/:id/events incorrectly lists appeals as always being resolved.
This is because events UNION together appeals and flags, which doesn't
quite work because for appeals is_resolved is a method, not an
attribute. is_resolved was hardcoded to true so it'd work in the UNION.

This changes PostEvent to be a wrapper object around PostFlag /
PostAppeal, instead of a UNION. PostEvent delegates everything to the
inner flag/appeals object, so that is_resolved works correctly.

Also, this incidentally fixes a problem with /posts/:id/event.xml not
serializing correctly.
@r888888888 r888888888 merged commit fece0e3 into danbooru:master Mar 20, 2017
@evazion evazion deleted the fix-post-events-resolved branch March 21, 2017 05:22
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