Refactor boilerplate examples for deduplication

Updated boilerplate examples for ActivityPub Delivery, Username validation, and Notification services to replace repeated code snippets with concise method calls.
pull/6910/head
Shlee 4 weeks ago committed by GitHub
parent 4982839c5a
commit 6cce210321
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -2,6 +2,7 @@
- `ActivityPubDeliveryService::pool($profile, $audience, $activity);`
replaces
```
$payload = json_encode($activity);
@ -44,7 +45,9 @@ replaces
# Username validation boilerplate
- `new ValidUsername,`
replaces
```
function ($attribute, $value, $fail) {
$dash = substr_count($value, '-');
@ -82,7 +85,9 @@ replaces
# Notification boilerplate
- `NotificationService::createNotification($recipient->id, $profile->id, 'dm', $dm->id, DirectMessage::class);`
- `NotificationService::firstOrCreateNotification($parent->profile_id, $actor->id, 'share', $parent->id, Status::class);`
replaces repeated
replaces
```
$notification = new Notification;
$notification->profile_id = $recipient->id;
@ -98,6 +103,7 @@ replaces repeated
- `return FractalService::collection($media, new MediaTransformer);`
replaces
```
$fractal = new Fractal\Manager;
$fractal->setSerializer(new ArraySerializer);

Loading…
Cancel
Save