Merge pull request #3551 from pixelfed/staging

Staging
This commit is contained in:
daniel 2022-06-20 21:59:20 -06:00 committed by GitHub
commit 76dbddfae9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 61 additions and 10 deletions

View file

@ -1,7 +1,6 @@
root = true
[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8

View file

@ -35,6 +35,11 @@
- Update follower counts on follow_request approval ([e97900a0](https://github.com/pixelfed/pixelfed/commit/e97900a0))
- Update ApiV1Controller, improve local/remote logic in public timeline endpoint ([4ff179ad](https://github.com/pixelfed/pixelfed/commit/4ff179ad))
- Update ApiV1Controller, fix network timeline ([11e99d78](https://github.com/pixelfed/pixelfed/commit/11e99d78))
- Update ApiV1Controller, fix public timeline min/max id pagination ([a7613bae](https://github.com/pixelfed/pixelfed/commit/a7613bae))
- Improve CollectionService cache invalidation, fixes [#3548](https://github.com/pixelfed/pixelfed/issues/3548) ([44f4a9ed](https://github.com/pixelfed/pixelfed/commit/44f4a9ed))
- Improve inbox status deletion cache invalidation ([1eba7f81](https://github.com/pixelfed/pixelfed/commit/1eba7f81))
- Update MediaDeletePipeline, fix async media deletion ([bb1cccbe](https://github.com/pixelfed/pixelfed/commit/bb1cccbe))
- Fix timeline infinite scroll ([03a85460](https://github.com/pixelfed/pixelfed/commit/03a85460))
- ([](https://github.com/pixelfed/pixelfed/commit/))
## [v0.11.3 (2022-05-09)](https://github.com/pixelfed/pixelfed/compare/v0.11.2...v0.11.3)

View file

@ -51,10 +51,10 @@ class MediaGarbageCollector extends Command
$bar = $this->output->createProgressBar($gc->count());
$bar->start();
foreach($gc as $media) {
MediaStorageService::delete($media);
$media->forceDelete();
MediaStorageService::delete($media, true);
$bar->advance();
}
$bar->finish();
$this->line('');
}
}

View file

@ -2015,6 +2015,19 @@ class ApiV1Controller extends Controller
}
$res = collect($feed)
->filter(function($k) use($min, $max) {
if(!$min && !$max) {
return true;
}
if($min) {
return $min != $k;
}
if($max) {
return $max != $k;
}
})
->map(function($k) use($user) {
$status = StatusService::getMastodon($k);
if(!$status || !isset($status['account']) || !isset($status['account']['id'])) {
@ -2032,7 +2045,6 @@ class ApiV1Controller extends Controller
})
->take($limit)
->values();
// ->toArray();
$baseUrl = config('app.url') . '/api/v1/timelines/public?limit=' . $limit . '&';
if($remote) {

View file

@ -132,6 +132,18 @@ class CollectionController extends Controller
$collection = Collection::whereProfileId($profileId)->findOrFail($collectionId);
$count = $collection->items()->count();
if($count) {
CollectionItem::whereCollectionId($collection->id)
->get()
->filter(function($col) {
return StatusService::get($col->object_id, false) == null;
})
->each(function($col) use($collectionId) {
CollectionService::removeItem($collectionId, $col->object_id);
$col->delete();
});
}
$max = config('pixelfed.max_collection_length');
if($count >= $max) {
abort(400, 'You can only add '.$max.' posts per collection');

View file

@ -228,8 +228,6 @@ class ComposeController extends Controller
MediaStorageService::delete($media, true);
$media->forceDelete();
return response()->json([
'msg' => 'Successfully deleted',
'code' => 200

View file

@ -401,6 +401,7 @@ class PublicApiController extends Controller
}
$res = collect($feed)
->take($limit)
->map(function($k) use($user) {
$status = StatusService::get($k);
if($status && isset($status['account']) && $user) {
@ -680,6 +681,7 @@ class PublicApiController extends Controller
}
$res = collect($feed)
->take($limit)
->map(function($k) use($user) {
$status = StatusService::get($k);
if($status && isset($status['account']) && $user) {

View file

@ -57,7 +57,9 @@ class MediaDeletePipeline implements ShouldQueue
$disk->deleteDirectory($i);
}
return 1;
$media->forceDelete();
return;
}
}

View file

@ -5,6 +5,7 @@ namespace App\Jobs\StatusPipeline;
use DB, Storage;
use App\{
AccountInterstitial,
CollectionItem,
MediaTag,
Notification,
Report,
@ -25,6 +26,7 @@ use GuzzleHttp\Pool;
use GuzzleHttp\Client;
use GuzzleHttp\Promise;
use App\Util\ActivityPub\HttpSignature;
use App\Services\CollectionService;
use App\Services\StatusService;
use App\Services\MediaStorageService;
@ -89,6 +91,19 @@ class StatusDelete implements ShouldQueue
$parent->save();
});
}
DB::transaction(function() use($status) {
CollectionItem::whereObjectType('App\Status')
->whereObjectId($status->id)
->get()
->each(function($col) {
$id = $col->collection_id;
$sid = $col->object_id;
$col->delete();
CollectionService::removeItem($id, $sid);
});
});
DB::transaction(function() use($status) {
$comments = Status::where('in_reply_to_id', $status->id)->get();
foreach ($comments as $comment) {

View file

@ -9,7 +9,7 @@ use Illuminate\Support\Facades\Redis;
class CollectionService
{
const CACHE_KEY = 'pf:services:collections:';
const CACHE_KEY = 'pf:services:collections-v1:';
public static function getItems($id, $start = 0, $stop = 10)
{
@ -41,6 +41,9 @@ class CollectionService
return CollectionItem::whereCollectionId($id)
->orderBy('order')
->get()
->filter(function($item) use($id) {
return StatusService::get($item->object_id) != null;
})
->each(function($item) use ($id) {
self::addItem($id, $item->object_id, $item->order);
})
@ -80,13 +83,14 @@ class CollectionService
'visibility' => $collection->visibility,
'title' => $collection->title,
'description' => $collection->description,
'thumb' => self::getThumb($id),
'thumb' => '/storage/no-preview.png',
'url' => $collection->url(),
'published_at' => $collection->published_at
];
});
if($collection) {
$collection['thumb'] = self::getThumb($id);
$collection['post_count'] = self::count($id);
}

View file

@ -695,7 +695,7 @@ class Helpers {
}
if($profile = Profile::whereRemoteUrl($url)->first()) {
if($profile->last_fetched_at->lt(now()->subHours(24))) {
if($profile->last_fetched_at && $profile->last_fetched_at->lt(now()->subHours(24))) {
return self::profileUpdateOrCreate($url);
}
return $profile;

View file

@ -36,6 +36,7 @@ use App\Util\ActivityPub\Validator\UndoFollow as UndoFollowValidator;
use App\Services\PollService;
use App\Services\FollowerService;
use App\Services\StatusService;
use App\Models\Conversation;
class Inbox
@ -644,6 +645,7 @@ class Inbox
if(!$status) {
return;
}
StatusService::del($status->id, true);
Notification::whereActorId($profile->id)
->whereItemType('App\Status')
->whereItemId($status->id)