fix(Scripts/Command): ticket comment should allow input (#17891)

fix(Scripts/Command): gm comment should allow input

* closes https://github.com/azerothcore/azerothcore-wotlk/issues/17877
This commit is contained in:
Kitzunu
2023-11-29 13:38:03 +01:00
committed by GitHub
parent 65e25bd7b9
commit e8336919f9

View File

@@ -158,10 +158,9 @@ public:
return true;
}
static bool HandleGMTicketCommentCommand(ChatHandler* handler, uint32 ticketId)
static bool HandleGMTicketCommentCommand(ChatHandler* handler, uint32 ticketId, Tail comment)
{
char* comment = strtok(nullptr, "\n");
if (!comment)
if (comment.empty())
return false;
GmTicket* ticket = sTicketMgr->GetTicket(ticketId);
@@ -180,14 +179,14 @@ public:
}
CharacterDatabaseTransaction trans = CharacterDatabaseTransaction(nullptr);
ticket->SetComment(comment);
ticket->SetComment(comment.data());
ticket->SaveToDB(trans);
sTicketMgr->UpdateLastChange();
std::string const assignedName = ticket->GetAssignedToName();
std::string msg = ticket->FormatMessageString(*handler, assignedName.empty() ? nullptr : assignedName.c_str(), nullptr, nullptr, nullptr);
msg += handler->PGetParseString(LANG_COMMAND_TICKETLISTADDCOMMENT, player ? player->GetName().c_str() : "Console", comment);
msg += handler->PGetParseString(LANG_COMMAND_TICKETLISTADDCOMMENT, player ? player->GetName().c_str() : "Console", comment.data());
handler->SendGlobalGMSysMessage(msg.c_str());
return true;