Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleaning up support emails #134

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions app/Http/Controllers/HelpdeskController.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,7 @@ public function postNew(Request $request) {
$emails[] = "vat" . strtolower(str_replace("US", "usa", $user->role)) . "@vatusa.net";
}
} else if ($ticket->facility == "ZAE") {
$emails[] = "[email protected]";
$emails[] = "[email protected]";
$emails[] = "[email protected]";
} else {
$fac = Facility::find($ticket->facility);
if (!$fac) {
Expand Down Expand Up @@ -318,7 +317,7 @@ public function postTicket(Request $request, $id) {

$emails = [];
//$emails[] = "[email protected]"; // During debug period
$emails[] = Auth::user()->email;
//$emails[] = Auth::user()->email; //Removing Auth'd user from email list... We don't need the person who posted the reply to be notified
if (Auth::user()->cid != $ticket->cid) {
$emails[] = $ticket->submitter->email;
}
Expand All @@ -332,7 +331,7 @@ public function postTicket(Request $request, $id) {
$emails[] = "vat" . strtolower(str_replace("US", "usa", $role->role)) . "@vatusa.net";
}
} else if ($ticket->facility == "ZAE") {
$emails[] = "vatusa3@vatusa.net";
$emails[] = "training@vatusa.net";
} else {
$fac = Facility::find($ticket->facility);
if (!$fac) {
Expand All @@ -356,7 +355,7 @@ public function postTicket(Request $request, $id) {
}
$emails[] = $u->email;
}

EmailHelper::sendSupportEmail(array_unique($emails), $ticket->id, "New Reply", "emails.help.newreply",
["ticket" => $ticket, "reply" => $reply]);

Expand Down Expand Up @@ -441,9 +440,11 @@ public function postTicketAjax(Request $request, $id) {
Auth::user()->fullname() . " (" . Auth::user()->cid . ") assigned the ticket to " .
$user->fullname() . " (" . $user->cid . ").";
$history->save();

EmailHelper::sendSupportEmail($user->email, $id, "Ticket Assigned to You", "emails.help.assigned",
["ticket" => $ticket]);
//If the user who is assigning is also the user being assigned to, do not send the email (self-assignment)
if(Auth::user()->cid != $user->cid){
EmailHelper::sendSupportEmail($user->email, $id, "Ticket Assigned to You", "emails.help.assigned",
["ticket" => $ticket]);
}
}
}
if (isset($_POST['note'])) {
Expand Down