report = $report; } /** * Get the message envelope. * * @return \Illuminate\Mail\Mailables\Envelope */ public function envelope() { $type = $this->report->type; $id = $this->report->id; $object_type = last(explode('\\', $this->report->object_type)); return new Envelope( subject: '['.config('pixelfed.domain.app').'] '.$object_type.' Report (Ref: report-'.$id.'-'.$type.')', ); } /** * Get the message content definition. * * @return \Illuminate\Mail\Mailables\Content */ public function content() { $report = $this->report; $object_type = last(explode('\\', $this->report->object_type)); $reporter = AccountService::get($report->profile_id, true); $reported = AccountService::get($report->reported_profile_id, true); $title = 'New '.$object_type.' Report (#'.$report->id.')'; $reportUrl = url('/i/admin/reports/show/'.$report->id.'?ref=email'); $data = [ 'report' => $report, 'object_type' => $object_type, 'title' => $title, 'reporter' => $reporter, 'reported' => $reported, 'url' => $reportUrl, 'message' => 'You have a new moderation report.', ]; if ($object_type === 'Status') { $data['reported_status'] = StatusService::get($report['object_id'], false); if ($reporter && $reported) { $data['message'] = '@'. $reporter['acct'].' reported a post by @'.$reported['acct'].' as '.$report->type.'.'; } } if ($object_type === 'Profile') { if ($reporter && $reported) { $data['message'] = '@'. $reporter['acct'].' reported @'.$reported['acct'].'\'s profile as '.$report->type.'.'; } } return new Content( markdown: 'emails.admin.new_report', with: $data ); } /** * Get the attachments for the message. * * @return array */ public function attachments() { return []; } }