From c539e8f607a0ecb1526b5d58a614d701ae4a9d84 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 22 Aug 2019 18:25:53 -0600 Subject: [PATCH 1/7] Update SearchResults.vue --- resources/assets/js/components/SearchResults.vue | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/resources/assets/js/components/SearchResults.vue b/resources/assets/js/components/SearchResults.vue index e93354190..2d54ec93b 100644 --- a/resources/assets/js/components/SearchResults.vue +++ b/resources/assets/js/components/SearchResults.vue @@ -57,9 +57,9 @@ {{profile.value}}

- + + +

@@ -140,12 +140,12 @@ export default { }) }, - followProfile(id) { - // todo: finish AP Accept handling to enable remote follows + followProfile(profile) { + this.loading = true; axios.post('/i/follow', { - item: id + item: profile.entity.id }).then(res => { - window.location.href = window.location.href; + this.fetchSearchResults(); }).catch(err => { if(err.response.data.message) { swal('Error', err.response.data.message, 'error'); From d9db1cf8b1fec8e2d7296118589eea7db8522077 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 22 Aug 2019 21:22:00 -0600 Subject: [PATCH 2/7] Update FollowerController --- app/Http/Controllers/FollowerController.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/app/Http/Controllers/FollowerController.php b/app/Http/Controllers/FollowerController.php index 5ed9b1709..bd3f4b674 100644 --- a/app/Http/Controllers/FollowerController.php +++ b/app/Http/Controllers/FollowerController.php @@ -23,16 +23,11 @@ class FollowerController extends Controller public function store(Request $request) { $this->validate($request, [ - 'item' => 'required|integer', + 'item' => 'required|string', ]); - $item = $request->input('item'); + $item = (int) $request->input('item'); $this->handleFollowRequest($item); - if($request->wantsJson()) { - return response()->json([ - 200 - ], 200); - } - return redirect()->back(); + return response()->json(200); } protected function handleFollowRequest($item) From ac9bb59e19322742ff8d454f8a2c695b7d764621 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 22 Aug 2019 21:22:46 -0600 Subject: [PATCH 3/7] Update Profile.vue component --- resources/assets/js/components/Profile.vue | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/resources/assets/js/components/Profile.vue b/resources/assets/js/components/Profile.vue index 53a86f37c..353302737 100644 --- a/resources/assets/js/components/Profile.vue +++ b/resources/assets/js/components/Profile.vue @@ -187,11 +187,11 @@ - -
-
-

-

No posts yet

+
+
+

+

No posts yet

+
@@ -290,10 +290,10 @@ - + - +
@@ -960,12 +960,10 @@ return o; }, - followProfile($event) { + followProfile() { if($('body').hasClass('loggedIn') == false) { return; } - $event.target.setAttribute('disabled',''); - $event.target.blur(); axios.post('/i/follow', { item: this.profileId }).then(res => { @@ -979,7 +977,6 @@ this.profile.followers_count++; } this.relationship.following = !this.relationship.following; - $event.target.removeAttribute('disabled'); }).catch(err => { if(err.response.data.message) { swal('Error', err.response.data.message, 'error'); From 06078c7a85c687ff1098103fbaa688967b7b50a3 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 22 Aug 2019 21:49:20 -0600 Subject: [PATCH 4/7] Update SearchResults --- resources/assets/js/components/SearchResults.vue | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/resources/assets/js/components/SearchResults.vue b/resources/assets/js/components/SearchResults.vue index 2d54ec93b..13b0e1421 100644 --- a/resources/assets/js/components/SearchResults.vue +++ b/resources/assets/js/components/SearchResults.vue @@ -58,8 +58,8 @@

- - + +

@@ -140,12 +140,19 @@ export default { }) }, - followProfile(profile) { + followProfile(profile, index) { this.loading = true; axios.post('/i/follow', { item: profile.entity.id }).then(res => { - this.fetchSearchResults(); + if(profile.entity.local == true) { + this.fetchSearchResults(); + return; + } else { + this.loading = false; + this.results.profiles[index].entity.follow_request = true; + return; + } }).catch(err => { if(err.response.data.message) { swal('Error', err.response.data.message, 'error'); From 89ca18b14e1d8336c5308ab94e5278a8d653aa8a Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 22 Aug 2019 22:33:04 -0600 Subject: [PATCH 5/7] ComposeUI update --- .../Controllers/Api/AdminApiController.php | 2 + .../assets/js/components/ComposeClassic.vue | 523 ++++++++++++++++++ resources/assets/js/compose-classic.js | 4 + resources/views/status/compose.blade.php | 21 +- routes/web.php | 7 +- webpack.mix.js | 2 + 6 files changed, 549 insertions(+), 10 deletions(-) create mode 100644 resources/assets/js/components/ComposeClassic.vue create mode 100644 resources/assets/js/compose-classic.js diff --git a/app/Http/Controllers/Api/AdminApiController.php b/app/Http/Controllers/Api/AdminApiController.php index dfacf47ee..902b00536 100644 --- a/app/Http/Controllers/Api/AdminApiController.php +++ b/app/Http/Controllers/Api/AdminApiController.php @@ -68,6 +68,8 @@ class AdminApiController extends Controller public function moderateStatus(Request $request) { + abort(400, 'Unpublished API'); + return; $this->validate($request, [ 'type' => 'required|string|in:status,profile', 'id' => 'required|integer|min:1', diff --git a/resources/assets/js/components/ComposeClassic.vue b/resources/assets/js/components/ComposeClassic.vue new file mode 100644 index 000000000..df751cb71 --- /dev/null +++ b/resources/assets/js/components/ComposeClassic.vue @@ -0,0 +1,523 @@ + + + + \ No newline at end of file diff --git a/resources/assets/js/compose-classic.js b/resources/assets/js/compose-classic.js new file mode 100644 index 000000000..83cbc1174 --- /dev/null +++ b/resources/assets/js/compose-classic.js @@ -0,0 +1,4 @@ +Vue.component( + 'compose-classic', + require('./components/ComposeClassic.vue').default +); \ No newline at end of file diff --git a/resources/views/status/compose.blade.php b/resources/views/status/compose.blade.php index 8ced6f0df..fef86bc57 100644 --- a/resources/views/status/compose.blade.php +++ b/resources/views/status/compose.blade.php @@ -2,26 +2,31 @@ @section('content') -
+{{--
-

The Classic Compose UI has been retired.

+

Compose New Post

New Post

+
--}} + + @endsection @push('scripts') - + + @endpush \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index b04997e48..bd39084ed 100644 --- a/routes/web.php +++ b/routes/web.php @@ -102,13 +102,12 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact Route::get('status/{id}/replies', 'InternalApiController@statusReplies'); Route::post('moderator/action', 'InternalApiController@modAction'); Route::get('discover/categories', 'InternalApiController@discoverCategories'); - Route::post('status/compose', 'InternalApiController@composePost')->middleware('throttle:maxPostsPerHour,60')->middleware('throttle:maxPostsPerDay,1440'); Route::get('loops', 'DiscoverController@loopsApi'); Route::post('loops/watch', 'DiscoverController@loopWatch'); Route::get('discover/tag', 'DiscoverController@getHashtags'); }); Route::group(['prefix' => 'local'], function () { - Route::post('status/compose', 'InternalApiController@compose')->middleware('throttle:maxPostsPerHour,60')->middleware('throttle:maxPostsPerDay,1440'); + Route::post('status/compose', 'InternalApiController@composePost')->middleware('throttle:maxPostsPerHour,60')->middleware('throttle:maxPostsPerDay,1440'); Route::get('exp/rec', 'ApiController@userRecommendations'); Route::post('discover/tag/subscribe', 'HashtagFollowController@store')->middleware('throttle:maxHashtagFollowsPerHour,60')->middleware('throttle:maxHashtagFollowsPerDay,1440');; Route::get('discover/tag/list', 'HashtagFollowController@getTags'); @@ -122,6 +121,10 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact Route::post('collection/{id}/publish', 'CollectionController@publish')->middleware('throttle:maxCollectionsPerHour,60')->middleware('throttle:maxCollectionsPerDay,1440')->middleware('throttle:maxCollectionsPerMonth,43800'); Route::get('profile/collections/{id}', 'CollectionController@getUserCollections'); }); + Route::group(['prefix' => 'admin'], function () { + Route::post('moderate', 'Api\AdminApiController@moderate'); + }); + }); Route::get('discover/tags/{hashtag}', 'DiscoverController@showTags'); diff --git a/webpack.mix.js b/webpack.mix.js index 64ab467e4..faafe51b0 100644 --- a/webpack.mix.js +++ b/webpack.mix.js @@ -21,6 +21,7 @@ mix.js('resources/assets/js/app.js', 'public/js') .js('resources/assets/js/status.js', 'public/js') .js('resources/assets/js/timeline.js', 'public/js') .js('resources/assets/js/compose.js', 'public/js') +.js('resources/assets/js/compose-classic.js', 'public/js') .js('resources/assets/js/search.js', 'public/js') .js('resources/assets/js/developers.js', 'public/js') .js('resources/assets/js/loops.js', 'public/js') @@ -33,6 +34,7 @@ mix.js('resources/assets/js/app.js', 'public/js') .js('resources/assets/js/hashtag.js', 'public/js') .js('resources/assets/js/collectioncompose.js', 'public/js') .js('resources/assets/js/collections.js', 'public/js') +//.js('resources/assets/js/admin.js', 'public/js') .extract([ 'lodash', From c176f8cc117150cad7d17bc72821f40294258a96 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 22 Aug 2019 22:41:56 -0600 Subject: [PATCH 6/7] Update routes --- routes/web.php | 1 + 1 file changed, 1 insertion(+) diff --git a/routes/web.php b/routes/web.php index bd39084ed..141fac2dd 100644 --- a/routes/web.php +++ b/routes/web.php @@ -105,6 +105,7 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact Route::get('loops', 'DiscoverController@loopsApi'); Route::post('loops/watch', 'DiscoverController@loopWatch'); Route::get('discover/tag', 'DiscoverController@getHashtags'); + Route::post('status/compose', 'InternalApiController@composePost')->middleware('throttle:maxPostsPerHour,60')->middleware('throttle:maxPostsPerDay,1440'); }); Route::group(['prefix' => 'local'], function () { Route::post('status/compose', 'InternalApiController@composePost')->middleware('throttle:maxPostsPerHour,60')->middleware('throttle:maxPostsPerDay,1440'); From 0f0b3c2d058ec6c5e27189fc4eb8a2d45b240192 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Fri, 23 Aug 2019 13:03:43 -0600 Subject: [PATCH 7/7] Update SettingsController --- app/Http/Controllers/SettingsController.php | 4 ---- resources/views/settings/security.blade.php | 4 +--- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php index 2d5e69091..89f504079 100644 --- a/app/Http/Controllers/SettingsController.php +++ b/app/Http/Controllers/SettingsController.php @@ -95,7 +95,6 @@ class SettingsController extends Controller $user = Auth::user(); abort_if(!config('pixelfed.account_deletion'), 403); abort_if($user->is_admin, 403); - abort_if($user->created_at->gt(now()->subHours(12)), 403); return view('settings.remove.temporary'); } @@ -105,7 +104,6 @@ class SettingsController extends Controller $user = Auth::user(); abort_if(!config('pixelfed.account_deletion'), 403); abort_if($user->is_admin, 403); - abort_if($user->created_at->gt(now()->subHours(12)), 403); $profile = $user->profile; $user->status = 'disabled'; $profile->status = 'disabled'; @@ -120,7 +118,6 @@ class SettingsController extends Controller { $user = Auth::user(); abort_if($user->is_admin, 403); - abort_if($user->created_at->gt(now()->subDays(7)), 403); return view('settings.remove.permanent'); } @@ -132,7 +129,6 @@ class SettingsController extends Controller $user = Auth::user(); abort_if(!config('pixelfed.account_deletion'), 403); abort_if($user->is_admin, 403); - abort_if($user->created_at->gt(now()->subDays(7)), 403); $profile = $user->profile; $ts = Carbon::now()->addMonth(); $user->status = 'delete'; diff --git a/resources/views/settings/security.blade.php b/resources/views/settings/security.blade.php index c0acc4a7c..b0802d402 100644 --- a/resources/views/settings/security.blade.php +++ b/resources/views/settings/security.blade.php @@ -27,7 +27,7 @@ @include('settings.security.device-panel') - @if(config('pixelfed.account_deletion') && !$user->is_admin && $user->created_at->lt(now()->subHours(12))) + @if(config('pixelfed.account_deletion') && !$user->is_admin)

Danger Zone

- @if(!$user->is_admin && $user->created_at->lt(now()->subDays(7)) )
  • Delete this Account

    @@ -50,7 +49,6 @@ Delete
  • - @endif
    @endif