-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
Move posts to polls #73
Conversation
->update(['polls.discussion_id' => $db->raw('first_posts.id')]); | ||
|
||
// Delete polls that don't have an associated post | ||
// TODO Is this a good idea? Not sure what situations can result in first_post_id being null but the discussion still existing with an associated first post. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The previous two updates should take care of
- existing first post relation through
first_post_id
- post with
number = 1
I'm very much not an SQL expert, and I have barely touched joins myself. I don't trust myself to merge this without a lot of testing done to avoid polls disappearing that shouldn't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From further testing, the second scenario (no first post relation but post with number ID 1) cannot be achieved simply by deleting the first post in the discussion. If there are other posts, they retain their numbering (i.e. post numbering starts at 2). Extensions such as fof/merge-discussions
and others renumber posts, in which case the poll would reappear (in v1).
I don't have a problem with keeping that scenario. Just providing some more info, since a poll is currently only shown for post number #1.
281f05a
to
3ec624b
Compare
…n fails within DB transaction
Adding/removing poll options still doesn't work, but that functionality is fixed in the follow-up PR #74
27e2daa
to
ed7ab24
Compare
🔴 THIS PR IS NOT BACKWARDS COMPATIBLE. DO NOT TEST IN PRODUCTION. 🔴
Fixes #67
Changes proposed in this pull request:
Intending on this to be released as
v2.0.0
so many API breaking changes & backwards compatibility removed alongside this. Those changes will be made after merging this.discussion_id
to the discussion'sfirst_post_id
or post withnumber = 1
(if first post is deleted, there can still be a first post where the poll is currently appearing)hasMany
for easier changes in future to allow for multiple posts/fof/polls/{id}
Reviewers should focus on:
Screenshot
Details
Confirmed
composer test
).