Remove code duplication in commands#11795
Conversation
c512e1b to
1678c1b
Compare
|
To be honest, I have lots of doubts with this PR. For one hand, this will allows us to prevent some of the typical bugs, like "X action isn't in the On another hand, even though there is lots of copy and paste with the current approach (and that for sure generated bugs these kind of bugs), what I like is that it's really easy to understand with one look what's happening there. I'm specially concerned about newcomers to the development and making the learning curve steeper. I think my main blocker are the changes in some of the Accountability commands. For instance, This is what it looks like until now: I just have to know how So, going back to Ok, now I need to know:
But wait, because if I want to understand Now I need to have in my (tiny) brain much more information. Just to understand the full picture of the attributes, in this particular case, I need to see it in three different parts of two files: Maybe in cases like this (where we're introducing two levels of inheritance) it makes more sense to have a bit of duplication and not inherit from In the other cases, when it's just simpler the starting point (like I have to admin that you had bad luck because these examples come first in the review (as they're from So, as a final summary: can you remove the inheritance in |
|
As we've talked yesterday, I still have doubts if the current approach is good for newcomers. To have a second opinion, I want to ask for @microstudi input in this PR. Can you give us a few thoughts about this? Do you think this would be easy to understand/extend/hack? I'm particularly worried about the |
|
Hi @andreslucena One think I would do, yes you read my mind... documentate! |
I have started some documentation in #11962, in order to have the page where i could document the current changes. |
…m/decidim into feature/user-call-standardization
andreslucena
left a comment
There was a problem hiding this comment.
A couple more comments that are wrong and I'll be happy, I promise 😅
decidim-accountability/app/commands/decidim/accountability/admin/create_imported_result.rb
Outdated
Show resolved
Hide resolved
Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com>
|
@alecslupu we have a failing spec related to #12157. Can you check it out 🙏🏽 ? |
…r-call-standardization
…m/decidim into feature/user-call-standardization
🎩 What? Why?
During Decidim Fest 2023 I was complaining that there is a lot of duplication on the commands that mostly do the same thing. This PR starts removing some of the duplication, and also features 3 different Commands: CreateResource, UpdateResource and DeleteResource, which aims to provide a consistent way of handling the form data.
While I opened this PR, i could see there are some commands that are quite complex, and during this refactor process, i took the decision of not handling those.
Also, this PR does not implement the consistent change for all the modules, as currently there are 30+ modified files, and i wish to have smaller PRs that are easily to review and digest.
Testing
Validate the pipeline is green
Check the actions that are those commands and see there is nothing wrong :D