mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-18 19:13:17 +00:00
Update BookmarkController to handle Moved accounts
This commit is contained in:
parent
6c48a12423
commit
447aa1e1ea
1 changed files with 12 additions and 11 deletions
|
@ -3,12 +3,12 @@
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Bookmark;
|
use App\Bookmark;
|
||||||
use App\Status;
|
use App\Services\AccountService;
|
||||||
use Auth;
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use App\Services\BookmarkService;
|
use App\Services\BookmarkService;
|
||||||
use App\Services\FollowerService;
|
use App\Services\FollowerService;
|
||||||
use App\Services\UserRoleService;
|
use App\Services\UserRoleService;
|
||||||
|
use App\Status;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class BookmarkController extends Controller
|
class BookmarkController extends Controller
|
||||||
{
|
{
|
||||||
|
@ -25,7 +25,8 @@ class BookmarkController extends Controller
|
||||||
|
|
||||||
$user = $request->user();
|
$user = $request->user();
|
||||||
$status = Status::findOrFail($request->input('item'));
|
$status = Status::findOrFail($request->input('item'));
|
||||||
|
$account = AccountService::get($status->profile_id);
|
||||||
|
abort_if(isset($account['moved'], $account['moved']['id']), 422, 'Cannot bookmark or unbookmark a post from an account that has migrated');
|
||||||
abort_if($user->has_roles && ! UserRoleService::can('can-bookmark', $user->id), 403, 'Invalid permissions for this action');
|
abort_if($user->has_roles && ! UserRoleService::can('can-bookmark', $user->id), 403, 'Invalid permissions for this action');
|
||||||
abort_if($status->in_reply_to_id || $status->reblog_of_id, 404);
|
abort_if($status->in_reply_to_id || $status->reblog_of_id, 404);
|
||||||
abort_if(! in_array($status->scope, ['public', 'unlisted', 'private']), 404);
|
abort_if(! in_array($status->scope, ['public', 'unlisted', 'private']), 404);
|
||||||
|
|
Loading…
Reference in a new issue