Commit Graph

12866 Commits

Author SHA1 Message Date
Rachel Arnould
27be0f6fd1 Merge pull request #13912 from dacook/sourced-variant1-13887
Create linked variants
2026-03-20 10:59:46 +01:00
Maikel
1207bb5f8f Merge pull request #14023 from mkllnk/api-v0-redirect
Remove compatibility redirect for APIv0
2026-03-20 12:21:26 +11:00
Maikel Linke
66d6627c89 Spec recently changed code path 2026-03-20 11:51:50 +11:00
Maikel Linke
c5d38d684b Remove repeated navigation to speed up spec 2026-03-20 11:51:50 +11:00
Maikel Linke
c2907b839a Remove ineffective sorting spec
The spec was not really testing the order of users appearing on the
page. It's also a UX detail only visible to super admins which is not
important to test. So I'm not investing time to fix it.
2026-03-20 11:51:50 +11:00
Maikel Linke
ee653bb825 Remove redundant spec description
Admin users are the only one who can manage users.
2026-03-20 11:51:50 +11:00
Maikel
c5aaecf76a Merge pull request #13961 from mkllnk/taler-checkout-stock-error
Taler checkout stock error
2026-03-20 11:29:58 +11:00
Maikel Linke
8f0d4d23a7 Restore Stripe spec stubs as todo list 2026-03-18 14:54:44 +11:00
Maikel Linke
d56b4b4109 Make locale spec more accurate 2026-03-18 14:49:35 +11:00
Maikel Linke
7a01409f5c Save time by avoiding page visit 2026-03-18 14:49:34 +11:00
Maikel Linke
5c634c269b Remove unused helpers from spec 2026-03-18 14:49:34 +11:00
Maikel Linke
63988fff4f Configure test locales like other envs
The locale config is set in application.rb from environment variables
already. We don't need to repeat that logic in test.rb. And because it
was outdated, the language switcher was actually broken in the test
environment. We did have an English selector for the fallback `en` even
though we were already displaying English as en_TST. And after
switchting to Spanish, we could switch back because en_TST was not in
the available locales.

I now fixed the test with the right assumption and the config to solve
the problem.
2026-03-18 14:49:15 +11:00
David Cook
827ba1990d Ensure changes are tracked on newly added variant
I considered a few ways to do this. Cloned products are done with MutationObserver but it doesn't quite sit right with me. A dedicated controller for newly added rows would provide a good general solution. But do we want yet another controller? I'm not sure. This works and is pretty simple (although it requires a quick loop over _every_ form element.. let's see if we can avoid that.)
2026-03-18 14:03:11 +11:00
Maikel Linke
d56790b71e Remove unneeded context blocks
Best viewed ignoring whitespace.
2026-03-18 13:23:54 +11:00
Maikel Linke
c2f725b20c Remove redundant language setup
We tested earlier already that we have the needed languages available.
2026-03-18 13:21:27 +11:00
Maikel Linke
b939d41bf5 Remove useless negative spec
Any change in markup would invalidate the test.

It is unlikely to ever fail and then it would not be a big problem.
2026-03-18 13:18:15 +11:00
Maikel Linke
91c4ba03cd Remove more expensive specs 2026-03-18 13:15:35 +11:00
Maikel Linke
3f29cdab3c Combine specs and add detail 2026-03-18 13:14:57 +11:00
Maikel Linke
60a4d36408 Remove expensive without really new coverage 2026-03-18 13:08:24 +11:00
Maikel Linke
9513c07c2f Remove ineffective test
It would pass even if locales were broken.
2026-03-18 13:05:23 +11:00
Maikel Linke
4b5fd2495f Restore multilingual spec 2026-03-18 13:03:48 +11:00
David Cook
93c9181c3f Merge pull request #14021 from mkllnk/money
Remove dead code from Spree::Money
2026-03-18 10:50:54 +11:00
David Cook
7473a2f0bd Merge pull request #14020 from mkllnk/flaky-invite-spec
Expect UI change before emails
2026-03-18 10:49:03 +11:00
Maikel Linke
0629153362 Complete code coverage on Taler error handling 2026-03-11 16:05:54 +11:00
Gaetan Craig-Riou
4946ffc329 Add specs for CustomerAccountTransaction ability 2026-03-11 15:45:33 +11:00
Gaetan Craig-Riou
c134bbf49b Add missing ability for credit customer
Fix the specs to use a non super admin user, so it should catch missing
ability in the future.
2026-03-11 15:34:27 +11:00
Maikel Linke
5e871fc71e Expect UI change before emails
Fixing a flaky spec.
2026-03-11 15:30:39 +11:00
Maikel Linke
35e03ea3c7 Check stock before completing order after Taler payment 2026-03-11 15:12:21 +11:00
Maikel Linke
4140209820 Remove unused delegator to Money#cents 2026-03-11 14:56:28 +11:00
Maikel Linke
1bb4fdf294 Remove compatibility redirect for APIv0 2026-03-11 14:52:11 +11:00
Maikel Linke
9ca1a9e33f Allow orders to be paid before checkout
Taler puts the payment completion into the hands of the user. So we
can't strictly finalise the payment and order together.

And in the bigger picture, it should be okay if a payment goes through
but we have to abort checkout due to stock issues. Then we want to be
able to check out again, using the existing complete payment. Any
refunds can be handled later by the shop owner.
2026-03-11 14:46:06 +11:00
Maikel Linke
62af416696 Avoid useless page visit causing spec flakiness 2026-03-11 14:41:40 +11:00
Maikel Linke
bcf39acebc Remove confusing if-branch in shared examples 2026-03-11 14:41:40 +11:00
Maikel Linke
82186118a7 Remove long inactive specs
Several years ago, some checkout features got rewritten and some specs
became invalid. They had been set to pending to keep the option of
rewriting them one day. Some were re-written. But I'm deleting the
remainder.

If we haven't "needed" these specs for several years then I question
their use. System specs are expensive and should only cover the most
common scenarios or the ones we know could go wrong (after a bug
report). We can always write new specs if needed. Otherwise they are
just adding to maintenance cost.
2026-03-11 14:41:40 +11:00
David Cook
18fb1cfa74 Rename variant 'owner' to 'hub'
As discussed by team, and using same nomenclature as VariantOverride.
2026-03-11 11:09:13 +11:00
David Cook
e9ce2df5a9 Rename 'source variant' to linked variant (in most places)
There are two types of linked variant associations: source and target, so we need to keep the name there.
But when cloning a variant and retaining a link as source,  we will prefer the general term 'linked variant'. Hopefully this name works well.
2026-03-11 11:09:13 +11:00
David Cook
c165ade4ba Avoid unnecessary save
Actually, the variant factory is still adding an extra save. We should refactor Variant to avoid that.. but the afternoon slump has got me.
2026-03-11 11:09:12 +11:00
David Cook
6ee715419a ORder by ID to ensure deterministic results 2026-03-11 11:09:12 +11:00
David Cook
299ada1220 Refactor: move variant duplication to model
I tried to avoid it but rubocop made me move it. I think maybe it will need to go into a concern or service class later, but hopefully it's ok here for now.
2026-03-11 11:09:12 +11:00
David Cook
5757f086ec Set owner enterprise when creating source variant 2026-03-11 11:09:12 +11:00
David Cook
8955ffe126 AddOwnerToSpreeVariants [migration]
Should existing variants be migrated to have an owner (copied from supplier)? No, because you can change supplier. This concept needs work.
2026-03-11 11:09:09 +11:00
David Cook
b26152cf0e Only show option when you have permission
Preload the allow list once in the controller. This controller was initially set up to avoid instance variables, and pass variables explicitly to the template. That's a good principle, but in practice we have a growing list of variables passed down the chain to multiple partials which is getting cumbersome. I think instance variables have their place after all.
2026-03-11 11:08:50 +11:00
David Cook
5fc6d25a69 Display presence of variant link in UI
It's quite ugly. But we will be iterating on this later.
2026-03-11 11:08:50 +11:00
David Cook
b877540f5f Create sourced variant link on clone 2026-03-11 11:08:50 +11:00
copilot-swe-agent[bot]
04c0adf960 Fix source_variants and target_variants associations in Variant model
Co-authored-by: dacook <4188088+dacook@users.noreply.github.com>

Thanks co-pilot for sending me in the right direction.
Would this be neater as a has_and_belongs_to_many? Maybe but I will try to keep moving.
2026-03-11 11:08:50 +11:00
David Cook
eba2fbcc30 Create source variants 2026-03-11 11:07:08 +11:00
David Cook
940aa57daf Set up permissions for creating source variants 2026-03-11 11:07:08 +11:00
David Cook
766bedb773 Label this feature as 'beta'
The permission is effectively the feature toggle. Users can choose to use it, but shouldn't expect it all to work perfectly yet.
When it's considered full featured, we just need to update the translation. Hm... I hope that's not too painful.🤞
2026-03-11 11:07:08 +11:00
David Cook
6fe2357ca0 Add enterprise permission create_sourced_variants 2026-03-11 11:07:08 +11:00
David Cook
bd01b5f113 Add 'create sourced variant' option in variant actions menu
For now, we will only be able to create sourced variant from variants that are visible to us (variants that we manage)

    In a later commit I will hide the option if you can't use it
2026-03-11 11:07:08 +11:00