Skip to content

Commit

Permalink
Fix translation link
Browse files Browse the repository at this point in the history
ENG-17101
  • Loading branch information
hadomskyi committed Aug 15, 2024
1 parent 7e3e6a0 commit 4983643
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 40 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
"cypress/e2e/jobs/verified/success-path-single.cy.js",
"cypress/e2e/jobs/instant/success-path-single.cy.js",
]
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Set the value
Expand Down
66 changes: 33 additions & 33 deletions e2e/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ composer-install:
composer require --ignore-platform-reqs "lilt/craft-lilt-plugin":"^999.9.9"

reset: cp composer-install
docker-compose exec -T app sh -c 'php craft db/restore happylager.sql'
docker-compose exec -T app sh -c 'php craft plugin/install craft-lilt-plugin'
docker compose exec -T app sh -c 'php craft db/restore happylager.sql'
docker compose exec -T app sh -c 'php craft plugin/install craft-lilt-plugin'


install: clone
Expand All @@ -28,23 +28,23 @@ install: clone
composer require craftcms/cms:3.7.68 -W

backup-db:
docker-compose exec -T app sh -c 'php craft db/backup'
docker compose exec -T app sh -c 'php craft db/backup'

refresh:
docker-compose exec -T app sh -c 'rm -rf /app/vendor/lilt/craft-lilt-plugin'
docker-compose exec -T app sh -c 'composer require --ignore-platform-reqs "lilt/craft-lilt-plugin":"^999.9.9"'
docker compose exec -T app sh -c 'rm -rf /app/vendor/lilt/craft-lilt-plugin'
docker compose exec -T app sh -c 'composer require --ignore-platform-reqs "lilt/craft-lilt-plugin":"^999.9.9"'

build:
docker build -f happy-lager-main/Dockerfile happy-lager-main -t happy-lager

down:
docker-compose down --remove-orphans -v
docker compose down --remove-orphans -v

mup: #migrate app up
docker-compose exec -T app sh -c 'php craft migrate/up'
docker compose exec -T app sh -c 'php craft migrate/up'

mdown: #migrate app down
docker-compose exec -T app sh -c 'php craft migrate/down'
docker compose exec -T app sh -c 'php craft migrate/down'

cp:
rm -rf happy-lager-main/plugin-src
Expand Down Expand Up @@ -84,32 +84,32 @@ wait-service:
@echo "Service is up and running or max retries reached!"

up: clone down composer-install
docker-compose up --build -d
docker-compose ps
docker-compose exec -T app sh -c 'chmod -R 777 /app'
docker-compose exec -T app sh -c 'chown -R www-data:www-data /app'
docker-compose exec -T mysql sh -c 'while ! mysqladmin ping -h"mysql" --silent; do sleep 1; done'
docker-compose exec -T app sh -c 'php craft setup/security-key'
docker-compose exec -T app sh -c 'echo DB_DRIVER=mysql >> .env'
docker-compose exec -T app sh -c 'echo DB_SERVER=mysql >> .env'
docker-compose exec -T app sh -c 'echo DB_DATABASE=${DB_DATABASE} >> .env'
docker-compose exec -T app sh -c 'echo DB_USER=craft-lilt >> .env'
docker-compose exec -T app sh -c 'echo DB_PASSWORD=craft-lilt >> .env'
docker-compose exec -T app sh -c 'echo DB_SCHEMA=public >> .env'
docker-compose exec -T app sh -c 'echo DB_TABLE_PREFIX= >> .env'
docker-compose exec -T app sh -c 'echo CRAFT_LILT_PLUGIN_QUEUE_DELAY_IN_SECONDS=1 >> .env'
docker-compose exec -T app sh -c 'echo CRAFT_LILT_PLUGIN_QUEUE_MANAGER_WAIT_TIME_IN_SECONDS=86400 >> .env'
docker-compose exec -T app sh -c 'php craft db/restore happylager.sql'
docker-compose exec -T app sh -c 'php craft plugin/install craft-lilt-plugin'
docker-compose exec -T app sh -c 'php craft plugin/install neo'
docker-compose exec -T app sh -c 'php craft plugin/install super-table'
docker-compose exec -T app sh -c 'php craft project-config/rebuild'
docker-compose exec -T app sh -c 'php craft up'
docker-compose exec -T app sh -c 'php craft migrate/up'
docker-compose exec -T app sh -c 'nohup ./queue_listen.sh > queue.log 2>&1 &'
docker-compose exec -T app sh -c 'cat .env'
docker compose up --build -d
docker compose ps
docker compose exec -T app sh -c 'chmod -R 777 /app'
docker compose exec -T app sh -c 'chown -R www-data:www-data /app'
docker compose exec -T mysql sh -c 'while ! mysqladmin ping -h"mysql" --silent; do sleep 1; done'
docker compose exec -T app sh -c 'php craft setup/security-key'
docker compose exec -T app sh -c 'echo DB_DRIVER=mysql >> .env'
docker compose exec -T app sh -c 'echo DB_SERVER=mysql >> .env'
docker compose exec -T app sh -c 'echo DB_DATABASE=${DB_DATABASE} >> .env'
docker compose exec -T app sh -c 'echo DB_USER=craft-lilt >> .env'
docker compose exec -T app sh -c 'echo DB_PASSWORD=craft-lilt >> .env'
docker compose exec -T app sh -c 'echo DB_SCHEMA=public >> .env'
docker compose exec -T app sh -c 'echo DB_TABLE_PREFIX= >> .env'
docker compose exec -T app sh -c 'echo CRAFT_LILT_PLUGIN_QUEUE_DELAY_IN_SECONDS=1 >> .env'
docker compose exec -T app sh -c 'echo CRAFT_LILT_PLUGIN_QUEUE_MANAGER_WAIT_TIME_IN_SECONDS=86400 >> .env'
docker compose exec -T app sh -c 'php craft db/restore happylager.sql'
docker compose exec -T app sh -c 'php craft plugin/install craft-lilt-plugin'
docker compose exec -T app sh -c 'php craft plugin/install neo'
docker compose exec -T app sh -c 'php craft plugin/install super-table'
docker compose exec -T app sh -c 'php craft project-config/rebuild'
docker compose exec -T app sh -c 'php craft up'
docker compose exec -T app sh -c 'php craft migrate/up'
docker compose exec -T app sh -c 'nohup ./queue_listen.sh > queue.log 2>&1 &'
docker compose exec -T app sh -c 'cat .env'
cli:
docker-compose exec app sh
docker compose exec app sh

