Version 5.1 - All the GraphQL #32

Closed
timw4mail wants to merge 1160 commits from develop into master
1 changed files with 12 additions and 2 deletions
Showing only changes of commit b2c86adcf5 - Show all commits

View File

@ -73,7 +73,11 @@ abstract class HistoryTransformer {
if ($kind === 'progressed' && ! empty($entry['attributes']['changedData']['progress']))
{
$output[] = $this->transformProgress($entry);
$transformed = $this->transformProgress($entry);
if ($transformed !== NULL)
{
$output[] = $transformed;
}
}
else if ($kind === 'updated')
{
@ -170,7 +174,7 @@ abstract class HistoryTransformer {
return $output;
}
protected function transformProgress (array $entry): HistoryItem
protected function transformProgress (array $entry): ?HistoryItem
{
$id = array_keys($entry['relationships'][$this->type])[0];
$data = $entry['relationships'][$this->type][$id]['attributes'];
@ -178,6 +182,12 @@ abstract class HistoryTransformer {
$imgUrl = "images/{$this->type}/{$id}.webp";
$item = end($entry['attributes']['changedData']['progress']);
// No showing episode 0 nonsense
if (((int)$item) === 0)
{
return NULL;
}
$action = ($this->isReconsuming($entry))
? "{$this->reconsumeAction} {$item}"
: "{$this->progressAction} {$item}";