Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept HowToSteps in recipe instructions #1165

Merged
merged 3 commits into from
Aug 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if [ `whoami` = root ]; then
echo "Quick mode activated. No permission update is carried out"
else
echo "Changing ownership of files to runner"
chown -R runner: /nextcloud
chown -R runner: /var/www/html
fi

if [ -n "$DEBUG_MODE" ]; then
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
[#1162](https://github.com/nextcloud/cookbook/pull/1162) @christianlupus
- Make the API return correct nutrition information objects for recipes
[#1163](https://github.com/nextcloud/cookbook/pull/1163) @christianlupus
- Allow HowToSteps in recipe instructions during importing
[#1165](https://github.com/nextcloud/cookbook/pull/1165) @christianlupus

### Maintenance
- Add composer.json to version control to have unique installed dependency versions
Expand All @@ -45,6 +47,8 @@
[#1142](https://github.com/nextcloud/cookbook/pull/1142) @christianlupus
- Remove dependency @nextcloud/auth from explicit dependencies
[#1149](https://github.com/nextcloud/cookbook/pull/1149) @christianlupus
- Fix bug in automated test programs
[#1165](https://github.com/nextcloud/cookbook/pull/1165) @christianlupus


## 0.9.13 - 2022-07-02
Expand Down
5 changes: 5 additions & 0 deletions lib/Helper/Filter/JSON/FixInstructionsFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ public function apply(array &$json): bool {
continue;
}

if ($this->jsonService->isSchemaObject($value, 'HowToStep', false)) {
$instructions[$key] = [$value['text']];
continue;
}

throw new InvalidRecipeException($this->l->t('Cannot parse recipe: Unknown object found during flattening of instructions.'));
}

Expand Down
17 changes: 17 additions & 0 deletions tests/Unit/Helper/Filter/JSON/FixInstructionsFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,23 @@ public function dpParseInstructions() {
["a\nb\nc"],
["a\nb\nc"], false
];

yield 'Array of HoToSteps' => [
[
[
'@type' => 'HowToStep',
'text' => 'a',
],
[
'@type' => 'HowToStep',
'text' => 'b',
],
[
'@type' => 'HowToStep',
'text' => 'c',
],
], ['a', 'b', 'c'], true
];
}

/** @dataProvider dpParseInstructions */
Expand Down