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

[fix] $dataSets variable naming #617

Merged
merged 3 commits into from
Sep 9, 2024
Merged

Conversation

subiabre
Copy link
Member

@subiabre subiabre commented Sep 2, 2024

🎩 What? Why?

Template at Resources/templates/responsive/partials/components/data_sets.php was expecting to be injected a dataSets prop to walk via foreach. However in Resources/templates/responsive/channel/layout.php this template was being inserted with no dataSets prop, instead it was being inserted with a dataSetsSection prop, which caused the foreach loop to fail with an Invalid argument error.

Testing

This error was being triggered mainly at /channel/feminismos/social-account-telegram. Call to this address, check that the Invalid argument error appears in your logs, then call this address with the updated code and the error will not appear anymore.

♥️ Thank you!

@subiabre subiabre added the bug label Sep 2, 2024
@subiabre subiabre self-assigned this Sep 2, 2024
Copy link
Member

@davidbeig davidbeig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not the problem with that warning.

First, let's see how the uri is /channel/feminismos/social-account-telegram. The channel refers to the ChannelController, then feminismos is the id of one of the channels. So, what is social-account-telegram? That i don't know, but it falls inside the route for channel-list-projects and the listProjectsAction.

That action is the one responsible to show the different projects published inside a channel and filter them by type. The social-account-telegram should be a type of project, but it's not. The action should redirect to the base type, that it's available.

Still, that has nothing to do with the error, but it's something we could also fix now.

The variable that you are changing, the $dataSetsSection is used to know if this Channel has a NodeSection for Data Sets, that's why it comes from the $nodeSections variable.

Inside the channel/partials/data_sets we can see how it's used.

    $section = $this->dataSetsSection;
    if ($section):

And where is the $dataSets used? It's used in components/data_sets. The problem here, is that the listProjectAction does not give that variable to the view.

We should add it, as in the indexAction:

$dataSetsRepository = new DataSetRepository();
$dataSets = $dataSetsRepository->getListByChannel([$id]);

You can check then that it works fine with it.

Thank you for taking the time to look into this!

@subiabre
Copy link
Member Author

subiabre commented Sep 5, 2024

@davidbeig reverted my previous changes and applied fixes based on your feedback. I want to thank you for preventing me from polluting the code with an apparently working, but fundamentally flawed, bugfix.

Did not fix the redirection to the /available base type however, as it is out of the original scope of this fix (reduce error logs) and I'm unsure about whether we should redirect or show a not found message.

@davidbeig davidbeig self-requested a review September 6, 2024 14:53
Copy link
Member

@davidbeig davidbeig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @subiabre, it works great now :)

