diff --git a/CHANGELOG.md b/CHANGELOG.md index fcf331cef..0f175cce1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -74,6 +74,8 @@ - Update lexer/extractor to handle banned hashtags ([909a8a5a](https://github.com/pixelfed/pixelfed/commit/909a8a5a)) - Update FederationController, fix double lock bug ([9fcccca9](https://github.com/pixelfed/pixelfed/commit/9fcccca9)) - Update AdminInvite component, fix email regex ([2aea77d3](https://github.com/pixelfed/pixelfed/commit/2aea77d3)) +- Update database config, use single transaction and skip lock tables for mysql dump ([936f1e7a](https://github.com/pixelfed/pixelfed/commit/936f1e7a)) +- Update database config, add sticky flag https://laravel.com/docs/9.x/database#the-sticky-option ([10b65980](https://github.com/pixelfed/pixelfed/commit/10b65980)) - ([](https://github.com/pixelfed/pixelfed/commit/)) ## [v0.11.4 (2022-10-04)](https://github.com/pixelfed/pixelfed/compare/v0.11.3...v0.11.4) diff --git a/app/Http/Controllers/AdminController.php b/app/Http/Controllers/AdminController.php index 24faacf7e..32b27939d 100644 --- a/app/Http/Controllers/AdminController.php +++ b/app/Http/Controllers/AdminController.php @@ -264,6 +264,10 @@ class AdminController extends Controller ]); $changed = false; $changedFields = []; + $slug = str_slug($request->input('title')); + if(Newsroom::whereSlug($slug)->exists()) { + $slug = $slug . '-' . str_random(4); + } $news = Newsroom::findOrFail($id); $fields = [ 'title' => 'string', @@ -281,7 +285,7 @@ class AdminController extends Controller case 'string': if($request->{$field} != $news->{$field}) { if($field == 'title') { - $news->slug = str_slug($request->{$field}); + $news->slug = $slug; } $news->{$field} = $request->{$field}; $changed = true; @@ -327,6 +331,10 @@ class AdminController extends Controller ]); $changed = false; $changedFields = []; + $slug = str_slug($request->input('title')); + if(Newsroom::whereSlug($slug)->exists()) { + $slug = $slug . '-' . str_random(4); + } $news = new Newsroom(); $fields = [ 'title' => 'string', @@ -344,7 +352,7 @@ class AdminController extends Controller case 'string': if($request->{$field} != $news->{$field}) { if($field == 'title') { - $news->slug = str_slug($request->{$field}); + $news->slug = $slug; } $news->{$field} = $request->{$field}; $changed = true; diff --git a/config/database.php b/config/database.php index fddfc8dbb..38a197dac 100644 --- a/config/database.php +++ b/config/database.php @@ -48,6 +48,7 @@ return [ 'username' => env('DB_USERNAME', 'forge'), 'password' => env('DB_PASSWORD', ''), 'unix_socket' => env('DB_SOCKET', ''), + 'sticky' => true, 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci', 'prefix' => '', diff --git a/resources/views/admin/newsroom/edit.blade.php b/resources/views/admin/newsroom/edit.blade.php index c98a23378..3687a2a9c 100644 --- a/resources/views/admin/newsroom/edit.blade.php +++ b/resources/views/admin/newsroom/edit.blade.php @@ -1,114 +1,81 @@ @extends('admin.partial.template-full') @section('section') -
Newsroom - Edit
+Editing #{{$news->id}}
+Newsroom
-Edit Announcement
-- -
-- - -
- -