Skip to content

Commit f66fb09

Browse files
committed
Merge branch 'main' into migrate-admin-parts-to-filament
# Conflicts: # composer.lock
2 parents 443852e + 036e16a commit f66fb09

34 files changed

+1457
-2149
lines changed

.github/workflows/tests.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: Tests
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
48

59
jobs:
610
tests:

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ We'd like to thank these **amazing companies** for sponsoring us. If you are int
2424
- [Envoyer](https://envoyer.io)
2525
- [Fathom](https://usefathom.com)
2626
- [Tinkerwell](https://tinkerwell.app)
27-
- [Skynet Technologies](https://www.skynettechnologies.com/hire-laravel-developer)
2827
- [BairesDev](https://www.bairesdev.com/sponsoring-open-source-projects/)
29-
- [Remotely Works](https://www.remotely.works/sponsoring-open-source-projects)
3028
- [Dotcom-monitor](https://www.dotcom-monitor.com/sponsoring-open-source-projects/)
3129
- [N-iX](https://www.n-ix.com/)
3230

@@ -95,9 +93,9 @@ New threads will be automatically added to the index and threads which get updat
9593
php artisan scout:flush App\\Models\\Thread
9694
```
9795

98-
### Twitter Sharing (optional)
96+
### X (Twitter) Sharing (optional)
9997

100-
To enable published articles to be automatically shared on Twitter, you'll need to [create a Twitter app](https://developer.twitter.com/apps/). Once the app has been created, update the below variables in your `.env` file. The consumer key and secret and access token and secret can be found in the `Keys and tokens` section of the Twitter developers UI.
98+
To enable published articles to be automatically shared on X, you'll need to [create an app](https://developer.x.com/apps/). Once the app has been created, update the below variables in your `.env` file. The consumer key and secret and access token and secret can be found in the `Keys and tokens` section of the X developers UI.
10199

102100
```
103101
TWITTER_CONSUMER_KEY=

app/Console/Commands/PostArticleToTwitter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ final class PostArticleToTwitter extends Command
1111
{
1212
protected $signature = 'lio:post-article-to-twitter';
1313

14-
protected $description = 'Posts the latest unshared article to Twitter';
14+
protected $description = 'Posts the latest unshared article to X';
1515

1616
public function handle(AnonymousNotifiable $notifiable): void
1717
{

app/Http/Controllers/Admin/UsersController.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use App\Http\Requests\BanRequest;
88
use App\Jobs\BanUser;
99
use App\Jobs\DeleteUser;
10+
use App\Jobs\DeleteUserThreads;
1011
use App\Jobs\UnbanUser;
1112
use App\Models\User;
1213
use App\Policies\UserPolicy;
@@ -39,6 +40,10 @@ public function ban(BanRequest $request, User $user): RedirectResponse
3940

4041
$this->dispatchSync(new BanUser($user, $request->get('reason')));
4142

43+
if ($request->willDeleteThreads()) {
44+
$this->dispatchSync(new DeleteUserThreads($user));
45+
}
46+
4247
$this->success($user->name().' was banned!');
4348

4449
return redirect()->route('profile', $user->username());
@@ -65,4 +70,15 @@ public function delete(User $user): RedirectResponse
6570

6671
return redirect()->route('admin.users');
6772
}
73+
74+
public function deleteThreads(User $user): RedirectResponse
75+
{
76+
$this->authorize(UserPolicy::DELETE, $user);
77+
78+
$this->dispatchSync(new DeleteUserThreads($user));
79+
80+
$this->success($user->name().' threads were deleted!');
81+
82+
return redirect()->route('admin.users');
83+
}
6884
}

app/Http/Requests/BanRequest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,17 @@ public function rules(): array
1515
{
1616
return [
1717
'reason' => 'required|string',
18+
'delete_threads' => 'boolean',
1819
];
1920
}
2021

2122
public function reason(): string
2223
{
2324
return $this->get('reason');
2425
}
26+
27+
public function willDeleteThreads(): bool
28+
{
29+
return $this->boolean('delete_threads');
30+
}
2531
}

app/Jobs/DeleteUserThreads.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
namespace App\Jobs;
4+
5+
use App\Models\User;
6+
7+
final class DeleteUserThreads
8+
{
9+
public function __construct(private User $user) {}
10+
11+
public function handle(): void
12+
{
13+
$this->user->deleteThreads();
14+
}
15+
}

app/Models/Article.php

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,6 @@ public function excerpt(int $limit = 100): string
101101
return Str::limit(strip_tags(md_to_html($this->body())), $limit);
102102
}
103103

104-
public function hasHeroImage(): bool
105-
{
106-
return $this->hero_image_url !== null;
107-
}
108-
109104
public function hasHeroImageAuthor(): bool
110105
{
111106
return $this->hero_image_author_name !== null &&
@@ -114,11 +109,7 @@ public function hasHeroImageAuthor(): bool
114109

115110
public function heroImage($width = 400, $height = 300): string
116111
{
117-
if ($this->hasHeroImage()) {
118-
return "{$this->hero_image_url}&fit=clip&w={$width}&h={$height}&utm_source=Laravel.io&utm_medium=referral";
119-
}
120-
121-
return asset('images/default-background.svg');
112+
return "{$this->hero_image_url}&fit=clip&w={$width}&h={$height}&utm_source=Laravel.io&utm_medium=referral";
122113
}
123114

124115
public function originalUrl(): ?string

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"algolia/scout-extended": "^3.1",
99
"blade-ui-kit/blade-heroicons": "^2.3",
1010
"blade-ui-kit/blade-icons": "^1.6",
11-
"blade-ui-kit/blade-ui-kit": "^0.6",
11+
"blade-ui-kit/blade-ui-kit": "^0.6.3",
1212
"blade-ui-kit/blade-zondicons": "^1.5",
1313
"codeat3/blade-simple-icons": "^5.0",
1414
"filament/filament": "^3.2",

0 commit comments

Comments
 (0)