Merge pull request #3666 from pixelfed/staging

Staging
pull/3669/head
daniel 2022-09-25 04:10:10 -06:00 zatwierdzone przez GitHub
commit 310025ad90
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 22 dodań i 11 usunięć

Wyświetl plik

@ -314,16 +314,20 @@ class ApiV1Dot1Controller extends Controller
$user = $request->user();
abort_if(!$user, 403);
abort_if($user->status != null, 403);
$from = config('mail.from.address');
$emailVerifications = EmailVerification::whereUserId($user->id)
->orderByDesc('id')
->where('created_at', '>', now()->subDays(14))
->limit(10)
->get()
->map(function($mail) {
->map(function($mail) use($user, $from) {
return [
'type' => 'Email Verification',
'created_at' => $mail->created_at->format('c')
'subject' => 'Confirm Email',
'to_address' => $user->email,
'from_address' => $from,
'created_at' => str_replace('@', 'at', $mail->created_at->format('M j, Y @ g:i:s A'))
];
})
->toArray();
@ -334,10 +338,13 @@ class ApiV1Dot1Controller extends Controller
->orderByDesc('created_at')
->limit(10)
->get()
->map(function($mail) {
->map(function($mail) use($user, $from) {
return [
'type' => 'Password Reset',
'created_at' => now()->parse($mail->created_at)->format('c')
'subject' => 'Reset Password Notification',
'to_address' => $user->email,
'from_address' => $from,
'created_at' => str_replace('@', 'at', now()->parse($mail->created_at)->format('M j, Y @ g:i:s A'))
];
})
->toArray();
@ -348,19 +355,23 @@ class ApiV1Dot1Controller extends Controller
->orderByDesc('created_at')
->limit(10)
->get()
->map(function($mail) {
->map(function($mail) use($user, $from) {
return [
'type' => 'Password Change',
'created_at' => $mail->created_at
'subject' => 'Password Change',
'to_address' => $user->email,
'from_address' => $from,
'created_at' => str_replace('@', 'at', now()->parse($mail->created_at)->format('M j, Y @ g:i:s A'))
];
})
->toArray();
$res = [
'email_verifications' => $emailVerifications,
'password_resets' => $passwordResets,
'password_changes' => $passwordChanges
];
$res = collect([])
->merge($emailVerifications)
->merge($passwordResets)
->merge($passwordChanges)
->sortByDesc('created_at')
->values();
return $this->json($res);
}