mirror of
https://github.com/flarum/framework.git
synced 2024-12-01 05:53:45 +08:00
chore: merge conflicts
This commit is contained in:
parent
78ed7d5782
commit
6f942addb0
|
@ -108,7 +108,7 @@
|
|||
"php": "^8.1",
|
||||
"ext-json": "*",
|
||||
"components/font-awesome": "^5.15.0",
|
||||
"composer/composer": "^2.0",
|
||||
"composer/composer": "^2.7",
|
||||
"dflydev/fig-cookies": "^3.0",
|
||||
"doctrine/dbal": "^3.6.2",
|
||||
"dragonmantank/cron-expression": "^3.3",
|
||||
|
|
|
@ -93,7 +93,7 @@ class TagResource extends AbstractDatabaseResource
|
|||
Schema\Str::make('color')
|
||||
->writable()
|
||||
->nullable()
|
||||
->regex('/^#([a-f0-9]{6}|[a-f0-9]{3})$/i'),
|
||||
->rule('hex_color'),
|
||||
Schema\Str::make('icon')
|
||||
->writable()
|
||||
->nullable(),
|
||||
|
|
|
@ -18,6 +18,7 @@ use Flarum\User\Event\Saving;
|
|||
use Flarum\User\Exception\NotAuthenticatedException;
|
||||
use Flarum\User\RegistrationToken;
|
||||
use Flarum\User\User;
|
||||
use GuzzleHttp\Client;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Str;
|
||||
|
@ -393,9 +394,30 @@ class UserResource extends AbstractDatabaseResource
|
|||
]);
|
||||
}
|
||||
|
||||
$image = $this->imageManager->make($url);
|
||||
$urlContents = $this->retrieveAvatarFromUrl($url);
|
||||
|
||||
$this->avatarUploader->upload($user, $image);
|
||||
if ($urlContents !== null) {
|
||||
$image = $this->imageManager->read($urlContents);
|
||||
|
||||
$this->avatarUploader->upload($user, $image);
|
||||
}
|
||||
}
|
||||
|
||||
private function retrieveAvatarFromUrl(string $url): ?string
|
||||
{
|
||||
$client = new Client();
|
||||
|
||||
try {
|
||||
$response = $client->get($url);
|
||||
} catch (\Exception $e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($response->getStatusCode() !== 200) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $response->getBody()->getContents();
|
||||
}
|
||||
|
||||
private function fulfillToken(User $user, RegistrationToken $token): void
|
||||
|
|
|
@ -306,11 +306,13 @@ class ModelTest extends TestCase
|
|||
|
||||
$this->app();
|
||||
|
||||
$group1 = new Group;
|
||||
$group2 = new Group;
|
||||
Group::boot();
|
||||
|
||||
$this->assertEquals(1, $group1->counter);
|
||||
$this->assertEquals(2, $group2->counter);
|
||||
$group1 = new Group();
|
||||
$group2 = new Group();
|
||||
|
||||
$this->assertEquals(3, $group1->counter);
|
||||
$this->assertEquals(4, $group2->counter);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue
Block a user