Skip to content

Commit 503f156

Browse files
committed
Merge branch '5.x'
# Conflicts: # CHANGELOG.md # src/Entries/Entry.php
2 parents 5ca454c + bebbb83 commit 503f156

File tree

6 files changed

+44
-19
lines changed

6 files changed

+44
-19
lines changed

src/Entries/Entry.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -628,11 +628,19 @@ public function hasTime()
628628
return false;
629629
}
630630

631-
if ($this->blueprint()->field('date')->fieldtype()->timeEnabled()) {
632-
return true;
631+
$timeEnabled = (function () {
632+
if ($this->blueprint()->field('date')->fieldtype()->timeEnabled()) {
633+
return true;
634+
}
635+
636+
return $this->date && ! $this->date->isStartOfDay();
637+
})();
638+
639+
if ($this->origin && ! $this->origin()) {
640+
Blink::forget("entry-{$this->id()}-blueprint");
633641
}
634642

635-
return $this->date && ! $this->date->isStartOfDay();
643+
return $timeEnabled;
636644
}
637645

638646
public function hasSeconds()

src/Fields/Field.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ public function toGql(): array
442442
$type = ['type' => $type];
443443
}
444444

445-
if ($this->isRequired() && ! $this->hasSometimesRule()) {
445+
if ($this->isRequired() && ! $this->hasSometimesRule() && $this->config['type'] !== 'assets') {
446446
$type['type'] = GraphQL::nonNull($type['type']);
447447
}
448448

src/Http/Controllers/CP/Forms/FormSubmissionsController.php

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,17 @@ protected function indexQuery($form)
4848
$query = $form->querySubmissions();
4949

5050
if ($search = request('search')) {
51-
$query->where('date', 'like', '%'.$search.'%');
52-
53-
$form->blueprint()->fields()->all()
54-
->filter(function (Field $field): bool {
55-
return in_array($field->type(), ['text', 'textarea', 'integer']);
56-
})
57-
->each(function (Field $field) use ($query, $search): void {
58-
$query->orWhere($field->handle(), 'like', '%'.$search.'%');
59-
});
51+
$query->where(function ($query) use ($form, $search) {
52+
$query->where('date', 'like', '%'.$search.'%');
53+
54+
$form->blueprint()->fields()->all()
55+
->filter(function (Field $field): bool {
56+
return in_array($field->type(), ['text', 'textarea', 'integer']);
57+
})
58+
->each(function (Field $field) use ($query, $search): void {
59+
$query->orWhere($field->handle(), 'like', '%'.$search.'%');
60+
});
61+
});
6062
}
6163

6264
return $query;

src/Imaging/Attributes.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,19 @@ public function from(FilesystemAdapter $source, string $path)
4141

4242
private function imageAttributes(string $path)
4343
{
44-
[$width, $height] = getimagesize($this->prefixPath($path));
44+
$fullPath = $this->prefixPath($path);
45+
46+
if (! file_exists($fullPath)) {
47+
return ['width' => 0, 'height' => 0];
48+
}
49+
50+
$size = @getimagesize($fullPath);
51+
52+
if ($size === false) {
53+
return ['width' => 0, 'height' => 0];
54+
}
55+
56+
[$width, $height] = $size;
4557

4658
return compact('width', 'height');
4759
}

src/Structures/CollectionStructure.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,8 @@ public function validateTree(array $tree, string $locale): array
7272
throw new \Exception("Duplicate entry [{$entryId}] in [{$this->collection()->handle()}] collection's structure.");
7373
}
7474

75-
$thisCollectionsEntries = $this->collection()->queryEntries()
76-
->where('site', $locale)
77-
->pluck('id');
75+
$thisCollectionsEntries = Blink::once('collection-structure-tree-entries::'.$this->handle().'::'.$locale, fn () => $this->collection()->queryEntries())
76+
->where('site', $locale)->pluck('id');
7877

7978
$otherCollectionEntries = $entryIds->diff($thisCollectionsEntries);
8079

src/Tags/Cache.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Cache extends Tags implements CachesOutput
1414
public function index()
1515
{
1616
if (! $this->isEnabled()) {
17-
return [];
17+
return $this->parse([]);
1818
}
1919

2020
$store = LaraCache::store($this->params->get('store'));
@@ -64,7 +64,11 @@ private function isEnabled()
6464
return false;
6565
}
6666

67-
// Only GET requests. This disables the cache during live preview.
67+
if (request()->isLivePreview()) {
68+
return false;
69+
}
70+
71+
// Only GET requests.
6872
return request()->method() === 'GET';
6973
}
7074

0 commit comments

Comments
 (0)