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

Update Profile Bookmarks
pull/1507/head
daniel 2019-07-12 22:02:13 -06:00 zatwierdzone przez GitHub
commit c563beecdd
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
7 zmienionych plików z 518 dodań i 514 usunięć

Wyświetl plik

@ -306,4 +306,18 @@ class InternalApiController extends Controller
Cache::forget('profile:status_count:'.$profile->id);
return $status->url();
}
public function bookmarks(Request $request)
{
$statuses = Auth::user()->profile
->bookmarks()
->withCount(['likes','comments'])
->orderBy('created_at', 'desc')
->simplePaginate(10);
$resource = new Fractal\Resource\Collection($statuses, new StatusTransformer());
$res = $this->fractal->createData($resource)->toArray();
return response()->json($res);
}
}

Wyświetl plik

@ -240,23 +240,4 @@ class ProfileController extends Controller
}
return view('profile.following', compact('user', 'profile', 'following', 'owner', 'is_following', 'is_admin', 'settings'));
}
public function savedBookmarks(Request $request, $username)
{
if (Auth::check() === false || $username !== Auth::user()->username) {
abort(403);
}
$user = $profile = Auth::user()->profile;
if($profile->status != null) {
return $this->accountCheck($profile);
}
$settings = User::whereUsername($username)->firstOrFail()->settings;
$owner = true;
$following = false;
$timeline = $user->bookmarks()->withCount(['likes','comments'])->orderBy('created_at', 'desc')->simplePaginate(10);
$is_following = ($owner == false && Auth::check()) ? $user->followedBy(Auth::user()->profile) : false;
$is_admin = is_null($user->domain) ? $user->user->is_admin : false;
return view('profile.bookmarks', compact('user', 'profile', 'settings', 'owner', 'following', 'timeline', 'is_following', 'is_admin'));
}
}

Wyświetl plik

@ -192,8 +192,14 @@ class SettingsController extends Controller
$patreon = Str::startsWith($request->input('patreon'), 'https://') ?
substr($request->input('patreon'), 8) :
$request->input('patreon');
$liberapay = Str::startsWith($request->input('liberapay'), 'https://') ? substr($request->input('liberapay'), 8) : $request->input('liberapay');
$opencollective = Str::startsWith($request->input('opencollective'), 'https://') ? substr($request->input('opencollective'), 8) : $request->input('opencollective');
$liberapay = Str::startsWith($request->input('liberapay'), 'https://') ?
substr($request->input('liberapay'), 8) :
$request->input('liberapay');
$opencollective = Str::startsWith($request->input('opencollective'), 'https://') ?
substr($request->input('opencollective'), 8) :
$request->input('opencollective');
$patreon = Str::startsWith($patreon, 'patreon.com/') ? e($patreon) : null;
$liberapay = Str::startsWith($liberapay, 'liberapay.com/') ? e($liberapay) : null;

File diff suppressed because one or more lines are too long

Wyświetl plik

@ -16,7 +16,7 @@
"/js/hashtag.js": "/js/hashtag.js?id=0f7e529e8128cc17638b",
"/js/loops.js": "/js/loops.js?id=19112dc8663fc43db735",
"/js/mode-dot.js": "/js/mode-dot.js?id=c7c83849e6bba99f1c33",
"/js/profile.js": "/js/profile.js?id=13f4d71fb51610ec5a34",
"/js/profile.js": "/js/profile.js?id=e285b20ac6d467f99138",
"/js/quill.js": "/js/quill.js?id=c2b060eaf87ef63eb5c1",
"/js/search.js": "/js/search.js?id=3186ccb02c7fad43c701",
"/js/status.js": "/js/status.js?id=4b9a52b586880e264f05",

Wyświetl plik

@ -90,7 +90,6 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact
Route::get('notifications', 'ApiController@notifications');
Route::get('timelines/public', 'PublicApiController@publicTimelineApi');
Route::get('timelines/home', 'PublicApiController@homeTimelineApi');
// Route::get('timelines/network', 'PublicApiController@homeTimelineApi');
});
Route::group(['prefix' => 'v2'], function() {
Route::get('config', 'ApiController@siteConfiguration');
@ -115,6 +114,7 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact
Route::post('discover/tag/subscribe', 'HashtagFollowController@store')->middleware('throttle:maxHashtagFollowsPerHour,60')->middleware('throttle:maxHashtagFollowsPerDay,1440');;
Route::get('discover/tag/list', 'HashtagFollowController@getTags');
Route::get('profile/sponsor/{id}', 'ProfileSponsorController@get');
Route::get('bookmarks', 'InternalApiController@bookmarks');
});
});
@ -201,7 +201,6 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact
Route::get('privacy/blocked-keywords', 'SettingsController@blockedKeywords')->name('settings.privacy.blocked-keywords');
Route::post('privacy/account', 'SettingsController@privateAccountOptions')->name('settings.privacy.account');
Route::get('reports', 'SettingsController@reportsHome')->name('settings.reports');
// Todo: Release in 0.7.2
Route::group(['prefix' => 'remove', 'middleware' => 'dangerzone'], function() {
Route::get('request/temporary', 'SettingsController@removeAccountTemporary')->name('settings.remove.temporary');
Route::post('request/temporary', 'SettingsController@removeAccountTemporarySubmit');
@ -304,7 +303,6 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact
Route::group(['prefix' => 'timeline'], function () {
Route::redirect('/', '/');
Route::get('public', 'TimelineController@local')->name('timeline.public');
// Route::get('network', 'TimelineController@network')->name('timeline.network');
});
Route::group(['prefix' => 'users'], function () {
@ -321,7 +319,6 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact
Route::get('p/{username}/{id}/edit', 'StatusController@edit');
Route::post('p/{username}/{id}/edit', 'StatusController@editStore');
Route::get('p/{username}/{id}', 'StatusController@show');
Route::get('{username}/saved', 'ProfileController@savedBookmarks');
Route::get('{username}/followers', 'ProfileController@followers')->middleware('auth');
Route::get('{username}/following', 'ProfileController@following')->middleware('auth');
Route::get('{username}', 'ProfileController@show');