cyrillefr
404fcf1f72
Fix FixRailsWhereEquals
...
- fixes offenses caused by RuboCop::Cop::Rails::WhereEquals cop
2024-04-09 10:44:02 +02:00
Feruz Oripov
9d919938f3
Group Order && OrderCycle related services and specs
2024-03-16 19:07:08 +05:00
Gaetan Craig-Riou
48ba23af1c
Notify BugSnag when something unexpected happens
2024-02-28 15:16:09 +11:00
Gaetan Craig-Riou
e5cd8e5216
Log error when something goes wrong
...
Plus spec.
The old implementation would swallow the error, all we had was a flash
message feedback
2024-02-28 15:13:40 +11:00
Gaetan Craig-Riou
d5499245d0
Merge pull request #11698 from openfoodfoundation/dependabot/bundler/redis-5.0.8
...
chore(deps): bump redis from 4.8.1 to 5.0.8
2024-01-29 10:55:58 +11:00
David Cook
4634917597
Treat image integrity error as an input error
...
And thus give the user a useful message to try again.
Hmm, if this is a good idea, we should do it everywhere we upload an image. Can we build that in somehow, or at least make a shared helper that accepts a block and catches the error?
I replicated this in dev a couple of times, I think with a text file labelled as an image file. Unfortunately, I can no longer replicate in dev or with a spec.
2024-01-25 14:14:58 +11:00
Maikel Linke
687176cf49
Remove trouble-some hiredis
...
The hiredis client was praised as being faster parsing bulk responses
but it seems to have multiple issues now:
- The redis release 5.0 moved hiredis support to another gem.
- I tried the hiredis-client gem and it raised errors.
- There are claims of worse performance of hiredis [1].
- Maintenance responsiveness has been questioned [2].
Using the default redis driver seems to work fine though.
[1]: https://discuss.rubyonrails.org/t/hiredis-does-not-support-ssl-action-cable/75945
[2]: https://github.com/redis/hiredis/issues/655
2024-01-25 13:28:44 +11:00
Gaetan Craig-Riou
96a010033d
Fix admin view to use dfc_id
...
This was missed in a previous refactor
2024-01-22 10:12:39 +11:00
Gaetan Craig-Riou
652c7a563c
Add dfc_name field on Spree::Taxons
...
This will let us map OFN product taxons to DFC product types
2024-01-22 10:02:10 +11:00
David Cook
6479990f6d
Show image update form in modal
...
It submits to the existing controller. I wanted to submit it with StimulusReflex, but it [doesn't support file uploads](https://docs.stimulusreflex.com/guide/working-with-forms.html#a-note-about-file-uploads ). Perhaps we'll enhance this with javascript later.
2024-01-16 13:44:28 +11:00
David Cook
91abb856a6
DRY
...
Refactor to use the (previously unused) shared method.
2024-01-16 12:53:07 +11:00
Gaetan Craig-Riou
aaa8f3f572
Per review, move logic to display ToS banner to a helper
...
It easier to understand when we can see the logic to display the banner
in the view.
2023-12-22 13:20:14 +01:00
Gaetan Craig-Riou
d0ba881aa2
Move acepting of ToS change to a reflex
...
Spree::Admin::UserController is for super admin user only. Moving to a
reflex simplifies the code by getting rid of a new route and a new stimulus
controller
2023-12-22 13:20:14 +01:00
Gaetan Craig-Riou
8371eada23
Don't show the banner if enterprises are not required to accepte ToS
2023-12-22 13:20:14 +01:00
Gaetan Craig-Riou
5c9abfefee
Per review, remove useless code pass
...
It shouldn't be possible for the update to fail, as we are not sending
any parameter. Any other failure should be handled by rails already, ie
missing csrf token.
2023-12-22 13:20:14 +01:00
Gaetan Craig-Riou
8e31e35d5d
Add Tos banner on all admin pages
...
Plus spec, this is tested on the dashboard page.
The banner will show if the user accepted_at is before the tos file
updated at time.
2023-12-22 13:20:14 +01:00
Gaetan Craig-Riou
ee79fd88d2
Add /admin/users/:id/accept_terms_or_service end point
...
Plus specs
2023-12-22 13:20:14 +01:00
David Cook
0f3a952fd0
Add translation for product cloned message
...
A validation error shouldn't happen. If it does, it's an exception, not an error.
2023-12-06 15:13:20 +11:00
David Cook
32a4088386
Revert " #11067 , remove messages to match with old UI UX"
...
Now we support flash messages, we can show it!
This reverts commit d8904099dd .
2023-12-06 10:12:18 +11:00
Mohamed ABDELLANI
a13e087541
use render edit instead of redirect_to
...
with redirect_to, the validation errors will be lost at the rendering time.
2023-11-28 13:45:17 +01:00
Rachel Arnould
1088b6b6dd
Merge pull request #11785 from chahmedejaz/task/11067-admin_style_v3-product-clone
...
Implement product clone
2023-11-22 16:29:38 +01:00
Filipe
ebd1151054
Merge pull request #11730 from murjax/payment-save-flash-9048
...
Fix Stripe payment flash rendering issue
2023-11-17 11:51:42 +00:00
Ahmed Ejaz
29eadedc3a
Merge branch 'master' into task/11067-admin_style_v3-product-clone
2023-11-17 03:45:54 +05:00
Filipe
ed8fd41bec
Merge pull request #11290 from cyrillefr/Orders_in_confirmation_state_cannot_be_completed_by_hub_or_shop
...
Fix Orders in confirmation state cannot be completed by hub or shop
2023-11-16 19:50:14 +00:00
Ahmed Ejaz
0457755e27
Merge branch 'task/11067-admin_style_v3-product-clone' of https://github.com/chahmedejaz/openfoodnetwork into task/11067-admin_style_v3-product-clone
2023-11-11 15:54:58 +05:00
Ahmed Ejaz
d8904099dd
#11067 , remove messages to match with old UI UX
2023-11-11 15:47:59 +05:00
Ahmed Ejaz
2af678cb28
Merge branch 'master' into task/11067-admin_style_v3-product-clone
2023-11-08 18:41:31 +05:00
Ahmed Ejaz
851ce281ea
#11067 , implement product clone
2023-11-08 18:36:22 +05:00
Neal Chambers
0663f04535
Remove Simple References to Bogus Gateway
2023-11-07 11:19:26 +09:00
Ryan Murphy
7e5ad8c8a4
9048: Fix Stripe payment flash rendering issue
2023-11-01 07:33:06 -04:00
Maikel
6a236a8678
Revert "replace hiredis gem with hiredis-client"
2023-11-01 15:16:57 +11:00
cyrillefr
e1374d5837
Add Order completion after capturing event
...
- A new processing method
- Payment means that link to it
- Altering methods that handle next status choice
2023-10-29 21:58:03 +01:00
cyrillefr
cd6c3c45e6
Allow an order in confirmation state to transition to payment
2023-10-29 21:58:03 +01:00
Mohamed ABDELLANI
d6890e9828
check key class before call Rails.cache.delete
2023-10-26 10:27:00 +01:00
Mohamed ABDELLANI
f047deaf12
load the latest invoice when user tries to print an order
2023-10-08 21:47:17 +02:00
Mohamed ABDELLANI
3f4eab2a0a
update the invoice renderer to check if the feature is enable for individual user
2023-10-08 21:47:17 +02:00
Mohamed ABDELLANI
614c8a5060
update order mailer to check if invoices feature is enabled for the current user
2023-10-08 21:47:17 +02:00
Mohamed ABDELLANI
bd2a1b3e22
check if invoices feature is enabled for the current user before printing a single invoice
2023-10-08 21:47:17 +02:00
David Cook
e844d71abc
Redirect to edit path on success
...
Simply rendering the edit form on the posted path is problematic. For example if you refresh the path you get a 404.
But if there's errors, we want to render the form with unsaved values so you can see the errors and try again.
2023-09-28 09:41:44 +10:00
Neal Chambers
416d6e538a
Fix Style/HashSyntax
2023-09-09 09:00:38 +09:00
Pedro Carmona
51050036d4
Use instance default locale as the default locale for a new user
2023-09-05 01:00:35 +01:00
Pedro Carmona
c4830e3baa
Send localized email when creating users via admin interface
...
Based on the current user locale
2023-09-05 01:00:35 +01:00
Neal Chambers
06e217c527
Safely autocorrect Rails/WhereNot
...
Inspecting 1483 files
........................................................................................................................C..................................................................................................................C...........CC.C..........................................C......C..........C.........................C......................CC..........C........................................................................................................................C.......................................................................................................C........................................................C...........................................................................................................................................C......................................C.........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
Offenses:
app/controllers/spree/admin/products_controller.rb:183:11: C: [Corrected] Rails/WhereNot: Use where.not(spree_variants: { import_date: nil }) instead of manually constructing negated SQL in where.
where('spree_variants.import_date IS NOT NULL').
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/concerns/permalink_generator.rb:37:26: C: [Corrected] Rails/WhereNot: Use where.not(id: id) instead of manually constructing negated SQL in where.
scope_with_deleted.where('id != ?', id)
^^^^^^^^^^^^^^^^^^^^
app/models/concerns/permalink_generator.rb:37:40: C: [Corrected] Style/HashSyntax: Omit the hash value.
scope_with_deleted.where.not(id: id)
^^
app/models/enterprise.rb:152:7: C: [Corrected] Rails/WhereNot: Use where.not(enterprises: { id: ready_enterprises }) instead of manually constructing negated SQL in where.
where("enterprises.id NOT IN (?)", ready_enterprises)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/enterprise.rb:158:31: C: [Corrected] Rails/WhereNot: Use where.not(sells: 'none') instead of manually constructing negated SQL in where.
scope :is_distributor, -> { where('sells != ?', 'none') }
^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/enterprise.rb:479:17: C: [Corrected] Rails/WhereNot: Use where.not(id: id) instead of manually constructing negated SQL in where.
dups = dups.where('id != ?', id) unless new_record?
^^^^^^^^^^^^^^^^^^^^
app/models/enterprise.rb:534:43: C: [Corrected] Rails/WhereNot: Use where.not(enterprises: { id: self }) instead of manually constructing negated SQL in where.
enterprises = owner.owned_enterprises.where('enterprises.id != ?', self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/enterprise.rb:583:7: C: [Corrected] Rails/WhereNot: Use where.not(enterprises: { id: id }) instead of manually constructing negated SQL in where.
where('enterprises.id != ?', id).
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/enterprise_fee.rb:40:24: C: [Corrected] Rails/WhereNot: Use where.not(spree_calculators: { type: PER_ORDER_CALCULATORS }) instead of manually constructing negated SQL in where.
joins(:calculator).where('spree_calculators.type NOT IN (?)', PER_ORDER_CALCULATORS)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/enterprise_relationship.rb:78:19: C: [Corrected] Rails/WhereNot: Use where.not(name: perms) instead of manually constructing negated SQL in where.
permissions.where('name NOT IN (?)', perms).destroy_all
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/product_import/inventory_reset_strategy.rb:27:16: C: [Corrected] Rails/WhereNot: Use where.not(id: excluded_items_ids) instead of manually constructing negated SQL in where.
relation.where('id NOT IN (?)', excluded_items_ids)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/proxy_order.rb:19:25: C: [Corrected] Rails/WhereNot: Use where.not(proxy_orders: { canceled_at: nil }) instead of manually constructing negated SQL in where.
scope :canceled, -> { where('proxy_orders.canceled_at IS NOT NULL') }
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/spree/credit_card.rb:26:39: C: [Corrected] Rails/WhereNot: Use where.not(gateway_customer_profile_id: nil) instead of manually constructing negated SQL in where.
scope :with_payment_profile, -> { where('gateway_customer_profile_id IS NOT NULL') }
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/spree/product.rb:166:9: C: [Corrected] Rails/WhereNot: Use where.not(order_cycles: { id: nil }) instead of manually constructing negated SQL in where.
where('order_cycles.id IS NOT NULL')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/spree/variant.rb:94:30: C: [Corrected] Rails/WhereNot: Use where.not(deleted_at: nil) instead of manually constructing negated SQL in where.
scope :deleted, lambda { where('deleted_at IS NOT NULL') }
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/spree/variant.rb:165:43: C: [Corrected] Rails/WhereNot: Use where.not(spree_prices: { amount: nil }) instead of manually constructing negated SQL in where.
where('spree_prices.amount IS NOT NULL').
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/spree/zone.rb:141:19: C: [Corrected] Rails/WhereNot: Use where.not(id: id) instead of manually constructing negated SQL in where.
Spree::Zone.where('id != ?', id).update_all(default_tax: false) if default_tax
^^^^^^^^^^^^^^^^^^^^
app/models/spree/zone.rb:141:33: C: [Corrected] Style/HashSyntax: Omit the hash value.
Spree::Zone.where.not(id: id).update_all(default_tax: false) if default_tax
^^
app/models/variant_override.rb:32:7: C: [Corrected] Rails/WhereNot: Use where.not(variant_overrides: { import_date: nil }) instead of manually constructing negated SQL in where.
where('variant_overrides.import_date IS NOT NULL').
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/services/cap_quantity.rb:45:22: C: [Corrected] Rails/WhereNot: Use where.not(variant_id: available_variants_for.select(&:id)) instead of manually constructing negated SQL in where.
order.line_items.where('variant_id NOT IN (?)', available_variants_for.select(&:id))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
engines/catalog/app/services/catalog/product_import/products_reset_strategy.rb:32:18: C: [Corrected] Rails/WhereNot: Use where.not(spree_variants: { id: excluded_items_ids }) instead of manually constructing negated SQL in where.
relation.where('spree_variants.id NOT IN (?)', excluded_items_ids)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
engines/order_management/app/services/order_management/subscriptions/proxy_order_syncer.rb:78:18: C: [Corrected] Rails/WhereNot: Use where.not(order_cycle_id: order_cycle_ids) instead of manually constructing negated SQL in where.
orphaned.where('order_cycle_id NOT IN (?)', order_cycle_ids)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/reporting/reports/users_and_enterprises/base.rb:27:14: C: [Corrected] Rails/WhereNot: Use where.not(enterprises: { id: nil }) instead of manually constructing negated SQL in where.
.where("enterprises.id IS NOT NULL")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/reporting/reports/users_and_enterprises/base.rb:39:14: C: [Corrected] Rails/WhereNot: Use where.not(enterprise_id: nil) instead of manually constructing negated SQL in where.
.where("enterprise_id IS NOT NULL")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/reporting/reports/users_and_enterprises/base.rb:40:14: C: [Corrected] Rails/WhereNot: Use where.not(user_id: nil) instead of manually constructing negated SQL in where.
.where("user_id IS NOT NULL")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/tasks/data/anonymize_data.rake:50:16: C: [Corrected] Rails/WhereNot: Use where.not(user_id: nil) instead of manually constructing negated SQL in where.
Customer.where("user_id IS NOT NULL")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1483 files inspected, 26 offenses detected, 26 offenses corrected
2023-08-20 12:33:43 +09:00
Konrad
df7d42a420
Merge pull request #11352 from abdellani/remove-dead-code-bulk-invoice
...
Remove dead code related to bulk invoice printing
2023-08-18 18:14:01 +02:00
Neal Chambers
3c9afcf360
Fix Rails/CompactBlank
2023-08-17 16:43:13 +09:00
Matt-Yorkley
75f246109f
Fix assignment of default shipping category in variant new/edit pages
2023-08-14 21:02:48 +01:00
Matt-Yorkley
eefc356472
Update shipping_category usage in admin pages
2023-08-14 21:02:47 +01:00
Mohamed ABDELLANI
70b61eb481
remove bulk invoice service
2023-08-08 08:41:33 +01:00
Mohamed ABDELLANI
fc01ffc509
remove InvoicesController#create
2023-08-08 08:38:32 +01:00
Rachel Arnould
1b1279aa56
Merge pull request #11192 from abdellani/bulk-invoice-printing
...
fix Bulk invoice printing/sending
2023-08-04 12:02:43 +02:00