-
-
Notifications
You must be signed in to change notification settings - Fork 157
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
[Rails] Don't pass orphaned Stories (e.g. no Places or Speakers) to React #956
Comments
I can take this one! |
Question on this one, assuming for @rudokemper, I'll be filtering out the orphaned stories from dashboard/stories_controller, but should do the same to api/stories_controller? I'm less familiar with what the api module is used for |
Great question. That is actually used by a new Terrastories React view at https://github.com/terrastories/explore-terrastories, which we still need to document properly. I think it'd be good to filter it out from there as well. |
Thanks for the follow up! A related note, here is a potential way to avoid orphaned parents in this situation. Our use case would be slightly more complex since there are two children to check in the parent, but could still work. |
Thank you! I don't believe we have any tests for the pages or controllers. That would be a welcome addition, but I'm also happy to test your work locally for this. If I'm understanding that article correctly, the suggestion would be to delete any parent if there are no more children left, right? That would not be desirable in our use case; a user might be drafting content and we want to be very intentional about giving them complete control over their actions. Some of our users are not very technical and a piece of content disappearing on them (because it was deleted due to orphanage) could be confusing. |
I'm new to rails but not to unit testing, so I'll see if I can put together a couple tests around these. What you mentioned makes sense in terms of not wanting content to disappear because it's deleted, however wouldn't that pretty much be the case with acceptance 1? If they delete the last speaker or place attached to a story, then that story no longer shows up in the list of stories that can be edited right? So they won't be able to add a speaker/place back? Or did I misinterpret this one? |
Acceptance criteria #1 means that the story should continue to exist in the db and is accessible for editing or viewing in Rails, but it should no longer show in the |
Got it! I'll update my work; it might be that both acc 1 and 2 are complete by the work for 2. |
This one is ready for review @rudokemper! #971 |
Currently, it's not possible to create a Story without selecting at least one Place and at least one Speaker.
However, it is possible to delete Places and Speakers, which if done can leave a Story "orphaned" (e.g. it exists but has no Places, or Speakers, or both).
It's fine to keep it this way on the Rails side for now -- we need to think about our data structures more -- but we should handle this on the React side.
What is happening now is that the stories will still show up in StoryList. Only, if there are no Speakers, nothing will show at the top, and (worse) if there are no Places, clicking on the card does nothing.
Let's filter out any stories that have 0 Places or 0 Speakers on the React front end. This also means we should filter out any markers on the map that ONLY have stories that have been filtered out.
Acceptance criteria:
The text was updated successfully, but these errors were encountered: