Skip to content

Commit

Permalink
Merge pull request #209 from os2display/release/2.0.6
Browse files Browse the repository at this point in the history
Release 2.0.6
  • Loading branch information
tuj authored Jun 28, 2024
2 parents 7ca858a + 27ac22d commit 2ab99ff
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 10 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/php_upgrade.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,12 @@ jobs:
MYSQL_PASSWORD: db
MYSQL_DATABASE: db_test
MYSQL_ROOT_PASSWORD: password
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
# https://mariadb.org/mariadb-server-docker-official-images-healthcheck-without-mysqladmin/
options: >-
--health-cmd="healthcheck.sh --connect --innodb_initialized"
--health-interval=5s
--health-timeout=2s
--health-retries=3
strategy:
fail-fast: false
matrix:
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,12 @@ jobs:
MYSQL_PASSWORD: db
MYSQL_DATABASE: db_test
MYSQL_ROOT_PASSWORD: password
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
# https://mariadb.org/mariadb-server-docker-official-images-healthcheck-without-mysqladmin/
options: >-
--health-cmd="healthcheck.sh --connect --innodb_initialized"
--health-interval=5s
--health-timeout=2s
--health-retries=3
strategy:
fail-fast: false
matrix:
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.

## [Unreleased]

## [2.0.6] - 2024-06-28

- [#208](https://github.com/os2display/display-api-service/pull/208)
- Removed feed items from Notified where image returns 403.
- Fixed phpunit github actions healthcheck for mariadb.
- [#207](https://github.com/os2display/display-api-service/pull/207)
- Fixed parameter not set error in (os2display) api container.

## [2.0.5] - 2024-05-21

- [#206](https://github.com/os2display/display-api-service/pull/206)
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
"vendor/bin/phpunit --stop-on-failure"
],
"test-setup": [
"bin/console cache:clear --env=test --no-debug",
"bin/console --env=test cache:clear --no-debug",
"bin/console --env=test doctrine:database:drop --if-exists --force --quiet",
"bin/console --env=test doctrine:database:create --no-interaction --if-not-exists --quiet",
"bin/console --env=test doctrine:migrations:migrate --no-interaction --quiet"
Expand Down
3 changes: 2 additions & 1 deletion infrastructure/os2display/display-api-service/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,5 @@ RUN chmod +x /usr/local/bin/docker-entrypoint.sh

WORKDIR ${APP_PATH}

CMD [ "docker-entrypoint.sh" ]
CMD ["php-fpm"]
ENTRYPOINT [ "docker-entrypoint.sh" ]
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ if [ "${1#-}" != "$1" ]; then
fi

## Start the PHP FPM process.
echo "Starting PHP 8.2 FPM"
echo "Starting PHP 8.3 FPM"

exec php-fpm "$@"
exec "$@"
22 changes: 18 additions & 4 deletions src/Feed/NotifiedFeedType.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,23 @@ public function getData(Feed $feed): array

$token = $secrets['token'];

$data = $this->getMentions($token, $pageSize, $configuration['feeds']);
$data = $this->getMentions($token, 1, $pageSize, $configuration['feeds']);

return array_map(fn (array $item) => $this->getFeedItemObject($item), $data);
$feedItems = array_map(fn (array $item) => $this->getFeedItemObject($item), $data);

$result = [];

// Check that image is accessible, otherwise leave out the feed element.
foreach ($feedItems as $feedItem) {
$response = $this->client->request(Request::METHOD_HEAD, $feedItem['mediaUrl']);
$statusCode = $response->getStatusCode();

if (200 == $statusCode) {
$result[] = $feedItem;
}
}

return $result;
} catch (\Throwable $throwable) {
$this->logger->error('{code}: {message}', [
'code' => $throwable->getCode(),
Expand Down Expand Up @@ -115,11 +129,11 @@ public function getConfigOptions(Request $request, FeedSource $feedSource, strin
return null;
}

public function getMentions(string $token, int $pageSize = 10, array $searchProfileIds = []): array
public function getMentions(string $token, int $page = 1, int $pageSize = 10, array $searchProfileIds = []): array
{
$body = [
'page' => $page,
'pageSize' => $pageSize,
'page' => 1,
'searchProfileIds' => $searchProfileIds,
];

Expand Down
1 change: 1 addition & 0 deletions tests/Feed/NotifiedFeedTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public function testGetFeed(): void
$response->method('toArray')->willReturn(
NotifiedFeedTypeData::getData()
);
$response->method('getStatusCode')->willReturn(200);

$httpClientMock->method('request')->willReturn($response);

Expand Down

0 comments on commit 2ab99ff

Please sign in to comment.