@subiabre subiabre merged commit 5cca4ce into live Sep 9, 2024
3 checks passed
@subiabre subiabre deleted the fix/channel-data-sets-section branch September 9, 2024 09:17
subiabre added a commit that referenced this pull request Oct 21, 2024
* Call to Exception from php global namespace (#601)

* Add role "helper" with access to users and accounts (#602)

* Allow accounts and users admin sub controller to be accessed via module perm

* Add helper role with admin-module-users and admin-module-account perms

* Fix/stripe refunds (#596)

* Update stripe gateway responses data

* Simplify stripe gateway sub request

* Fix setting invest payment

* Codefixes on stripe webhook controller

* Cancel invest by transaction ref instead of payment ref

* Fix participate invests from subscriptions (#595)

* Generic logic to list and tell subscription payment methods

* Change invest text on participate based on payment method subscription

* Add translations

* Add isSubscription method to payment method interface

* Use invest method isSubscription in participate view

* Fix typo

* Avoid db call with shallow invest object on return array

* Allow to filter backer invests by subscription based payment methods (#594)

* Allow to filter backer invests by subscription based payment methods

* Remove 'subscription_methods' filter

* [feat] Antispam forms (#609)

* Add FormHoneypot DB model

* Add form honeypot in templates

* Check for form honeypots in contact controller

* Add timestamp to honeypot catches

* Add datetime in model

* [FEAT] Add project numeric ids to invests paid via Paypal (#608)

* Project-based transaction ids in PayPal (#604)

* Add transactionId same as CECA to PayPal

* Call to Exception from php global namespace (#601)

* Add role "helper" with access to users and accounts (#602)

* Allow accounts and users admin sub controller to be accessed via module perm

* Add helper role with admin-module-users and admin-module-account perms

* Fix/stripe refunds (#596)

* Update stripe gateway responses data

* Simplify stripe gateway sub request

* Fix setting invest payment

* Codefixes on stripe webhook controller

* Cancel invest by transaction ref instead of payment ref

* Fix participate invests from subscriptions (#595)

* Generic logic to list and tell subscription payment methods

* Change invest text on participate based on payment method subscription

* Add translations

* Add isSubscription method to payment method interface

* Use invest method isSubscription in participate view

* Fix typo

* Avoid db call with shallow invest object on return array

* Allow to filter backer invests by subscription based payment methods (#594)

* Allow to filter backer invests by subscription based payment methods

* Remove 'subscription_methods' filter

* Specify currency for PayPal in purchase step

* Specify currency to purchase array data

* Store generated transaction id with  project num id + invest id in invest preapproval

* Fix transactions id in payments to pool (#613)

* fix use of project variable in Paypal payment method

* WIP: refactor use of project in stripe metadata

* change product description in stripe payment when there's no project

* Left pad transaction ids with 0

---------

Co-authored-by: Daniel Subiabre <daniel.subiabre@platoniq.net>

* [FIX] Product references on Stripe for wallet payments (#614)

* fix use of project variable in Paypal payment method

* WIP: refactor use of project in stripe metadata

* change product description in stripe payment when there's no project

* Left pad transaction ids with 0

* Fix references to project

* Fix rediretions

---------

Co-authored-by: David Igón <davidbenabarre@platoniq.net>

* Fix style of honeypot input field to be of size true 0 (#611)

* Fix node project get list return type (#615)

* make nodeproject get list return not only arrays

* change php doc definition of getList function

* Move ajax loader to expected route (#618)

* [fix] $dataSets variable naming (#617)

* Fix $dataSets variable naming

* Revert "Fix $dataSets variable naming"

This reverts commit a06b2f0.

* Add data sets to channel list projects route

* add entries in robots.txt for new bots (#619)

* [feature] project report updates (#621)

* Fix code formatting

* Add incomes table to project report

* Add relevant associated ids to project report

* Rename project num id to tracking number

* [fix] report table raw invests (#622)

* Pass raw invests data to report

* Show full invests calcs on project report table

---------

Co-authored-by: David <david@goteo.org>
Co-authored-by: David Igón <davidbenabarre@platoniq.net>
davidbeig added a commit that referenced this pull request Nov 18, 2024
* Call to Exception from php global namespace (#601)

* Add role "helper" with access to users and accounts (#602)

* Allow accounts and users admin sub controller to be accessed via module perm

* Add helper role with admin-module-users and admin-module-account perms

* Fix/stripe refunds (#596)

* Update stripe gateway responses data

* Simplify stripe gateway sub request

* Fix setting invest payment

* Codefixes on stripe webhook controller

* Cancel invest by transaction ref instead of payment ref

* Fix participate invests from subscriptions (#595)

* Generic logic to list and tell subscription payment methods

* Change invest text on participate based on payment method subscription

* Add translations

* Add isSubscription method to payment method interface

* Use invest method isSubscription in participate view

* Fix typo

* Avoid db call with shallow invest object on return array

* Allow to filter backer invests by subscription based payment methods (#594)

* Allow to filter backer invests by subscription based payment methods

* Remove 'subscription_methods' filter

* [feat] Antispam forms (#609)

* Add FormHoneypot DB model

* Add form honeypot in templates

* Check for form honeypots in contact controller

* Add timestamp to honeypot catches

* Add datetime in model

* [FEAT] Add project numeric ids to invests paid via Paypal (#608)

* Project-based transaction ids in PayPal (#604)

* Add transactionId same as CECA to PayPal

* Call to Exception from php global namespace (#601)

* Add role "helper" with access to users and accounts (#602)

* Allow accounts and users admin sub controller to be accessed via module perm

* Add helper role with admin-module-users and admin-module-account perms

* Fix/stripe refunds (#596)

* Update stripe gateway responses data

* Simplify stripe gateway sub request

* Fix setting invest payment

* Codefixes on stripe webhook controller

* Cancel invest by transaction ref instead of payment ref

* Fix participate invests from subscriptions (#595)

* Generic logic to list and tell subscription payment methods

* Change invest text on participate based on payment method subscription

* Add translations

* Add isSubscription method to payment method interface

* Use invest method isSubscription in participate view

* Fix typo

* Avoid db call with shallow invest object on return array

* Allow to filter backer invests by subscription based payment methods (#594)

* Allow to filter backer invests by subscription based payment methods

* Remove 'subscription_methods' filter

* Specify currency for PayPal in purchase step

* Specify currency to purchase array data

* Store generated transaction id with  project num id + invest id in invest preapproval

* Fix transactions id in payments to pool (#613)

* fix use of project variable in Paypal payment method

* WIP: refactor use of project in stripe metadata

* change product description in stripe payment when there's no project

* Left pad transaction ids with 0

---------

Co-authored-by: Daniel Subiabre <daniel.subiabre@platoniq.net>

* [FIX] Product references on Stripe for wallet payments (#614)

* fix use of project variable in Paypal payment method

* WIP: refactor use of project in stripe metadata

* change product description in stripe payment when there's no project

* Left pad transaction ids with 0

* Fix references to project

* Fix rediretions

---------

Co-authored-by: David Igón <davidbenabarre@platoniq.net>

* Fix style of honeypot input field to be of size true 0 (#611)

* Fix node project get list return type (#615)

* make nodeproject get list return not only arrays

* change php doc definition of getList function

* Move ajax loader to expected route (#618)

* [fix] $dataSets variable naming (#617)

* Fix $dataSets variable naming

* Revert "Fix $dataSets variable naming"

This reverts commit a06b2f0.

* Add data sets to channel list projects route

* add entries in robots.txt for new bots (#619)

* [feature] project report updates (#621)

* Fix code formatting

* Add incomes table to project report

* Add relevant associated ids to project report

* Rename project num id to tracking number

* [fix] report table raw invests (#622)

* Pass raw invests data to report

* Show full invests calcs on project report table

* add migration and models to faq sections and subsections from feature/new-faq

* fix faq test

* create new admin modules for new faq models

* change type of subsections and sections ids

* make improvements based on review

* refactor faqsection getfaqs function

* create new admin modules for new faq models

(cherry picked from commit 2caa326)

* add missing copies

* fixes on faq admin controller

* remove unnecessary template

* fix bug on faqsection admin controller

* use of new methods from models and fixes

* files from #400 related to the views of the new faqs

* fix integration

* add missing copies

* refactor in partials of faq header and classes

* change accordion to details tag

* fix pagination in faq admin controller

* add faq search action and views

* not show faq subsections if empty

* fixes in faq search

* fixes on faq individuals styles and home colors

* change date of new faqs migration

* fixes on title in individual faq

* fixes in styles for faqs

* rename faq migration

* update migration date

* add drag and drop to faq forms

* update migration date

---------

Co-authored-by: Daniel Subiabre García <subiabrewd@gmail.com>
Co-authored-by: Daniel Subiabre <daniel.subiabre@platoniq.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants