ticket close listener

This commit is contained in:
Dot-Rar 2020-02-26 19:55:07 +00:00
parent 323a378315
commit 8ca265837f
4 changed files with 15 additions and 0 deletions

View File

@ -57,6 +57,12 @@ func SendMessage(ctx *gin.Context) {
ticket := <-ticketChan
exists := ticket != table.Ticket{}
// Verify that the user has permission to be here
if ticket.Guild != guildId {
ctx.Redirect(302, fmt.Sprintf("/manage/%s/tickets", guildIdStr))
return
}
contentType := discord.ApplicationJson
if exists {

View File

@ -67,6 +67,12 @@ func TicketViewHandler(ctx *gin.Context) {
return
}
// Verify that the user has permission to be here
if ticket.Guild != guildId {
ctx.Redirect(302, fmt.Sprintf("/manage/%s/tickets", guildIdStr))
return
}
// Get messages
var messages []objects.Message
// We want to show users error messages so they can report them

View File

@ -53,6 +53,8 @@ func LogViewHandler(ctx *gin.Context) {
}
uuid := ctx.Param("uuid")
// Doesn't need guild = ticket.guild check, since we select where uuid=uuid and guild=guild
cdnUrl := table.GetCdnUrl(guildId, uuid)
if cdnUrl == "" {

View File

@ -55,6 +55,7 @@ func StartServer() {
router.GET("/manage/:id/tickets", manage.TicketListHandler)
router.GET("/manage/:id/tickets/view/:uuid", manage.TicketViewHandler)
router.POST("/manage/:id/tickets/view/:uuid/close", manage.TicketCloseHandler)
router.POST("/manage/:id/tickets/view/:uuid", manage.SendMessage)
router.GET("/webchat", manage.WebChatWs)