Skip to content

Commit

Permalink
feat: Version 0.13.6 (#168)
Browse files Browse the repository at this point in the history
* fix: add nullable (#163)

* feat: set null for searchitem (#166)

* fix: fallback to null for SearchItem

* style: formatting

* fix: only add column when it doesn't exist (#167)

* fix: only add column when it doesn't exist

* style: formatting

* fix: redirect after cms user save succes (#171)

* fix: autoload policies (#172)

* fix: autoload policies

* chore: remove autoloading policy from service provider

---------

Co-authored-by: M.A. Peene <maarten@notfound.nl>
  • Loading branch information
64knl and MAPCMC authored Dec 12, 2023
1 parent 6f2bb85 commit 91ea990
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
*/
public function up(): void
{
if (Schema::hasColumn('menu', 'created_at')) {
return;
}
Schema::table('menu', function (Blueprint $table) {
$table->timestamp('created_at')->nullable();
});
Expand Down
1 change: 1 addition & 0 deletions src/Http/Controllers/UserManagementController.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ public function update(FormDataRequest $request, CmsUser $user)
$response = new LayoutResponse();
if ($user->save()) {
$response->addAction(new Toast(__('siteboss::response.user.updated')));
$response->addAction(new Redirect('/app/users/'));
} else {
$response->addAction(new Toast(__('siteboss::response.user.error')));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace NotFound\Framework\Policies\Forms;
namespace NotFound\Framework\Models\Forms\Policies;

use NotFound\Framework\Models\CmsUser;
use NotFound\Framework\Models\Forms\Category;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace NotFound\Framework\Policies\Forms;
namespace NotFound\Framework\Models\Forms\Policies;

use NotFound\Framework\Models\CmsUser;
use NotFound\Framework\Models\Forms\Data;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace NotFound\Framework\Policies\Forms;
namespace NotFound\Framework\Models\Forms\Policies;

use NotFound\Framework\Models\CmsUser;
use NotFound\Framework\Models\Forms\Form;
Expand Down
12 changes: 0 additions & 12 deletions src/Providers/AuthServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,6 @@

class AuthServiceProvider extends ServiceProvider
{
/**
* The policy mappings for the application.
*
* @var array
*/
protected $policies = [
'NotFound\Framework\Models\Forms\Data' => 'NotFound\Framework\Policies\Forms\DataPolicy',
'NotFound\Framework\Models\Forms\Form' => 'NotFound\Framework\Policies\Forms\FormPolicy',
'NotFound\Framework\Models\Forms\Category' => 'NotFound\Framework\Policies\Forms\CategoryPolicy',
'NotFound\Framework\Models\Table' => 'NotFound\Framework\Policies\TablePolicy',
];

/**
* Register any authentication / authorization services.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Services/Editor/FieldsProperties.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ private function addLayoutFields(array $properties, LayoutForm &$form)
// $checkboxField->setValue(true);
// } else {
$checkboxField->setValue(false);
// }
// }
} else {
$checkboxField->setValue($value ?? false);
}
Expand Down
27 changes: 13 additions & 14 deletions src/Services/Indexer/SearchItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ final class SearchItem

private bool $inSitemap = true;

private ?DateTime $publicationDate;
private ?DateTime $publicationDate = null;

private ?DateTime $lastUpdated;
private ?DateTime $lastUpdated = null;

private int $priority = 1;

Expand Down Expand Up @@ -146,12 +146,7 @@ public function content(): ?string
*/
public function publicationDate(): ?string
{
$time = $this->publicationDate ?? $this->lastUpdated;
if ($time === null) {
return null;
}

return $time->format(DateTime::ATOM);
return $this->toDateString($this->publicationDate ?? $this->lastUpdated);
}

/**
Expand All @@ -162,12 +157,7 @@ public function publicationDate(): ?string
*/
public function lastUpdated(): ?string
{
$time = $this->lastUpdated ?? $this->publicationDate;
if ($time === null) {
return null;
}

return $time->format(DateTime::ATOM);
return $this->toDateString($this->lastUpdated ?? $this->publicationDate);
}

public function customValues(): ?array
Expand All @@ -189,4 +179,13 @@ public function sitemap(): bool
{
return $this->inSitemap;
}

private function toDateString(?DateTime $date): ?string
{
if ($date === null) {
return null;
}

return $date->format(DateTime::ATOM);
}
}

0 comments on commit 91ea990

Please sign in to comment.