1
0
Fork 0
forked from mirror/pixelfed

Update AccountController. Fixes #582

This commit is contained in:
Daniel Supernault 2018-11-22 12:30:20 -07:00
parent 5b6a589c43
commit 10cfb02a9e
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -203,6 +203,16 @@ class AccountController extends Controller
'filter_type' => 'mute',
]);
$pid = $user->id;
Cache::remember("user:filter:list:$pid", 1440, function() use($pid) {
$private = Profile::whereIsPrivate(true)->where('id', '!=', $pid)->pluck('id');
$filters = UserFilter::whereUserId($pid)
->whereFilterableType('App\Profile')
->whereIn('filter_type', ['mute', 'block'])
->pluck('filterable_id')->toArray();
return array_merge($private->toArray(), $filters);
});
return redirect()->back();
}
@ -224,6 +234,9 @@ class AccountController extends Controller
switch ($type) {
case 'user':
$profile = Profile::findOrFail($item);
if ($profile->id == $user->id) {
return abort(403);
}
$class = get_class($profile);
$filterable['id'] = $profile->id;
$filterable['type'] = $class;
@ -244,6 +257,15 @@ class AccountController extends Controller
'filter_type' => 'block',
]);
$pid = $user->id;
Cache::remember("user:filter:list:$pid", 1440, function() use($pid) {
$private = Profile::whereIsPrivate(true)->where('id', '!=', $pid)->pluck('id');
$filters = UserFilter::whereUserId($pid)
->whereFilterableType('App\Profile')
->whereIn('filter_type', ['mute', 'block'])
->pluck('filterable_id')->toArray();
return array_merge($private->toArray(), $filters);
});
return redirect()->back();
}