Merge pull request #20213 from paultrudel/insertDocument-response-fix

refactor(bbb-web): Add message key to insertDocument responses
This commit is contained in:
Anton Georgiev 2024-05-13 10:40:00 -04:00 committed by GitHub
commit 5bc104fbf8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 5 deletions

View File

@ -218,12 +218,13 @@ public class ResponseBuilder {
return xmlText.toString(); return xmlText.toString();
} }
public String buildInsertDocumentResponse(String message, String returnCode) { public String buildInsertDocumentResponse(String messageKey, String message, String returnCode) {
StringWriter xmlText = new StringWriter(); StringWriter xmlText = new StringWriter();
Map<String, Object> data = new HashMap<String, Object>(); Map<String, Object> data = new HashMap<String, Object>();
data.put("returnCode", returnCode); data.put("returnCode", returnCode);
data.put("messageKey", messageKey);
data.put("message", message); data.put("message", message);
processData(getTemplate("insert-document.ftlx"), data, xmlText); processData(getTemplate("insert-document.ftlx"), data, xmlText);

View File

@ -1129,14 +1129,14 @@ class ApiController {
if (uploadDocuments(meeting, true)) { if (uploadDocuments(meeting, true)) {
withFormat { withFormat {
xml { xml {
render(text: responseBuilder.buildInsertDocumentResponse("Presentation is being uploaded", RESP_CODE_SUCCESS) render(text: responseBuilder.buildInsertDocumentResponse("documentInserted", "Presentation is being uploaded", RESP_CODE_SUCCESS)
, contentType: "text/xml") , contentType: "text/xml")
} }
} }
} else if (meetingService.isMeetingWithDisabledPresentation(meetingId)) { } else if (meetingService.isMeetingWithDisabledPresentation(meeting.getInternalId())) {
withFormat { withFormat {
xml { xml {
render(text: responseBuilder.buildInsertDocumentResponse("Presentation feature is disabled, ignoring.", render(text: responseBuilder.buildInsertDocumentResponse("presentationDisabled", "Presentation feature is disabled, ignoring.",
RESP_CODE_FAILED), contentType: "text/xml") RESP_CODE_FAILED), contentType: "text/xml")
} }
} }
@ -1145,7 +1145,7 @@ class ApiController {
log.warn("Meeting with externalID ${externalMeetingId} doesn't exist.") log.warn("Meeting with externalID ${externalMeetingId} doesn't exist.")
withFormat { withFormat {
xml { xml {
render(text: responseBuilder.buildInsertDocumentResponse( render(text: responseBuilder.buildInsertDocumentResponse("notFound",
"Meeting with id [${externalMeetingId}] not found.", RESP_CODE_FAILED), "Meeting with id [${externalMeetingId}] not found.", RESP_CODE_FAILED),
contentType: "text/xml") contentType: "text/xml")
} }

View File

@ -3,6 +3,7 @@
<response> <response>
<#-- Where code is a 'SUCCESS' or 'FAILED' String --> <#-- Where code is a 'SUCCESS' or 'FAILED' String -->
<returncode>${returnCode}</returncode> <returncode>${returnCode}</returncode>
<messageKey>${messageKey}</messageKey>
<message>${message}</message> <message>${message}</message>
</response> </response>
</#compress> </#compress>