mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-17 20:11:27 +00:00
Update AdminController
This commit is contained in:
parent
afc6db143a
commit
0c6e885b6f
1 changed files with 33 additions and 2 deletions
|
@ -246,7 +246,12 @@ class AdminController extends Controller
|
|||
public function messagesShow(Request $request, $id)
|
||||
{
|
||||
$message = Contact::findOrFail($id);
|
||||
$user = User::whereNull('status')->findOrFail($message->user_id);
|
||||
$user = User::whereNull('status')->find($message->user_id);
|
||||
if(!$user) {
|
||||
$message->read_at = now();
|
||||
$message->save();
|
||||
return redirect('/i/admin/messages/home')->with('status', 'Redirected from message sent from a deleted account');
|
||||
}
|
||||
|
||||
return view('admin.messages.show', compact('message'));
|
||||
}
|
||||
|
@ -257,7 +262,17 @@ class AdminController extends Controller
|
|||
'message' => 'required|string|min:1|max:500',
|
||||
]);
|
||||
|
||||
if(config('mail.default') === 'log') {
|
||||
return redirect('/i/admin/messages/home')->with('error', 'Mail driver not configured, please setup before you can sent email.');
|
||||
}
|
||||
|
||||
$message = Contact::whereNull('responded_at')->findOrFail($id);
|
||||
$user = User::whereNull('status')->find($message->user_id);
|
||||
if(!$user) {
|
||||
$message->read_at = now();
|
||||
$message->save();
|
||||
return redirect('/i/admin/messages/home')->with('status', 'Redirected from message sent from a deleted account');
|
||||
}
|
||||
$message->response = $request->input('message');
|
||||
$message->read_at = now();
|
||||
$message->responded_at = now();
|
||||
|
@ -274,8 +289,17 @@ class AdminController extends Controller
|
|||
'message' => 'required|string|min:1|max:500',
|
||||
]);
|
||||
|
||||
$message = Contact::whereNull('read_at')->findOrFail($id);
|
||||
if(config('mail.default') === 'log') {
|
||||
return redirect('/i/admin/messages/home')->with('error', 'Mail driver not configured, please setup before you can sent email.');
|
||||
}
|
||||
|
||||
$message = Contact::whereNull('read_at')->findOrFail($id);
|
||||
$user = User::whereNull('status')->find($message->user_id);
|
||||
if(!$user) {
|
||||
$message->read_at = now();
|
||||
$message->save();
|
||||
return redirect('/i/admin/messages/home')->with('error', 'Redirected from message sent from a deleted account');
|
||||
}
|
||||
return new AdminMessageResponse($message);
|
||||
}
|
||||
|
||||
|
@ -286,6 +310,13 @@ class AdminController extends Controller
|
|||
]);
|
||||
$id = $request->input('id');
|
||||
$message = Contact::findOrFail($id);
|
||||
|
||||
$user = User::whereNull('status')->find($message->user_id);
|
||||
if(!$user) {
|
||||
$message->read_at = now();
|
||||
$message->save();
|
||||
return redirect('/i/admin/messages/home')->with('error', 'Redirected from message sent from a deleted account');
|
||||
}
|
||||
if ($message->read_at) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue