diff --git a/CHANGELOG.md b/CHANGELOG.md index 85fe6caf0..1d4a9e2fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ - Updated FederationController, return 404 for invalid webfinger addresses. Fixes ([#2647](https://github.com/pixelfed/pixelfed/issues/2647)). ([deb6f115](https://github.com/pixelfed/pixelfed/commit/deb6f115)) - Updated InboxPipeline, fail earlier for invalid public keys. Fixes ([#2648](https://github.com/pixelfed/pixelfed/issues/2648)). ([d1c5e9b8](https://github.com/pixelfed/pixelfed/commit/d1c5e9b8)) - Updated Status model, refactor liked and shared methods to fix cache invalidation bug. ([f05c3b66](https://github.com/pixelfed/pixelfed/commit/f05c3b66)) +- Updated Timeline component, add inline reports modal. ([e64b4bd3](https://github.com/pixelfed/pixelfed/commit/e64b4bd3)) - ([](https://github.com/pixelfed/pixelfed/commit/)) ## [v0.10.10 (2021-01-28)](https://github.com/pixelfed/pixelfed/compare/v0.10.9...v0.10.10) diff --git a/app/Http/Controllers/AdminController.php b/app/Http/Controllers/AdminController.php index 2b3f19916..aa434e8d8 100644 --- a/app/Http/Controllers/AdminController.php +++ b/app/Http/Controllers/AdminController.php @@ -66,17 +66,14 @@ class AdminController extends Controller public function reports(Request $request) { - $this->validate($request, [ - 'filter' => 'nullable|string|in:all,open,closed' - ]); - $filter = $request->input('filter'); + $filter = $request->input('filter') == 'closed' ? 'closed' : 'open'; $reports = Report::orderBy('created_at','desc') ->when($filter, function($q, $filter) { return $filter == 'open' ? $q->whereNull('admin_seen') : $q->whereNotNull('admin_seen'); }) - ->paginate(4); + ->paginate(6); return view('admin.reports.home', compact('reports')); } diff --git a/app/Http/Controllers/ReportController.php b/app/Http/Controllers/ReportController.php index 1eeb480a4..8791856ec 100644 --- a/app/Http/Controllers/ReportController.php +++ b/app/Http/Controllers/ReportController.php @@ -23,7 +23,7 @@ class ReportController extends Controller $this->validate($request, [ 'type' => 'required|alpha_dash', 'id' => 'required|integer|min:1', - ]); + ]); return view('report.form'); } @@ -86,11 +86,11 @@ class ReportController extends Controller public function formStore(Request $request) { $this->validate($request, [ - 'report' => 'required|alpha_dash', - 'type' => 'required|alpha_dash', - 'id' => 'required|integer|min:1', - 'msg' => 'nullable|string|max:150', - ]); + 'report' => 'required|alpha_dash', + 'type' => 'required|alpha_dash', + 'id' => 'required|integer|min:1', + 'msg' => 'nullable|string|max:150', + ]); $profile = Auth::user()->profile; $reportType = $request->input('report'); @@ -98,10 +98,26 @@ class ReportController extends Controller $object_type = $request->input('type'); $msg = $request->input('msg'); $object = null; - $types = ['spam', 'sensitive', 'abusive']; + $types = [ + // original 3 + 'spam', + 'sensitive', + 'abusive', + + // new + 'underage', + 'copyright', + 'impersonation', + 'scam', + 'terrorism' + ]; if (!in_array($reportType, $types)) { - return redirect('/timeline')->with('error', 'Invalid report type'); + if($request->wantsJson()) { + return abort(400, 'Invalid report type'); + } else { + return redirect('/timeline')->with('error', 'Invalid report type'); + } } switch ($object_type) { @@ -115,16 +131,28 @@ class ReportController extends Controller break; default: - return redirect('/timeline')->with('error', 'Invalid report type'); + if($request->wantsJson()) { + return abort(400, 'Invalid report type'); + } else { + return redirect('/timeline')->with('error', 'Invalid report type'); + } break; } if ($exists !== 0) { - return redirect('/timeline')->with('error', 'You have already reported this!'); + if($request->wantsJson()) { + return response()->json(200); + } else { + return redirect('/timeline')->with('error', 'You have already reported this!'); + } } if ($object->profile_id == $profile->id) { - return redirect('/timeline')->with('error', 'You cannot report your own content!'); + if($request->wantsJson()) { + return response()->json(200); + } else { + return redirect('/timeline')->with('error', 'You cannot report your own content!'); + } } $report = new Report(); @@ -134,9 +162,13 @@ class ReportController extends Controller $report->object_type = $object_type; $report->reported_profile_id = $object->profile_id; $report->type = $request->input('report'); - $report->message = $request->input('msg'); + $report->message = e($request->input('msg')); $report->save(); - return redirect('/timeline')->with('status', 'Report successfully sent!'); + if($request->wantsJson()) { + return response()->json(200); + } else { + return redirect('/timeline')->with('status', 'Report successfully sent!'); + } } } diff --git a/app/Util/Lexer/RestrictedNames.php b/app/Util/Lexer/RestrictedNames.php index 0309a6b9d..e2968036f 100644 --- a/app/Util/Lexer/RestrictedNames.php +++ b/app/Util/Lexer/RestrictedNames.php @@ -203,6 +203,10 @@ class RestrictedNames 'k', 'key', 'l', + 'lang', + 'language', + '_lang', + '_language', 'lab', 'labs', 'legal', @@ -255,6 +259,8 @@ class RestrictedNames 'quote', 'query', 'r', + 'redirect', + 'redirects', 'register', 'registers', 'review', diff --git a/public/js/activity.js b/public/js/activity.js index 4fdce4aea..3c93e0378 100644 Binary files a/public/js/activity.js and b/public/js/activity.js differ diff --git a/public/js/collectioncompose.js b/public/js/collectioncompose.js index ad65223e1..fca253b9a 100644 Binary files a/public/js/collectioncompose.js and b/public/js/collectioncompose.js differ diff --git a/public/js/collections.js b/public/js/collections.js index e15addb32..373da2b0c 100644 Binary files a/public/js/collections.js and b/public/js/collections.js differ diff --git a/public/js/components.js b/public/js/components.js index 94d407808..611acbe78 100644 Binary files a/public/js/components.js and b/public/js/components.js differ diff --git a/public/js/compose-classic.js b/public/js/compose-classic.js index 143ef3f48..19f28a7d7 100644 Binary files a/public/js/compose-classic.js and b/public/js/compose-classic.js differ diff --git a/public/js/compose.js b/public/js/compose.js index 6da03b4a7..eaf9b1b50 100644 Binary files a/public/js/compose.js and b/public/js/compose.js differ diff --git a/public/js/developers.js b/public/js/developers.js index 6e3921e04..971792301 100644 Binary files a/public/js/developers.js and b/public/js/developers.js differ diff --git a/public/js/direct.js b/public/js/direct.js index 8887f2dd7..a44c1b5bc 100644 Binary files a/public/js/direct.js and b/public/js/direct.js differ diff --git a/public/js/discover.js b/public/js/discover.js index c3ecedaf4..2850656fa 100644 Binary files a/public/js/discover.js and b/public/js/discover.js differ diff --git a/public/js/hashtag.js b/public/js/hashtag.js index 374b06b42..c50c68be7 100644 Binary files a/public/js/hashtag.js and b/public/js/hashtag.js differ diff --git a/public/js/loops.js b/public/js/loops.js index ca4e21ff7..8e36593ae 100644 Binary files a/public/js/loops.js and b/public/js/loops.js differ diff --git a/public/js/memoryprofile.js b/public/js/memoryprofile.js index 03cad8a2b..5e1299c2a 100644 Binary files a/public/js/memoryprofile.js and b/public/js/memoryprofile.js differ diff --git a/public/js/my2020.js b/public/js/my2020.js index 012bf3c58..0d23717f5 100644 Binary files a/public/js/my2020.js and b/public/js/my2020.js differ diff --git a/public/js/profile-directory.js b/public/js/profile-directory.js index 088c14b9f..ec442eacf 100644 Binary files a/public/js/profile-directory.js and b/public/js/profile-directory.js differ diff --git a/public/js/profile.js b/public/js/profile.js index 093fe50cc..e7a1361d3 100644 Binary files a/public/js/profile.js and b/public/js/profile.js differ diff --git a/public/js/rempos.js b/public/js/rempos.js index 951e773bf..a5cd7c1ba 100644 Binary files a/public/js/rempos.js and b/public/js/rempos.js differ diff --git a/public/js/rempro.js b/public/js/rempro.js index e1263debb..dec7b851c 100644 Binary files a/public/js/rempro.js and b/public/js/rempro.js differ diff --git a/public/js/search.js b/public/js/search.js index adffbe81a..d0c96a5d6 100644 Binary files a/public/js/search.js and b/public/js/search.js differ diff --git a/public/js/status.js b/public/js/status.js index 7cee12597..78d2c8efe 100644 Binary files a/public/js/status.js and b/public/js/status.js differ diff --git a/public/js/story-compose.js b/public/js/story-compose.js index 4e8dcfd16..1fcbde913 100644 Binary files a/public/js/story-compose.js and b/public/js/story-compose.js differ diff --git a/public/js/timeline.js b/public/js/timeline.js index 472cfa91e..f6c7c2080 100644 Binary files a/public/js/timeline.js and b/public/js/timeline.js differ diff --git a/public/js/vendor.js b/public/js/vendor.js index b7bebbf2f..d76fb694c 100644 Binary files a/public/js/vendor.js and b/public/js/vendor.js differ diff --git a/public/mix-manifest.json b/public/mix-manifest.json index cd79457ab..167da845a 100644 Binary files a/public/mix-manifest.json and b/public/mix-manifest.json differ diff --git a/resources/assets/js/components.js b/resources/assets/js/components.js index d2e79dc59..2ed522818 100644 --- a/resources/assets/js/components.js +++ b/resources/assets/js/components.js @@ -27,8 +27,8 @@ pixelfed.readmore = () => { el.readmore({ collapsedHeight: 45, heightMargin: 48, - moreLink: 'Read more ...', - lessLink: 'Hide', + moreLink: 'Show more', + lessLink: 'Show less', }); }); }; diff --git a/resources/assets/js/components/PostComponent.vue b/resources/assets/js/components/PostComponent.vue index 83418090b..7525db9c9 100644 --- a/resources/assets/js/components/PostComponent.vue +++ b/resources/assets/js/components/PostComponent.vue @@ -601,17 +601,17 @@ size="sm" body-class="list-group-flush p-0 rounded">
-
Unfollow
-
Follow
+
Embed
Copy Link
{{ showComments ? 'Disable' : 'Enable'}} Comments
Edit -
ModTools
-
Block
-
Unblock
- Report -
Delete
+
Moderation Tools
+
Block
+
Unblock
+ Report +
Delete
Cancel
diff --git a/resources/assets/js/components/Timeline.vue b/resources/assets/js/components/Timeline.vue index a14f4cfb0..c3dc423d0 100644 --- a/resources/assets/js/components/Timeline.vue +++ b/resources/assets/js/components/Timeline.vue @@ -469,221 +469,323 @@ - -
-
Report
-
Unfollow
-
Follow
-
Go to post
-
Embed
- -
Copy Link
-
Moderation Tools
-
Delete
-
Cancel
-
-
- -
-
Unlist from Timelines
-
Remove Content Warning
-
Add Content Warning
-
Cancel
-
-
- -
Email
-
Facebook
-
Mastodon
-
Pinterest
-
Pixelfed
-
Twitter
-
VK
-
Cancel
-
- -
-
- -
-
-
- - -
-
- - -
-
- - -
-
-
- -

By using this embed, you agree to our Terms of Use

-
-
- -
- lightbox media -
-
- -
- -
- -
-
+ +
+ +
View Post
+ +
Share
+
Moderation Tools
+
Report
+
Delete
+
Cancel
+
+
+ +
+

+

Moderation Tools
+
Select one of the following options
+

+
Unlist from Timelines
+
Remove Content Warning
+
Add Content Warning
+ +
Cancel
+
+
+ +
+

+

Moderation Tools
+
Select one of the following options
+

+
Unlist Posts
+
Moderation Log
+
Cancel
+
+
+ +
Copy Link
+
Embed
+ +
Cancel
+
+
- - {{replyText.length > config.uploader.max_caption_length ? config.uploader.max_caption_length - replyText.length : replyText.length}}/{{config.uploader.max_caption_length}} - -
-
-
- - +
+
- - +
+
+ + +
+
+ + +
+
+ + +
+
+
+ +

By using this embed, you agree to our Terms of Use

+
+ + +

+

Report
+
Select one of the following options
+

+
+
Spam
+
Sensitive Content
+
Abusive or Harmful
+
Other
+ +
Cancel
+
+
+ +

+

Report
+
Select one of the following options
+

+
+
Underage Account
+
Copyright Infringement
+
Impersonation
+
Scam or Fraud
+ + + +
Cancel
+
+
+ +
+
{{ this.confirmModalTitle }}
+
+
+ + +
+
+ +
+ lightbox media +
+
+ +
+ + +
+ +
+
+
+ + {{replyText.length > config.uploader.max_caption_length ? config.uploader.max_caption_length - replyText.length : replyText.length}}/{{config.uploader.max_caption_length}} + +
+
+
+ + +
+ + +
-
-
+ + + +
diff --git a/resources/views/admin/reports/home.blade.php b/resources/views/admin/reports/home.blade.php index e22ee0c47..e3c203192 100644 --- a/resources/views/admin/reports/home.blade.php +++ b/resources/views/admin/reports/home.blade.php @@ -1,108 +1,90 @@ @extends('admin.partial.template-full') @section('section') - -@php($ai = App\AccountInterstitial::whereNotNull('appeal_requested_at')->whereNull('appeal_handled_at')->count()) -@php($spam = App\AccountInterstitial::whereType('post.autospam')->whereNull('appeal_handled_at')->count()) -@if($ai || $spam) - -@endif - @if($reports->count()) -
-
- @foreach($reports as $report) -
-
-
-
- -
-
-

{{$report->type}}

- @if($report->reporter && $report->status) -

{{$report->reporter->username}} reported this post

- @else -

- @if(!$report->reporter) - Deleted user - @else - {{$report->reporter->username}} - @endif - reported this - @if(!$report->status) - deleted post - @else - post - @endif +

+

Reports

+
+ @if(request()->has('filter') && request()->filter == 'closed') + + View Open Reports + + @else + + View Closed Reports + + @endif +
+
+ @php($ai = App\AccountInterstitial::whereNotNull('appeal_requested_at')->whereNull('appeal_handled_at')->count()) + @php($spam = App\AccountInterstitial::whereType('post.autospam')->whereNull('appeal_handled_at')->count()) + @if($ai || $spam) + + @endif + @if($reports->count()) +
+
+
+ @foreach($reports as $report) +
+
+
+ + + +
+

{{$report->type}}

+ @if($report->reporter && $report->status) +

{{$report->reporter->username}} reported this post

+ @else +

+ @if(!$report->reporter) + Deleted user + @else + {{$report->reporter->username}} + @endif + reported this + @if(!$report->status) + deleted post + @else + post + @endif -

+

- @endif -
-
- {{-- @if($report->admin_seen == null) - - @endif - --}} - @if($report->status) - VIEW - @endif -
-
-
-
- @endforeach -
-
- @else -
-
-

No reports found

-
-
- @endif + @endif +
+
+ @if($report->status) + + View + + @endif +
+
+
+
+ @endforeach +
+
+
+ @else +
+
+

No reports found

+
+
+ @endif -
- {{$reports->appends(['layout'=>request()->layout, 'filter' => request()->filter])->links()}} -
+
+ {{$reports->appends(['layout'=>request()->layout, 'filter' => request()->filter])->links()}} +
@endsection - -@push('styles') - -@endpush - -@push('scripts') - -@endpush \ No newline at end of file diff --git a/resources/views/admin/reports/show.blade.php b/resources/views/admin/reports/show.blade.php index 521c88cef..e4b02dc61 100644 --- a/resources/views/admin/reports/show.blade.php +++ b/resources/views/admin/reports/show.blade.php @@ -1,167 +1,111 @@ @extends('admin.partial.template-full') @section('section') -
-

Report #{{$report->id}} - {{ucfirst($report->type)}}

-
+
+
+

+ Report #{{$report->id}} - + {{ucfirst($report->type)}} +

+

+ Reported {{$report->created_at->diffForHumans()}} by @{{$report->reporter->username}}. +

+
+
-
-
-
Reported: {{$report->reported()->url()}}
-
Reported by: {{$report->reporter->username}}
-

- Message: - {{$report->message ?? 'No message provided.'}} -

+
+
+
+ @if($report->status->media()->count()) + + @endif +
+
+ @if($report->status->caption) +

+ {{$report->status->media()->count() ? 'Caption' : 'Comment'}}: {{$report->status->caption}} +

+ @endif +

+ Like Count: {{$report->status->likes_count}} +

+

+ Share Count: {{$report->status->reblogs_count}} +

+

+ Timestamp: {{now()->parse($report->status->created_at)->format('r')}} +

+

+ URL: {{$report->status->url()}} +

+
+
+
+
+
+ + + - @if(!$report->admin_seen) - Ignore - {{-- Request Mod Feedback --}} - Add CW - Unlist/Hide -{{-- Delete - Shadowban User - Ban User --}} - @else -

Resolved {{$report->admin_seen->diffForHumans()}}

- @endif -
-
+
+
+ @{{$report->reportedUser->username}} stats +
+
+

+ Total Reports: {{App\Report::whereReportedProfileId($report->reportedUser->id)->count()}} +

+

+ Total Warnings: {{App\AccountInterstitial::whereUserId($report->reportedUser->user_id)->count()}} +

+

+ Status Count: {{$report->reportedUser->status_count}} +

+

+ Follower Count: {{$report->reportedUser->followers_count}} +

+

+ Joined: {{$report->reportedUser->created_at->diffForHumans(null, null, false)}} +

+
+
-
-
-
-
- -
-
-
-
-
-
-
-
- Reporter -
-
    -
  • Joined {{$report->reporter->created_at->diffForHumans()}}
  • -
  • Total Reports: {{App\Report::whereProfileId($report->reporter->id)->count()}}
  • -
  • Total Reported: {{App\Report::whereReportedProfileId($report->reporter->id)->count()}}
  • -
-
-
-
-
-
- Reported -
-
    -
  • Joined {{$report->reportedUser->created_at->diffForHumans()}}
  • -
  • Total Reports: {{App\Report::whereProfileId($report->reportedUser->id)->count()}}
  • -
  • Total Reported: {{App\Report::whereReportedProfileId($report->reportedUser->id)->count()}}
  • -
-
-
-
-
-
-
-
+
+
+ @{{$report->reporter->username}} stats +
+
+

+ Status Count: {{$report->reporter->status_count}} +

+

+ Follower Count: {{$report->reporter->followers_count}} +

+

+ Joined: {{$report->reporter->created_at->diffForHumans(null, null, false)}} +

+
+
-{{--
-
-
-
- -
-
-
-
-
-

admin ignored this report. 2m

-
-
-

admin ignored this report. 2m

-
-
-

admin ignored this report. 2m

-
-
-
-
-
--}} - - -{{--
-
-
-
- -
-
-
-
-
-
-
-
- [username]: {{str_limit('Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod.', 150)}} 2m -
-
-
-
-
-
- me: {{str_limit('Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod.', 150)}} 2m -
-
-
-
-
-
- me: {{str_limit('Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod.', 150)}} 2m -
-
-
-
-
- -
-
-
--}} +
+
@endsection - + @push('scripts') @endpush \ No newline at end of file diff --git a/routes/api.php b/routes/api.php index a2ca38f5c..5bb8144fb 100644 --- a/routes/api.php +++ b/routes/api.php @@ -2,7 +2,7 @@ use Illuminate\Http\Request; -$middleware = ['auth:api','twofactor','validemail','throttle:60,1','interstitial']; +$middleware = ['auth:api','twofactor','validemail','interstitial']; Route::post('/f/inbox', 'FederationController@sharedInbox'); Route::post('/users/{username}/inbox', 'FederationController@userInbox');