mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-12 17:44:31 +00:00
commit
76dbddfae9
12 changed files with 61 additions and 10 deletions
|
@ -1,7 +1,6 @@
|
||||||
root = true
|
root = true
|
||||||
|
|
||||||
[*]
|
[*]
|
||||||
indent_style = space
|
|
||||||
indent_size = 4
|
indent_size = 4
|
||||||
end_of_line = lf
|
end_of_line = lf
|
||||||
charset = utf-8
|
charset = utf-8
|
||||||
|
|
|
@ -35,6 +35,11 @@
|
||||||
- Update follower counts on follow_request approval ([e97900a0](https://github.com/pixelfed/pixelfed/commit/e97900a0))
|
- 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, 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 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/))
|
- ([](https://github.com/pixelfed/pixelfed/commit/))
|
||||||
|
|
||||||
## [v0.11.3 (2022-05-09)](https://github.com/pixelfed/pixelfed/compare/v0.11.2...v0.11.3)
|
## [v0.11.3 (2022-05-09)](https://github.com/pixelfed/pixelfed/compare/v0.11.2...v0.11.3)
|
||||||
|
|
|
@ -51,10 +51,10 @@ class MediaGarbageCollector extends Command
|
||||||
$bar = $this->output->createProgressBar($gc->count());
|
$bar = $this->output->createProgressBar($gc->count());
|
||||||
$bar->start();
|
$bar->start();
|
||||||
foreach($gc as $media) {
|
foreach($gc as $media) {
|
||||||
MediaStorageService::delete($media);
|
MediaStorageService::delete($media, true);
|
||||||
$media->forceDelete();
|
|
||||||
$bar->advance();
|
$bar->advance();
|
||||||
}
|
}
|
||||||
$bar->finish();
|
$bar->finish();
|
||||||
|
$this->line('');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2015,6 +2015,19 @@ class ApiV1Controller extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
$res = collect($feed)
|
$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) {
|
->map(function($k) use($user) {
|
||||||
$status = StatusService::getMastodon($k);
|
$status = StatusService::getMastodon($k);
|
||||||
if(!$status || !isset($status['account']) || !isset($status['account']['id'])) {
|
if(!$status || !isset($status['account']) || !isset($status['account']['id'])) {
|
||||||
|
@ -2032,7 +2045,6 @@ class ApiV1Controller extends Controller
|
||||||
})
|
})
|
||||||
->take($limit)
|
->take($limit)
|
||||||
->values();
|
->values();
|
||||||
// ->toArray();
|
|
||||||
|
|
||||||
$baseUrl = config('app.url') . '/api/v1/timelines/public?limit=' . $limit . '&';
|
$baseUrl = config('app.url') . '/api/v1/timelines/public?limit=' . $limit . '&';
|
||||||
if($remote) {
|
if($remote) {
|
||||||
|
|
|
@ -132,6 +132,18 @@ class CollectionController extends Controller
|
||||||
$collection = Collection::whereProfileId($profileId)->findOrFail($collectionId);
|
$collection = Collection::whereProfileId($profileId)->findOrFail($collectionId);
|
||||||
$count = $collection->items()->count();
|
$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');
|
$max = config('pixelfed.max_collection_length');
|
||||||
if($count >= $max) {
|
if($count >= $max) {
|
||||||
abort(400, 'You can only add '.$max.' posts per collection');
|
abort(400, 'You can only add '.$max.' posts per collection');
|
||||||
|
|
|
@ -228,8 +228,6 @@ class ComposeController extends Controller
|
||||||
|
|
||||||
MediaStorageService::delete($media, true);
|
MediaStorageService::delete($media, true);
|
||||||
|
|
||||||
$media->forceDelete();
|
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'msg' => 'Successfully deleted',
|
'msg' => 'Successfully deleted',
|
||||||
'code' => 200
|
'code' => 200
|
||||||
|
|
|
@ -401,6 +401,7 @@ class PublicApiController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
$res = collect($feed)
|
$res = collect($feed)
|
||||||
|
->take($limit)
|
||||||
->map(function($k) use($user) {
|
->map(function($k) use($user) {
|
||||||
$status = StatusService::get($k);
|
$status = StatusService::get($k);
|
||||||
if($status && isset($status['account']) && $user) {
|
if($status && isset($status['account']) && $user) {
|
||||||
|
@ -680,6 +681,7 @@ class PublicApiController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
$res = collect($feed)
|
$res = collect($feed)
|
||||||
|
->take($limit)
|
||||||
->map(function($k) use($user) {
|
->map(function($k) use($user) {
|
||||||
$status = StatusService::get($k);
|
$status = StatusService::get($k);
|
||||||
if($status && isset($status['account']) && $user) {
|
if($status && isset($status['account']) && $user) {
|
||||||
|
|
|
@ -57,7 +57,9 @@ class MediaDeletePipeline implements ShouldQueue
|
||||||
$disk->deleteDirectory($i);
|
$disk->deleteDirectory($i);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
$media->forceDelete();
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ namespace App\Jobs\StatusPipeline;
|
||||||
use DB, Storage;
|
use DB, Storage;
|
||||||
use App\{
|
use App\{
|
||||||
AccountInterstitial,
|
AccountInterstitial,
|
||||||
|
CollectionItem,
|
||||||
MediaTag,
|
MediaTag,
|
||||||
Notification,
|
Notification,
|
||||||
Report,
|
Report,
|
||||||
|
@ -25,6 +26,7 @@ use GuzzleHttp\Pool;
|
||||||
use GuzzleHttp\Client;
|
use GuzzleHttp\Client;
|
||||||
use GuzzleHttp\Promise;
|
use GuzzleHttp\Promise;
|
||||||
use App\Util\ActivityPub\HttpSignature;
|
use App\Util\ActivityPub\HttpSignature;
|
||||||
|
use App\Services\CollectionService;
|
||||||
use App\Services\StatusService;
|
use App\Services\StatusService;
|
||||||
use App\Services\MediaStorageService;
|
use App\Services\MediaStorageService;
|
||||||
|
|
||||||
|
@ -89,6 +91,19 @@ class StatusDelete implements ShouldQueue
|
||||||
$parent->save();
|
$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) {
|
DB::transaction(function() use($status) {
|
||||||
$comments = Status::where('in_reply_to_id', $status->id)->get();
|
$comments = Status::where('in_reply_to_id', $status->id)->get();
|
||||||
foreach ($comments as $comment) {
|
foreach ($comments as $comment) {
|
||||||
|
|
|
@ -9,7 +9,7 @@ use Illuminate\Support\Facades\Redis;
|
||||||
|
|
||||||
class CollectionService
|
class CollectionService
|
||||||
{
|
{
|
||||||
const CACHE_KEY = 'pf:services:collections:';
|
const CACHE_KEY = 'pf:services:collections-v1:';
|
||||||
|
|
||||||
public static function getItems($id, $start = 0, $stop = 10)
|
public static function getItems($id, $start = 0, $stop = 10)
|
||||||
{
|
{
|
||||||
|
@ -41,6 +41,9 @@ class CollectionService
|
||||||
return CollectionItem::whereCollectionId($id)
|
return CollectionItem::whereCollectionId($id)
|
||||||
->orderBy('order')
|
->orderBy('order')
|
||||||
->get()
|
->get()
|
||||||
|
->filter(function($item) use($id) {
|
||||||
|
return StatusService::get($item->object_id) != null;
|
||||||
|
})
|
||||||
->each(function($item) use ($id) {
|
->each(function($item) use ($id) {
|
||||||
self::addItem($id, $item->object_id, $item->order);
|
self::addItem($id, $item->object_id, $item->order);
|
||||||
})
|
})
|
||||||
|
@ -80,13 +83,14 @@ class CollectionService
|
||||||
'visibility' => $collection->visibility,
|
'visibility' => $collection->visibility,
|
||||||
'title' => $collection->title,
|
'title' => $collection->title,
|
||||||
'description' => $collection->description,
|
'description' => $collection->description,
|
||||||
'thumb' => self::getThumb($id),
|
'thumb' => '/storage/no-preview.png',
|
||||||
'url' => $collection->url(),
|
'url' => $collection->url(),
|
||||||
'published_at' => $collection->published_at
|
'published_at' => $collection->published_at
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
if($collection) {
|
if($collection) {
|
||||||
|
$collection['thumb'] = self::getThumb($id);
|
||||||
$collection['post_count'] = self::count($id);
|
$collection['post_count'] = self::count($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -695,7 +695,7 @@ class Helpers {
|
||||||
}
|
}
|
||||||
|
|
||||||
if($profile = Profile::whereRemoteUrl($url)->first()) {
|
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 self::profileUpdateOrCreate($url);
|
||||||
}
|
}
|
||||||
return $profile;
|
return $profile;
|
||||||
|
|
|
@ -36,6 +36,7 @@ use App\Util\ActivityPub\Validator\UndoFollow as UndoFollowValidator;
|
||||||
|
|
||||||
use App\Services\PollService;
|
use App\Services\PollService;
|
||||||
use App\Services\FollowerService;
|
use App\Services\FollowerService;
|
||||||
|
use App\Services\StatusService;
|
||||||
use App\Models\Conversation;
|
use App\Models\Conversation;
|
||||||
|
|
||||||
class Inbox
|
class Inbox
|
||||||
|
@ -644,6 +645,7 @@ class Inbox
|
||||||
if(!$status) {
|
if(!$status) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
StatusService::del($status->id, true);
|
||||||
Notification::whereActorId($profile->id)
|
Notification::whereActorId($profile->id)
|
||||||
->whereItemType('App\Status')
|
->whereItemType('App\Status')
|
||||||
->whereItemId($status->id)
|
->whereItemId($status->id)
|
||||||
|
|
Loading…
Reference in a new issue