kirby icon indicating copy to clipboard operation
kirby copied to clipboard

Add language specific UUID URLs

Open bastianallgeier opened this issue 5 months ago • 5 comments

This PR …

This is an attempt to finally get parts of the multi-language UUID issues solved. (https://github.com/getkirby/kirby/issues/5551)

This adds a new route for language-specific UUID urls:

Examples:

/en/@/page/1234
/en/@/file/1234

Docs

Ready?

  • [ ] In-code documentation (wherever needed)
  • [ ] Unit tests for fixed bug/feature
  • [ ] Tests and checks all pass

For review team

  • [ ] Add lab and/or sandbox examples (wherever helpful)
  • [ ] Add changes & docs to release notes draft in Notion

bastianallgeier avatar Feb 29 '24 14:02 bastianallgeier

Either we should add unit tests or we should be more explicit what we want to ignore for coverage.

distantnative avatar Feb 29 '24 19:02 distantnative

@distantnative I'm trying to create tests for the UUID route but I fail to setup a test environment with working UUIDs. Could you maybe have a look at the test? Why can the model not be found like that?

bastianallgeier avatar Mar 01 '24 11:03 bastianallgeier

Had you tried manually adding a uuid in the app setup ['content' => ['uuid' => 'my-uuid']]? That's how many of the other tests do it.

distantnative avatar Mar 01 '24 12:03 distantnative

Yep, I tried that too but also without luck.

bastianallgeier avatar Mar 01 '24 14:03 bastianallgeier

@bastianallgeier Ok I finally understood where it fails:

  • The uuid route looks up the model lazily, so only from cache. Since the cache is not populated, it fails
  • When I was trying to manually set a UUID, I did it with content. But we are in multilang territory, so we have to set the translations array instead

Alternatively, solving https://github.com/getkirby/kirby/issues/5181 too.

distantnative avatar Mar 16 '24 12:03 distantnative