-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Support): auto-close inactive tickets
- Loading branch information
1 parent
8fd3005
commit b02a94e
Showing
11 changed files
with
319 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { Button, Icon } from "semantic-ui-react"; | ||
import { SupportTicket } from "../../types"; | ||
import { format as formatDate } from "date-fns"; | ||
|
||
interface TicketAutoCloseWarningProps { | ||
ticket: SupportTicket; | ||
onDisableAutoClose: () => void; | ||
} | ||
|
||
const TicketAutoCloseWarning: React.FC<TicketAutoCloseWarningProps> = ({ | ||
ticket, | ||
onDisableAutoClose, | ||
}) => { | ||
return ( | ||
<div className="flex flex-col border rounded-md p-4 shadow-md bg-white mb-4"> | ||
<div className="flex flex-row items-center mb-2"> | ||
<Icon name="warning sign" color="yellow" size="big" /> | ||
<p className="text-lg ml-2"> | ||
<strong>Notice: </strong> | ||
Ticket will be automatically closed on{" "} | ||
{formatDate( | ||
new Date(ticket.autoCloseDate?.toString() ?? ""), | ||
"MM/dd/yyyy hh:mm aa" | ||
)}{" "} | ||
if no new comments are added. | ||
</p> | ||
</div> | ||
<Button color="blue" onClick={onDisableAutoClose}> | ||
Disable Auto Close | ||
</Button> | ||
</div> | ||
); | ||
}; | ||
|
||
export default TicketAutoCloseWarning; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -895,6 +895,32 @@ const sendNewInternalTicketMessageAssignedStaffNotification = (recipientAddresse | |
}); | ||
}; | ||
|
||
/** | ||
* Sends a warning that a ticket will be closed in 3 days if no response is received. | ||
* @param {string[]} recipientAddresses - the email addresses to send the notification to | ||
* @param {string} ticketID - the ticket's uuid | ||
* @param {string} subject - the ticket's subject | ||
* @param {string} params - any URL parameters to append to the ticket URL | ||
*/ | ||
const sendSupportTicketAutoCloseWarning = (recipientAddresses, ticketID, subject, params) => { | ||
return mailgun.messages.create(process.env.MAILGUN_DOMAIN, { | ||
from: 'LibreTexts Support <[email protected]>', | ||
to: recipientAddresses, | ||
subject: `Ticket Will Automatically Close Soon (ID #${ticketID.slice(-7)})`, | ||
html: ` | ||
<p>Hi,</p> | ||
<p>We're writing to let you know that a support ticket you have subscribed to will automatically close for inactivity in three days from this notification: "${subject}"</p> | ||
<br /> | ||
<p>If you would like to keep the ticket open, please respond to the ticket at <a href="https://commons.libretexts.org/support/ticket/${ticketID}${params ? `?${params}` : ''}" target="_blank" rel="noopener noreferrer">https://commons.libretexts.org/support/ticket/${ticketID}${params ? `?${params}` : ''}</a>.</p> | ||
<br /> | ||
<p>Otherwise, no action is required. | ||
<p>Sincerely,</p> | ||
<p>The LibreTexts team</p> | ||
${autoGenNoticeHTML} | ||
`, | ||
}); | ||
}; | ||
|
||
const sendZIPFileReadyNotification = (url, recipientAddress) => { | ||
return mailgun.messages.create(process.env.MAILGUN_DOMAIN, { | ||
from: 'LibreTexts Support <[email protected]>', | ||
|
@@ -980,5 +1006,6 @@ export default { | |
sendNewTicketMessageAssignedStaffNotification, | ||
sendNewInternalTicketMessageAssignedStaffNotification, | ||
sendSupportTicketAssignedNotification, | ||
sendSupportTicketAutoCloseWarning, | ||
sendZIPFileReadyNotification | ||
} |
Oops, something went wrong.