mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 06:21:27 +00:00
Update ComposeController, fix add to collection logic
This commit is contained in:
parent
abd52f4d3a
commit
9f8957b939
1 changed files with 13 additions and 1 deletions
|
@ -41,6 +41,7 @@ use App\Jobs\VideoPipeline\{
|
|||
VideoThumbnail
|
||||
};
|
||||
use App\Services\AccountService;
|
||||
use App\Services\CollectionService;
|
||||
use App\Services\NotificationService;
|
||||
use App\Services\MediaPathService;
|
||||
use App\Services\MediaBlocklistService;
|
||||
|
@ -585,13 +586,24 @@ class ComposeController extends Controller
|
|||
$collections = Collection::whereProfileId($profile->id)
|
||||
->find($request->input('collections'))
|
||||
->each(function($collection) use($status) {
|
||||
$count = $collection->items()->count();
|
||||
CollectionItem::firstOrCreate([
|
||||
'collection_id' => $collection->id,
|
||||
'object_type' => 'App\Status',
|
||||
'object_id' => $status->id
|
||||
], [
|
||||
'order' => $collection->items()->count()
|
||||
'order' => $count
|
||||
]);
|
||||
|
||||
CollectionService::addItem(
|
||||
$collection->id,
|
||||
$status->id,
|
||||
$count
|
||||
);
|
||||
|
||||
$collection->updated_at = now();
|
||||
$collection->save();
|
||||
CollectionService::setCollection($collection->id, $collection);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue