mirror of
https://github.com/YunoHost-Apps/pixelfed_ynh.git
synced 2024-09-03 20:06:04 +02: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
|
VideoThumbnail
|
||||||
};
|
};
|
||||||
use App\Services\AccountService;
|
use App\Services\AccountService;
|
||||||
|
use App\Services\CollectionService;
|
||||||
use App\Services\NotificationService;
|
use App\Services\NotificationService;
|
||||||
use App\Services\MediaPathService;
|
use App\Services\MediaPathService;
|
||||||
use App\Services\MediaBlocklistService;
|
use App\Services\MediaBlocklistService;
|
||||||
|
@ -585,13 +586,24 @@ class ComposeController extends Controller
|
||||||
$collections = Collection::whereProfileId($profile->id)
|
$collections = Collection::whereProfileId($profile->id)
|
||||||
->find($request->input('collections'))
|
->find($request->input('collections'))
|
||||||
->each(function($collection) use($status) {
|
->each(function($collection) use($status) {
|
||||||
|
$count = $collection->items()->count();
|
||||||
CollectionItem::firstOrCreate([
|
CollectionItem::firstOrCreate([
|
||||||
'collection_id' => $collection->id,
|
'collection_id' => $collection->id,
|
||||||
'object_type' => 'App\Status',
|
'object_type' => 'App\Status',
|
||||||
'object_id' => $status->id
|
'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…
Add table
Reference in a new issue