1
0
Fork 0
forked from mirror/pixelfed

Merge pull request #1530 from pixelfed/frontend-ui-refactor

Frontend ui refactor
This commit is contained in:
daniel 2019-07-19 23:08:38 -06:00 committed by GitHub
commit d3356e0265
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 5 deletions

View file

@ -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;

View file

@ -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 = [

View file

@ -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());