diff --git a/app/Http/Controllers/AvatarController.php b/app/Http/Controllers/AvatarController.php index ef63afa1c..3a464ce10 100644 --- a/app/Http/Controllers/AvatarController.php +++ b/app/Http/Controllers/AvatarController.php @@ -73,7 +73,7 @@ class AvatarController extends Controller public function buildPath($id) { - $padded = str_pad($id, 12, 0, STR_PAD_LEFT); + $padded = str_pad($id, 19, 0, STR_PAD_LEFT); $parts = str_split($padded, 3); foreach ($parts as $k => $part) { if ($k == 0) { @@ -93,6 +93,21 @@ class AvatarController extends Controller $prefix = storage_path('app/'.$avatarpath); $this->checkDir($prefix); } + if ($k == 4) { + $avatarpath = 'public/avatars/'.$parts[0].'/'.$parts[1].'/'.$parts[2].'/'.$parts[3].'/'.$parts[4]; + $prefix = storage_path('app/'.$avatarpath); + $this->checkDir($prefix); + } + if ($k == 5) { + $avatarpath = 'public/avatars/'.$parts[0].'/'.$parts[1].'/'.$parts[2].'/'.$parts[3].'/'.$parts[4].'/'.$parts[5]; + $prefix = storage_path('app/'.$avatarpath); + $this->checkDir($prefix); + } + if ($k == 6) { + $avatarpath = 'public/avatars/'.$parts[0].'/'.$parts[1].'/'.$parts[2].'/'.$parts[3].'/'.$parts[4].'/'.$parts[5].'/'.$parts[6]; + $prefix = storage_path('app/'.$avatarpath); + $this->checkDir($prefix); + } } return $avatarpath; diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php index d5db00b10..870af7340 100644 --- a/app/Http/Controllers/ProfileController.php +++ b/app/Http/Controllers/ProfileController.php @@ -6,6 +6,7 @@ use Illuminate\Http\Request; use Auth; use Cache; use App\Follower; +use App\FollowRequest; use App\Profile; use App\User; use App\UserFilter; @@ -67,8 +68,12 @@ class ProfileController extends Controller $is_following = ($owner == false && Auth::check()) ? $user->followedBy(Auth::user()->profile) : false; if ($isPrivate == true || $isBlocked == true) { - return view('profile.private', compact('user', 'is_following')); + $requested = Auth::check() ? FollowRequest::whereFollowerId(Auth::user()->profile_id) + ->whereFollowingId($user->id) + ->exists() : false; + return view('profile.private', compact('user', 'is_following', 'requested')); } + $is_admin = is_null($user->domain) ? $user->user->is_admin : false; $profile = $user; $settings = [ diff --git a/app/Http/Controllers/Settings/ExportSettings.php b/app/Http/Controllers/Settings/ExportSettings.php index b6b803451..91f8c9760 100644 --- a/app/Http/Controllers/Settings/ExportSettings.php +++ b/app/Http/Controllers/Settings/ExportSettings.php @@ -103,7 +103,7 @@ trait ExportSettings $this->validate($request, [ 'type' => 'required|string|in:ap,api' ]); - $limit = 300; + $limit = 500; $profile = Auth::user()->profile; $type = 'ap'; @@ -116,7 +116,7 @@ trait ExportSettings $filename = 'outbox.json'; if($type == 'ap') { - $data = Cache::remember('account:export:profile:statuses:ap:'.Auth::user()->profile->id, now()->addDays(7), function() { + $data = Cache::remember('account:export:profile:statuses:ap:'.Auth::user()->profile->id, now()->addHours(1), function() { $profile = Auth::user()->profile->statuses; $fractal = new Fractal\Manager(); $fractal->setSerializer(new ArraySerializer()); @@ -125,7 +125,7 @@ trait ExportSettings }); } else { $filename = 'api-statuses.json'; - $data = Cache::remember('account:export:profile:statuses:api:'.Auth::user()->profile->id, now()->addDays(7), function() { + $data = Cache::remember('account:export:profile:statuses:api:'.Auth::user()->profile->id, now()->addHours(1), function() { $profile = Auth::user()->profile->statuses; $fractal = new Fractal\Manager(); $fractal->setSerializer(new ArraySerializer());