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

-
- -
-
-
-
-
-
- @csrf -
- - -

We recommend titles shorter than 80 characters.

-
-
- - -
-
- - -

Click here to enable the rich text editor.

-
-
- - -
-
- -
-
- -
-
-
- {{$news->title}} - -
-

- {{$news->summary}} -

-

- Read more - - - - - - - - - - - -

-
-
-
-

- -

-
-
- published_at ? 'checked="checked"' : ''}}> - -
-
-
-
- show_timeline ? 'checked="checked"' : ''}}> - -
-
-
-
- auth_only ? 'checked="checked"' : ''}}> - -
-
-
-
- show_link ? 'checked="checked"' : ''}}> - -
-
- {{--
-
- force_modal ? 'checked="checked"' : ''}}> - -
-
--}} -
- -

- - -

- -
+
+
+ + @if($news->published_at) + View + @endif + +
+
+
+
+
+
+
+
+
+
+
+ @csrf +
+ + +

We recommend titles shorter than 80 characters.

+
+
+ + +
+
+ + +
+
+ + +
+ +
+
+ published_at ? 'checked="checked"' : ''}}> + +
+
+
+
+ show_timeline ? 'checked="checked"' : ''}}> + +
+
+
+
+ auth_only ? 'checked="checked"' : ''}}> + +
+
+
+
+ show_link ? 'checked="checked"' : ''}}> + +
+
+
+
+
+
@method('delete') @@ -118,6 +85,12 @@ @push('scripts') -@endpush \ No newline at end of file +@endpush diff --git a/resources/views/admin/newsroom/home.blade.php b/resources/views/admin/newsroom/home.blade.php index 78976bd71..ce557a9be 100644 --- a/resources/views/admin/newsroom/home.blade.php +++ b/resources/views/admin/newsroom/home.blade.php @@ -1,62 +1,89 @@ @extends('admin.partial.template-full') @section('section') -
- -
-

Newsroom

-

Manage News and Platform Tips

-
+
+
+
+
+
+
+

Newsroom

+

Manage News and Platform Tips

+
- + +
+
+
-
-
-
-
- Announcements -
- @if($newsroom->count() > 0) -
    - @foreach($newsroom as $news) -
  • -
    -

    {{str_limit($news->title,30)}}

    -

    {{str_limit($news->summary, 40)}}

    -
    -
    - @if($news->published_at != null) - PUBLISHED - @else - DRAFT - @endif - - - - @if($news->published_at) - - - - @endif -
    -
  • - @endforeach -
- @else -
-

No Announcements Found!

-
- @endif -
-
- {!!$newsroom->links()!!} -
-
+
+
+
+ @if($newsroom->count() > 0) +
+ + + + + + + + + + + + @foreach($newsroom as $news) + + + + + + + + @endforeach + +
IDTitleSlugStatusUpdated
+ + {{ $news->id }} + + +
+

{{str_limit($news->title, 50)}}

+ {{--

{{str_limit($news->summary, 80)}}

--}} +
+
+ @if($news->published_at) + {{$news->slug}} + @else + {{ $news->slug }} + @endif + + @if($news->published_at != null) + PUBLISHED + @else + DRAFT + @endif + + {{ $news->updated_at->diffForHumans() }} +
+
+
+ {!!$newsroom->links()!!} +
+ @else +
+

No Announcements Found!

+
+ @endif +
+
@endsection