Update StoryFetch, fix mass assignment bug preventing proper model creation

pull/6144/head
Daniel Supernault 11 months ago
parent 89e34f8f44
commit 1e31470282
No known key found for this signature in database
GPG Key ID: 23740873EE6F76A1

@ -737,25 +737,23 @@ class StoryFetch implements ShouldQueue
$type = $payload['attachment']['type'] === 'Image' ? 'photo' : 'video'; $type = $payload['attachment']['type'] === 'Image' ? 'photo' : 'video';
$story = new Story([ $story = new Story;
'profile_id' => $profile->id, $story->profile_id = $profile->id;
'object_id' => $payload['id'], $story->object_id = $payload['id'];
'size' => $mediaResult['size'], $story->size = $mediaResult['size'];
'mime' => $payload['attachment']['mediaType'], $story->mime = data_get($payload, 'attachment.mediaType');
'duration' => $payload['duration'] ?? null, $story->duration = $payload['duration'] ?? null;
'media_url' => $payload['attachment']['url'], $story->media_url = data_get($payload, 'attachment.url');
'type' => $type, $story->type = $type;
'public' => false, $story->public = false;
'local' => false, $story->local = false;
'active' => true, $story->active = true;
'path' => $mediaResult['path'], $story->path = $mediaResult['path'];
'view_count' => 0, $story->view_count = 0;
'can_reply' => $payload['can_reply'] ?? true, $story->can_reply = $payload['can_reply'] ?? false;
'can_react' => $payload['can_react'] ?? true, $story->can_react = $payload['can_react'] ?? false;
'created_at' => now()->parse($payload['published']), $story->created_at = now()->parse($payload['published']);
'expires_at' => now()->parse($payload['expiresAt']), $story->expires_at = now()->parse($payload['expiresAt']);
]);
$story->save(); $story->save();
// Index the story // Index the story

Loading…
Cancel
Save