forked from mirror/pixelfed
Update AccountController. Fixes #582
This commit is contained in:
parent
5b6a589c43
commit
10cfb02a9e
1 changed files with 22 additions and 0 deletions
|
@ -203,6 +203,16 @@ class AccountController extends Controller
|
||||||
'filter_type' => 'mute',
|
'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();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,6 +234,9 @@ class AccountController extends Controller
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 'user':
|
case 'user':
|
||||||
$profile = Profile::findOrFail($item);
|
$profile = Profile::findOrFail($item);
|
||||||
|
if ($profile->id == $user->id) {
|
||||||
|
return abort(403);
|
||||||
|
}
|
||||||
$class = get_class($profile);
|
$class = get_class($profile);
|
||||||
$filterable['id'] = $profile->id;
|
$filterable['id'] = $profile->id;
|
||||||
$filterable['type'] = $class;
|
$filterable['type'] = $class;
|
||||||
|
@ -244,6 +257,15 @@ class AccountController extends Controller
|
||||||
'filter_type' => 'block',
|
'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();
|
return redirect()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue