Merge pull request #6068 from pixelfed/staging

Staging
pull/5973/head^2
(dan)iel (sup)ernault 4 months ago committed by GitHub
commit 81858a8d20
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -41,6 +41,14 @@
- Update Groups ImageResizePipeline with intervention/image v3 support ([616e37066](https://github.com/pixelfed/pixelfed/commit/616e37066)) - Update Groups ImageResizePipeline with intervention/image v3 support ([616e37066](https://github.com/pixelfed/pixelfed/commit/616e37066))
- Update app config, add Str alias ([5539dd0e1](https://github.com/pixelfed/pixelfed/commit/5539dd0e1)) - Update app config, add Str alias ([5539dd0e1](https://github.com/pixelfed/pixelfed/commit/5539dd0e1))
- Update PlaceController, fix show method ([f81a4acdc](https://github.com/pixelfed/pixelfed/commit/f81a4acdc)) - Update PlaceController, fix show method ([f81a4acdc](https://github.com/pixelfed/pixelfed/commit/f81a4acdc))
- Update Places, improve cache invalidation/ttl ([ece23d751](https://github.com/pixelfed/pixelfed/commit/ece23d751))
- Update ComposeController, add addl compose settings data ([9048ab52c](https://github.com/pixelfed/pixelfed/commit/9048ab52c))
- Update Admin Users dashboard ([b6bc1e50e](https://github.com/pixelfed/pixelfed/commit/b6bc1e50e))
- Update TransformImports command, fix IG import bug ([c692c7655](https://github.com/pixelfed/pixelfed/commit/c692c7655))
- Update ImportService and TransformImports to fix race condition bug ([a8d1d0f2e](https://github.com/pixelfed/pixelfed/commit/a8d1d0f2e))
- Update ComposeController, prioritize followed users and follower_count first ([10eb1a8ac](https://github.com/pixelfed/pixelfed/commit/10eb1a8ac))
- Update ComposeController, fix user tagging endpoint ([2a9c28b81](https://github.com/pixelfed/pixelfed/commit/2a9c28b81))
- Update RemoteStatusDelete, fix decrement logic ([4ab85248e](https://github.com/pixelfed/pixelfed/commit/4ab85248e))
- ([](https://github.com/pixelfed/pixelfed/commit/)) - ([](https://github.com/pixelfed/pixelfed/commit/))
## [v0.12.5 (2025-03-23)](https://github.com/pixelfed/pixelfed/compare/v0.12.5...dev) ## [v0.12.5 (2025-03-23)](https://github.com/pixelfed/pixelfed/compare/v0.12.5...dev)

@ -246,20 +246,19 @@ class ComposeController extends Controller
'string', 'string',
'min:1', 'min:1',
'max:300', 'max:300',
new \App\Rules\WebFinger,
], ],
]); ]);
$q = $request->input('q'); $q = $request->input('q');
if (Str::of($q)->startsWith('@')) { $cleanQuery = Str::of($q)->startsWith('@') ? Str::substr($q, 1) : $q;
if (strlen($q) < 3) {
if (strlen($cleanQuery) < 2) {
return []; return [];
} }
$q = mb_substr($q, 1);
}
$user = $request->user(); $user = $request->user();
$currentUserId = $request->user()->profile_id;
abort_if($user->has_roles && ! UserRoleService::can('can-post', $user->id), 403, 'Invalid permissions for this action'); abort_if($user->has_roles && ! UserRoleService::can('can-post', $user->id), 403, 'Invalid permissions for this action');
@ -271,10 +270,26 @@ class ComposeController extends Controller
$blocked->push($request->user()->profile_id); $blocked->push($request->user()->profile_id);
$operator = config('database.default') === 'pgsql' ? 'ilike' : 'like'; $operator = config('database.default') === 'pgsql' ? 'ilike' : 'like';
$results = Profile::select('id', 'domain', 'username') $results = Profile::select([
->whereNotIn('id', $blocked) 'profiles.id',
->whereNull('domain') 'profiles.domain',
->where('username', $operator, '%'.$q.'%') 'profiles.username',
'profiles.followers_count',
])
->selectRaw('MAX(CASE WHEN followers.following_id IS NOT NULL THEN 1 ELSE 0 END) as is_followed')
->leftJoin('followers', function ($join) use ($currentUserId) {
$join->on('followers.following_id', '=', 'profiles.id')
->where('followers.profile_id', '=', $currentUserId);
})
->whereNotIn('profiles.id', $blocked)
->where(function ($query) use ($cleanQuery, $operator) {
$query->where('profiles.username', $operator, $cleanQuery.'%')
->orWhere('profiles.username', $operator, '%'.$cleanQuery.'%');
})
->groupBy('profiles.id', 'profiles.domain', 'profiles.username', 'profiles.followers_count')
->orderByDesc('is_followed')
->orderByDesc('profiles.followers_count')
->orderBy('profiles.username')
->limit(15) ->limit(15)
->get() ->get()
->map(function ($r) { ->map(function ($r) {
@ -434,6 +449,7 @@ class ComposeController extends Controller
->push($request->user()->profile_id); ->push($request->user()->profile_id);
$currentUserId = $request->user()->profile_id; $currentUserId = $request->user()->profile_id;
$operator = config('database.default') === 'pgsql' ? 'ilike' : 'like';
$results = Profile::select([ $results = Profile::select([
'profiles.id', 'profiles.id',
@ -447,9 +463,9 @@ class ComposeController extends Controller
->where('followers.profile_id', '=', $currentUserId); ->where('followers.profile_id', '=', $currentUserId);
}) })
->whereNotIn('profiles.id', $blocked) ->whereNotIn('profiles.id', $blocked)
->where(function ($query) use ($cleanQuery) { ->where(function ($query) use ($cleanQuery, $operator) {
$query->where('profiles.username', 'like', $cleanQuery.'%') $query->where('profiles.username', $operator, $cleanQuery.'%')
->orWhere('profiles.username', 'like', '%'.$cleanQuery.'%'); ->orWhere('profiles.username', $operator, '%'.$cleanQuery.'%');
}) })
->groupBy('profiles.id', 'profiles.domain', 'profiles.username', 'profiles.followers_count') ->groupBy('profiles.id', 'profiles.domain', 'profiles.username', 'profiles.followers_count')
->orderByDesc('is_followed') ->orderByDesc('is_followed')

@ -2,47 +2,35 @@
namespace App\Jobs\StatusPipeline; namespace App\Jobs\StatusPipeline;
use DB, Cache, Storage; use App\AccountInterstitial;
use App\{ use App\Bookmark;
AccountInterstitial, use App\CollectionItem;
Bookmark, use App\DirectMessage;
CollectionItem, use App\Jobs\MediaPipeline\MediaDeletePipeline;
DirectMessage, use App\Like;
Like, use App\Media;
Media, use App\MediaTag;
MediaTag, use App\Mention;
Mention, use App\Notification;
Notification, use App\Report;
Report, use App\Services\Account\AccountStatService;
Status, use App\Services\AccountService;
StatusArchived, use App\Services\CollectionService;
StatusHashtag, use App\Services\NotificationService;
StatusView use App\Services\StatusService;
}; use App\Status;
use App\StatusArchived;
use App\StatusHashtag;
use App\StatusView;
use Illuminate\Bus\Queueable; use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Contracts\Queue\ShouldBeUniqueUntilProcessing; use Illuminate\Contracts\Queue\ShouldBeUniqueUntilProcessing;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\Middleware\WithoutOverlapping; use Illuminate\Queue\Middleware\WithoutOverlapping;
use League\Fractal; use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Str;
use League\Fractal\Serializer\ArraySerializer;
use App\Transformer\ActivityPub\Verb\DeleteNote;
use App\Util\ActivityPub\Helpers;
use GuzzleHttp\Pool;
use GuzzleHttp\Client;
use GuzzleHttp\Promise;
use App\Util\ActivityPub\HttpSignature;
use App\Services\AccountService;
use App\Services\CollectionService;
use App\Services\StatusService;
use App\Jobs\MediaPipeline\MediaDeletePipeline;
use App\Services\NotificationService;
use App\Services\Account\AccountStatService;
class RemoteStatusDelete implements ShouldQueue, ShouldBeUniqueUntilProcessing class RemoteStatusDelete implements ShouldBeUniqueUntilProcessing, ShouldQueue
{ {
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
@ -56,8 +44,11 @@ class RemoteStatusDelete implements ShouldQueue, ShouldBeUniqueUntilProcessing
public $deleteWhenMissingModels = true; public $deleteWhenMissingModels = true;
public $tries = 3; public $tries = 3;
public $maxExceptions = 3; public $maxExceptions = 3;
public $timeout = 180; public $timeout = 180;
public $failOnTimeout = true; public $failOnTimeout = true;
/** /**
@ -109,6 +100,7 @@ class RemoteStatusDelete implements ShouldQueue, ShouldBeUniqueUntilProcessing
} }
StatusService::del($status->id, true); StatusService::del($status->id, true);
// AccountStatService::decrementPostCount($status->profile_id); // AccountStatService::decrementPostCount($status->profile_id);
return $this->unlinkRemoveMedia($status); return $this->unlinkRemoveMedia($status);
} }
@ -119,8 +111,10 @@ class RemoteStatusDelete implements ShouldQueue, ShouldBeUniqueUntilProcessing
if ($status->in_reply_to_id) { if ($status->in_reply_to_id) {
$parent = Status::find($status->in_reply_to_id); $parent = Status::find($status->in_reply_to_id);
if ($parent) { if ($parent) {
--$parent->reply_count; if ($parent->reply_count) {
$parent->reply_count = $parent->reply_count - 1;
$parent->save(); $parent->save();
}
StatusService::del($parent->id); StatusService::del($parent->id);
} }
} }

Loading…
Cancel
Save