-
Notifications
You must be signed in to change notification settings - Fork 34
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
TAN-2224 Co-sponsors side effects #9016
Conversation
@kogre Re-creating the PR as the prev one got closed after I deleted the cosponsorship branch. There are still some relevant comment in there you might want to have a look at. To speed things up a bit main question is about the way the co-sposhorship ids diff is being handled and whether this can be done better. |
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.
Nice! Some small remarks, but nothing major.
You should also still update the ideas_spec acceptance tests. They should include the new cosponsors_ids in the params list for create and update, maybe also cover the case where we update the consponsors, as the controller plays an important role in that with those cosponsorship ids, so currently there's no coverage of the whole thing not breaking.
I think your solution for detecting the cosponsorships changes is sensible, and robust. The alternative would be to depend on ActiveModel::Dirty, which since Rails 7 also supports associations. When the original initiatives code was written, we weren't on Rails 7 yet, I believe. The advantage of that approach is that it's fully controlled in de side fx, instead of leaking into the controller. That being said, I think this is pretty simple and more robust, so I'm okay with it, don't think it's worth changing.
...eader/Components/NotificationMenu/components/InvitationToCosponsorIdeaNotification/index.tsx
Show resolved
Hide resolved
|
…nLabDotCo/citizenlab into TAN-2224/co-sponsors-side-effects
@kogre I've addressed your comments, thanks for reviewing! I still couldn't figure out how to fix the failing specs.. 🤔 |
@IvaKop The reason why the test fails is because the default state of the cosponsor_ids custom_field is set to
I'm not fully sure what the implcation of the |
@kogre I find this confusing because this is overridden and set to true when creating a proposal so I'm not sure how to solve it. Let's maybe take a look together. |
@IvaKop It's fixed, we had a factory in place to easily create a custom form with the default fields, so I was able to use that, in the end. |
Thanks @kogre! Clean solution in the end 👍 Really appreciate your help on this one 🙌 |
Changelog