test:
docker run -u root -t -v ${PWD}:/e2e -w /e2e --env CYPRESS_CACHE_FOLDER=${CYPRESS_CACHE_FOLDER} node:18.12.1 npm install
Expand Down
11 changes: 11 additions & 0 deletions src/elements/Translation.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use lilthq\craftliltplugin\elements\actions\JobEdit;
use lilthq\craftliltplugin\elements\db\TranslationQuery;
use lilthq\craftliltplugin\models\TranslationModelTrait;
use craft\elements\User;
use lilthq\craftliltplugin\records\TranslationNotificationsRecord;
use lilthq\craftliltplugin\records\TranslationRecord;

Expand Down Expand Up @@ -128,6 +129,16 @@ public function getIsReviewed(): bool
return $this->getIsPublished() || $this->status === TranslationRecord::STATUS_READY_TO_PUBLISH;
}

public function getUrl(): ?string
{
return $this->getCpEditUrl();
}

public function canView(User $user): bool
{
return true;
}

public function getStatusHtml(): string
{
$label = self::statuses()[$this->status]['label'] ?? self::statuses()[$this->status];
Expand Down
1 change: 1 addition & 0 deletions tests/_bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
define('TEST_SUPERTABLE_PLUGIN', false);
define('TEST_LINKIT_PLUGIN', false);
define('TEST_COLOUR_SWATCHES_PLUGIN', false);
define('PRIMARY_SITE_URL', 'test.craftcms.test:80');

$devMode = true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,11 +266,11 @@ private function getExpected(): array
'crumbs' => [
0 => [
'label' => 'Lilt Plugin',
'url' => 'http://$PRIMARY_SITE_URL/index.php?p=admin/admin/craft-lilt-plugin&site=default',
'url' => 'http://test.craftcms.test:80/index.php?p=admin/admin/craft-lilt-plugin&site=default',
],
1 => [
'label' => 'Jobs',
'url' => 'http://$PRIMARY_SITE_URL/index.php?p=admin/admin/craft-lilt-plugin/jobs&site=default',
'url' => 'http://test.craftcms.test:80/index.php?p=admin/admin/craft-lilt-plugin/jobs&site=default',
],
],
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,11 +331,11 @@ private function getExpected(Job $job): array
'crumbs' => [
0 => [
'label' => 'Lilt Plugin',
'url' => 'http://$PRIMARY_SITE_URL/index.php?p=admin/admin/craft-lilt-plugin&site=default',
'url' => 'http://test.craftcms.test:80/index.php?p=admin/admin/craft-lilt-plugin&site=default',
],
1 => [
'label' => 'Jobs',
'url' => 'http://$PRIMARY_SITE_URL/index.php?p=admin/admin/craft-lilt-plugin/jobs&site=default',
'url' => 'http://test.craftcms.test:80/index.php?p=admin/admin/craft-lilt-plugin/jobs&site=default',
],
],
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ private function getController(): GetTranslationReviewController
*/
public function testSuccess(IntegrationTester $I): void
{
$urlManager = Craft::$app->urlManager;
$urlManager->setHostInfo('https://test.craftcms.test:80');

$user = Craft::$app->getUsers()->getUserById(1);
$I->amLoggedInAs($user);

Expand Down Expand Up @@ -119,7 +122,7 @@ public function testSuccess(IntegrationTester $I): void

if (method_exists(Assert::class, 'assertMatchesRegularExpression')) {
Assert::assertMatchesRegularExpression(
"/^http:\/\/\\\$PRIMARY_SITE_URL\/index\.php\?p=blog\/first-entry-user-1&token=[0-9a-zA-Z\S]+$/",
"/^http:\/\/test\.craftcms\.test:80\/index\.php\?p=blog\/first-entry-user-1&token=[0-9a-zA-Z\S]+$/",
$actual['variables']['originalUrl']
);
Assert::assertMatchesRegularExpression(
Expand All @@ -128,7 +131,7 @@ public function testSuccess(IntegrationTester $I): void
);
} else {
Assert::assertRegExp(
"/^http:\/\/\\\$PRIMARY_SITE_URL\/index\.php\?p=blog\/first-entry-user-1&token=[0-9a-zA-Z\S]+$/",
"/^http:\/\/test\.craftcms\.test:80\/index\.php\?p=blog\/first-entry-user-1&token=[0-9a-zA-Z\S]+$/",
$actual['variables']['originalUrl']
);
Assert::assertRegExp(
Expand Down

0 comments on commit 4983643

Please sign in to comment.