1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-24 08:44:02 +00:00

Merge pull request #3788 from pixelfed/staging

Staging
This commit is contained in:
daniel 2022-11-17 20:16:11 -07:00 committed by GitHub
commit 5420abf76c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 10 deletions

View file

@ -15,6 +15,9 @@
- Enable network timeline caching by default ([c990ac2a](https://github.com/pixelfed/pixelfed/commit/c990ac2a))
- Redirect /home to / ([97032997](https://github.com/pixelfed/pixelfed/commit/97032997))
- Fix 2FA backup code bug ([a231b3c5](https://github.com/pixelfed/pixelfed/commit/a231b3c5))
- Update federation config, enable remote follows by default ([59702d40](https://github.com/pixelfed/pixelfed/commit/59702d40))
- Update ApiV1Controller, fix followAccountById with firstOrCreate() ([1d52ad0b](https://github.com/pixelfed/pixelfed/commit/1d52ad0b))
- Update AccountService, fix delete status ([8b7121f9](https://github.com/pixelfed/pixelfed/commit/8b7121f9))
- ([](https://github.com/pixelfed/pixelfed/commit/))
## [v0.11.4 (2022-10-04)](https://github.com/pixelfed/pixelfed/compare/v0.11.3...v0.11.4)

View file

@ -80,7 +80,8 @@ class SendUpdateActor extends Command
$bar->start();
$startCache = $this->getStorageCache($domain);
User::whereNull('status')->when($startCache, function($query, $startCache) {
User::whereNull('status')->when($startCache, function($query, $startCache) use($bar) {
$bar->advance($startCache);
return $query->where('id', '>', $startCache);
})->chunk(50, function($users) use($bar, $url, $domain) {
foreach($users as $user) {

View file

@ -3023,7 +3023,7 @@ class ApiV1Controller extends Controller
}
if($sortBy == 'all' && !$request->has('cursor')) {
$ids = Cache::remember('status:replies:all:' . $id, 86400, function() use($id) {
$ids = Cache::remember('status:replies:all:' . $id, 3600, function() use($id) {
return DB::table('statuses')
->where('in_reply_to_id', $id)
->orderBy('id')
@ -3058,8 +3058,15 @@ class ApiV1Controller extends Controller
$status['favourited'] = LikeService::liked($pid, $post->id);
return $status;
})
->map(function($post) {
if(isset($post['account']) && isset($post['account']['id'])) {
$account = AccountService::get($post['account']['id'], true);
$post['account'] = $account;
}
return $post;
})
->filter(function($post) {
return $post && isset($post['id']) && isset($post['account']);
return $post && isset($post['id']) && isset($post['account']) && isset($post['account']['id']);
})
->values();

View file

@ -19,19 +19,21 @@ class AccountService
public static function get($id, $softFail = false)
{
return Cache::remember(self::CACHE_KEY . $id, 43200, function() use($id, $softFail) {
$res = Cache::remember(self::CACHE_KEY . $id, 43200, function() use($id) {
$fractal = new Fractal\Manager();
$fractal->setSerializer(new ArraySerializer());
$profile = Profile::find($id);
if(!$profile) {
if($softFail) {
return null;
}
abort(404);
if(!$profile || $profile->status === 'delete') {
return null;
}
$resource = new Fractal\Resource\Item($profile, new AccountTransformer());
return $fractal->createData($resource)->toArray();
});
});
if(!$res) {
return $softFail ? null : abort(404);
}
return $res;
}
public static function getMastodon($id, $softFail = false)