-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release' into lagoon-waku
- Loading branch information
Showing
51 changed files
with
694 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
PUBLISHER_URL="https://${LAGOON_GIT_BRANCH}-${PROJECT_NAME}.build.amazeelabs.dev" | ||
NETLIFY_URL="https://${LAGOON_GIT_BRANCH}-${PROJECT_NAME}.amazeelabs.dev" | ||
PREVIEW_URL="https://${LAGOON_GIT_BRANCH}-${PROJECT_NAME}.preview.amazeelabs.dev" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
PROJECT_NAME=example | ||
PUBLISHER_URL="https://example.build.amazeelabs.dev" | ||
NETLIFY_URL="https://example.amazeelabs.dev" | ||
PREVIEW_URL="https://example.preview.amazeelabs.dev" | ||
|
||
# Used to set the original client secret. | ||
PUBLISHER_OAUTH2_CLIENT_SECRET=REPLACE_ME | ||
PUBLISHER_URL="https://${PROJECT_NAME}.build.amazeelabs.dev" | ||
NETLIFY_URL="https://${PROJECT_NAME}.amazeelabs.dev" | ||
PREVIEW_URL="https://${PROJECT_NAME}.preview.amazeelabs.dev" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
PROJECT_NAME=example | ||
PUBLISHER_URL="https://${LAGOON_GIT_BRANCH}-${PROJECT_NAME}.build.amazeelabs.dev" | ||
NETLIFY_URL="https://${LAGOON_GIT_BRANCH}-${PROJECT_NAME}.amazeelabs.dev" | ||
PREVIEW_URL="https://${LAGOON_GIT_BRANCH}-${PROJECT_NAME}.preview.amazeelabs.dev" | ||
|
||
# Used to set the original client secret. | ||
PUBLISHER_OAUTH2_CLIENT_SECRET=REPLACE_ME |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
diff --git a/css/claro.css b/css/claro.css | ||
index 720c3a8..9c5ad05 100644 | ||
--- a/css/claro.css | ||
+++ b/css/claro.css | ||
@@ -44,8 +44,8 @@ | ||
|
||
@media screen and (min-width: 85.375rem) { | ||
.interface-complementary-area.edit-post-sidebar { | ||
- width: 380px !important; | ||
+ width: 380px; | ||
} | ||
} | ||
|
||
-/*# sourceMappingURL=claro.css.map */ | ||
\ No newline at end of file | ||
+/*# sourceMappingURL=claro.css.map */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
PROJECT_NAME=example | ||
DRUPAL_URL="https://nginx.${LAGOON_ENVIRONMENT}.${LAGOON_PROJECT}.ch4.amazee.io" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"extends": ["//"], | ||
"pipeline": { | ||
"tasks": { | ||
"prep": { | ||
"dependsOn": ["prep:app", "prep:server"] | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// TODO: straight copy of the same file in the UI package | ||
import { Locale, useLocation } from '@custom/schema'; | ||
|
||
const locales = Object.values(Locale); | ||
export const defaultLocale: Locale = 'en'; | ||
|
||
export function isLocale(input: any): input is Locale { | ||
return locales.includes(input); | ||
} | ||
|
||
/** | ||
* Extract the current locale from the path prefix. | ||
*/ | ||
export function useLocale() { | ||
const [{ pathname }] = useLocation(); | ||
const prefix = pathname.split('/')[1]; | ||
return isLocale(prefix) ? prefix : defaultLocale; | ||
} | ||
|
||
type Localized = { locale: Locale }; | ||
|
||
/** | ||
* Select the most appropriate of localization from a list of options. | ||
*/ | ||
export function useLocalized<T extends Localized>( | ||
options?: Array<T | undefined>, | ||
): T | undefined { | ||
const locale = useLocale(); | ||
return ( | ||
options?.filter((option) => option?.locale === locale).pop() || | ||
options?.filter((option) => option?.locale === defaultLocale).pop() | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"extends": ["//"], | ||
"pipeline": { | ||
"tasks": { | ||
"dev": { | ||
"persistent": true, | ||
"dependsOn": ["prep", "^prep"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
"node": "^18.19.0", | ||
"pnpm": "8.6.12" | ||
}, | ||
"packageManager": "[email protected]", | ||
"scripts": { | ||
"postinstall": "husky install || true", | ||
"commit": "git-cz", | ||
|
@@ -16,11 +17,11 @@ | |
"test:format:root": "pnpm prettier --ignore-unknown '**/**'", | ||
"test:format:workspaces": "pnpm --workspace-concurrency=1 -r exec prettier --ignore-unknown '**/**'", | ||
"turbo:local": "if [ -z $CI ]; then echo $(date)$RANDOM > apps/cms/turbo-seed.txt; fi", | ||
"turbo:test": "pnpm turbo:local && pnpm tb test:unit --no-daemon --go-fallback --output-logs=new-only && pnpm tb test:integration --no-daemon --go-fallback --output-logs=new-only --concurrency=1", | ||
"turbo:test:force": "pnpm tb test:unit --no-daemon --go-fallback --output-logs=new-only --force && pnpm tb test:integration --no-daemon --go-fallback --output-logs=new-only --concurrency=1 --force", | ||
"turbo:test:quick": "pnpm turbo:local && pnpm tb test:unit --no-daemon --go-fallback --output-logs=new-only", | ||
"turbo:prep": "pnpm turbo:local && pnpm tb prep --no-daemon --go-fallback --output-logs=new-only", | ||
"turbo:prep:force": "rm -f apps/cms/web/sites/default/files/.sqlite && pnpm tb prep --no-daemon --go-fallback --force", | ||
"turbo:test": "pnpm turbo:local && pnpm turbo test:unit --output-logs=new-only && pnpm turbo test:integration --output-logs=new-only --concurrency=1", | ||
"turbo:test:force": "pnpm turbo test:unit --output-logs=new-only --force && pnpm turbo test:integration --output-logs=new-only --concurrency=1 --force", | ||
"turbo:test:quick": "pnpm turbo:local && pnpm turbo test:unit --output-logs=new-only", | ||
"turbo:prep": "pnpm turbo:local && pnpm turbo prep --output-logs=new-only", | ||
"turbo:prep:force": "rm -f apps/cms/web/sites/default/files/.sqlite && pnpm turbo prep --force", | ||
"gutenberg:generate": "pnpm run --filter \"@custom/gutenberg_blocks\" gutenberg:generate" | ||
}, | ||
"private": true, | ||
|
@@ -39,7 +40,7 @@ | |
"eslint-plugin-simple-import-sort": "^10.0.0", | ||
"husky": "^8.0.3", | ||
"prettier": "^3.2.5", | ||
"turbo": "^1.11.2", | ||
"turbo": "^2.0.6", | ||
"typescript": "^5.3.3", | ||
"vitest": "^1.1.1" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
packages/drupal/custom/src/EventSubscriber/EntityLanguageRedirectSubscriber.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?php | ||
|
||
namespace Drupal\custom\EventSubscriber; | ||
|
||
use Drupal\Core\Cache\CacheableMetadata; | ||
use Drupal\Core\Language\LanguageInterface; | ||
use Drupal\Core\Language\LanguageManagerInterface; | ||
use Drupal\Core\Routing\RouteMatchInterface; | ||
use Drupal\Core\Routing\TrustedRedirectResponse; | ||
use Drupal\Core\Url; | ||
use Symfony\Component\EventDispatcher\EventSubscriberInterface; | ||
use Symfony\Component\HttpKernel\Event\RequestEvent; | ||
use Symfony\Component\HttpKernel\KernelEvents; | ||
|
||
class EntityLanguageRedirectSubscriber implements EventSubscriberInterface { | ||
|
||
protected LanguageManagerInterface $languageManager; | ||
|
||
protected RouteMatchInterface $routeMatch; | ||
|
||
public function __construct(LanguageManagerInterface $language_manager, RouteMatchInterface $route_match) { | ||
$this->languageManager = $language_manager; | ||
$this->routeMatch = $route_match; | ||
} | ||
|
||
public static function getSubscribedEvents() { | ||
// We need this subscriber to run after the router_listener service (which | ||
// has priority 32) so that the parameters are set into the request, but | ||
// before the EntityCanonicalViewSubscriber one (with the priority 28). So, | ||
// we set the priority to 30. | ||
return [ | ||
KernelEvents::REQUEST => [ | ||
['onKernelRequest', 30], | ||
] | ||
]; | ||
} | ||
|
||
public function onKernelRequest(RequestEvent $event): void { | ||
// In case the user tries to access a node in a language entity is not | ||
// translated to, we redirect to the entity in the original language and | ||
// display a warning message. | ||
if ($this->routeMatch->getRouteName() === 'entity.node.canonical') { | ||
$entity = $this->routeMatch->getCurrentRouteMatch()->getParameter('node'); | ||
$requestedLanguageId = $this->languageManager->getCurrentLanguage(LanguageInterface::TYPE_CONTENT)->getId(); | ||
if ($entity->language()->getId() != $requestedLanguageId) { | ||
$routeOptions = [ | ||
'language' => $entity->language(), | ||
]; | ||
$routeParameters = [ | ||
'node' => $entity->id(), | ||
]; | ||
$url = Url::fromRoute('entity.node.canonical', $routeParameters, $routeOptions); | ||
// Make sure we keep any query strings. | ||
$queryString = (string) $event->getRequest()->getQueryString(); | ||
if ($queryString !== '') { | ||
$queryString .= '&'; | ||
} | ||
$urlString = $url->toString() . '?' . $queryString . 'content_language_not_available=true&requested_language=' . $requestedLanguageId; | ||
|
||
// Add the necessary cache contexts to the response, as redirect | ||
// responses are cached as well. | ||
$metadata = new CacheableMetadata(); | ||
$metadata->addCacheContexts(['languages:language_interface', 'url.query_args']); | ||
$response = new TrustedRedirectResponse($urlString); | ||
$response->addCacheableDependency($entity); | ||
$response->addCacheableDependency($metadata); | ||
|
||
$event->setResponse($response); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.