fix: resolve undefined variable bugs (phpstan variable.undefined)

- AdminReportController: fix closure param name and remove reference to
  undefined $meta variable
- GroupsPostController: replace $status with $gp (the actual GroupPost
  variable in scope)
- PortfolioController: replace undefined $metadata with null
- DeleteWorker: remove Cache::set() call with undefined $key
pull/6845/head
Your Name 4 weeks ago
parent d048ce74d6
commit ccd75dd903

@ -380,8 +380,8 @@ trait AdminReportController
Status::whereProfileId($pro->id)
->get()
->each(function ($report) {
$status->is_nsfw = $meta->is_nsfw;
->each(function ($status) {
$status->is_nsfw = true;
$status->scope = 'public';
$status->visibility = 'public';
$status->save();

@ -35,7 +35,7 @@ class GroupsPostController extends Controller
{
$this->validate($request, [
'group_id' => 'required|exists:groups,id',
'caption' => 'sometimes|string|max:' . config_cache('pixelfed.max_caption_length'),
'caption' => 'sometimes|string|max:'.config_cache('pixelfed.max_caption_length'),
'pollOptions' => 'sometimes|array|min:1|max:4',
]);
@ -107,7 +107,7 @@ class GroupsPostController extends Controller
}
if ($type == 'video') {
$video = $request->file('video');
$storagePath = 'public/g/' . $group->id . '/p/' . $status->id;
$storagePath = 'public/g/'.$group->id.'/p/'.$status->id;
$path = $video->storePublicly($storagePath);
$hash = \hash_file('sha256', $video);
@ -137,9 +137,9 @@ class GroupsPostController extends Controller
$gp->id
);
$s = GroupPostService::get($status->group_id, $status->id);
$s = GroupPostService::get($gp->group_id, $gp->id);
GroupFeedService::add($group->id, $gp->id);
Cache::forget('groups:self:feed:' . $pid);
Cache::forget('groups:self:feed:'.$pid);
$s['pf_type'] = $type;
$s['visibility'] = 'public';
@ -169,9 +169,9 @@ class GroupsPostController extends Controller
$group = Group::findOrFail($gid);
abort_if(! $group->isMember($pid), 403, 'Not a member of group.');
$gp = GroupPost::whereGroupId($status->group_id)->findOrFail($request->input('id'));
$gp = GroupPost::whereGroupId($group->id)->findOrFail($request->input('id'));
abort_if($gp->profile_id != $pid && $group->profile_id != $pid, 403);
$cached = GroupPostService::get($status->group_id, $status->id);
$cached = GroupPostService::get($gp->group_id, $gp->id);
if ($cached) {
$cached = collect($cached)->filter(function ($r, $k) {
@ -233,7 +233,7 @@ class GroupsPostController extends Controller
// $u->save();
// }
if ($status->in_reply_to_id) {
if ($gp->in_reply_to_id) {
$parent = GroupPost::find($status->in_reply_to_id);
if ($parent) {
$parent->reply_count = GroupPost::whereInReplyToId($parent->id)->count();

@ -146,7 +146,7 @@ class PortfolioController extends Controller
$portfolio->show_bio = $request->input('show_bio') === 'on';
$portfolio->profile_layout = $request->input('layout');
$portfolio->profile_container = $request->input('layout_container');
$portfolio->metadata = $metadata;
$portfolio->metadata = null;
$portfolio->save();
return redirect('/'.$request->user()->username);

@ -12,7 +12,6 @@ use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Http\Client\ConnectionException;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
@ -94,7 +93,6 @@ class DeleteWorker implements ShouldQueue
$actorDelete = Profile::whereRemoteUrl($actor)->exists();
if ($actorDelete) {
if ($this->verifySignature($headers, $payload) == true) {
Cache::set($key, false);
$profile = Profile::whereNotNull('domain')
->whereNull('status')
->whereRemoteUrl($actor)

Loading…
Cancel
Save