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

[CIty OFN Voucher]Fix VINE settings page #13015

Closed
wants to merge 47 commits into from

Conversation

rioug
Copy link
Collaborator

@rioug rioug commented Dec 3, 2024

What? Why?

Split the description and link to VINE in two translatable string. Description is now hidden when an enterprise is connected to VINE.

What should we test?

  • Go to /admin/enterprises/NAME/edit#/connected_apps_panel for an enterprise not connected to VINE yet
  • Check the link to VINE is correct
  • Check the sentence "To enable VINE for your enterprise, enter your API key and secret." appears
  • Add your API key
  • Check the sentence "To enable VINE for your enterprise, enter your API key and secret." does not appear anymore

Release notes

Changelog Category (reviewers may add a label for the release notes):

  • User facing changes
  • API changes (V0, V1, DFC or Webhook)
  • Technical changes only
  • Feature toggled

The title of the pull request will be included in the release notes.

chahmedejaz and others added 29 commits December 3, 2024 15:44
- As per the new changes, unit_type change will create a new product rather than give errors.
- on bulk-update screen as well, two products can have same name with different unit_type
These were added a couple of years ago in openfoodfoundation#8763
But I guess we never noticed the names weren't getting anonymised.

The old 'name' field is still in the DB. It was kept for compatibility during migraiton but never cleaned up. I've added the tech debt task to the welcome new devs board now: openfoodfoundation#8835
I couldn't fix it easily. But I also think that the testing approach had
low value here.

It raised:

```
Failures:

  1) Map map can load does not show alert
     Failure/Error:
       assert_raises(Capybara::ModalNotFound) do
         accept_alert { visit '/map' }
       end

     Minitest::Assertion:
       Capybara::ModalNotFound expected but nothing was raised.

     [Screenshot Image]: /home/runner/work/openfoodnetwork/openfoodnetwork/tmp/capybara/screenshots/failures_r_spec_example_groups_map_map_can_load_does_not_show_alert_64.png

     # ./spec/system/consumer/map_spec.rb:11:in `block (3 levels) in <top (required)>'
     # ./spec/system/support/cuprite_setup.rb:39:in `block (2 levels) in <top (required)>'
     # ./spec/base_spec_helper.rb:153:in `block (3 levels) in <main>'
     # ./spec/base_spec_helper.rb:153:in `block (2 levels) in <main>'
```
This reverts commit 2eec3d6.

We started tracking 404 errors out of interest without an actual problem
to solve. Now we face rate-limiting in our Bugsnag account. And we
didn't use these 404 reports in the two years this code was active. We
don't even act on all 500 errors. So while our resources are so
constrained, let's keep our focus on the severe errors and user reports
and ignore the rest. 404 errors are mostly generated by vulnerability
scanners.
Needs human to review Bugsnag account.
mkllnk and others added 18 commits December 3, 2024 15:44
Bugsnag expects a string as value, not an ActiveRecord object. The
result was just "filtered" data, not showing any of the order's
attributes.

Since wanting to share the order data seems a common pattern, I added a
convenience method for it.
I still think that some of these objects won't be visible in Bugsnag but
I don't want to test any more on cases that were broken before and may
not be relevant now.
Somehow Bugsnag doesn't report in CI environment and I have no idea how
to circumvent that. And I don't want to spend more time on this.
It is used to validate a voucher using the given short code
It handles validating and creating vine voucher
It is used to redeem a voucher
And small refactor
It handles redeeming a voucher
'Spree::Payment#capture_and_complete!' will try to complete the order,
so we want to redeem any VINE voucher associated with the order first.
Move them under Vine module to keep the code nicely organised
- use IS DISTINCT FROM instead of two conditions
- added spec for scope
A Vine voucher is really a specific type of FlatRate voucher but because
a Vine voucher can be used by mutiple enterprise, it can be considered
different enough to warrant it's own class.
It still share a lot of the behaviour of a FlatRate voucher, so to avoid
duplication, all the shared functionality have been moved to a
Vouchers::FlatRatable concern.
Description is now hidden when the enterprise is connected to VINE
@rioug rioug force-pushed the 13006-fix-VINE-setting branch from 125cd0c to 404f9e8 Compare December 3, 2024 04:45
@rioug rioug closed this Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[City OFN Voucher] Change link + remove a sentence on settings page
7 participants