Skip to content

Commit

Permalink
[issue15565] - Fixed current attribute not being respected
Browse files Browse the repository at this point in the history
  • Loading branch information
GuiLeme committed Aug 19, 2022
1 parent 14d80b4 commit 8ee9343
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
3 changes: 3 additions & 0 deletions bigbluebutton-web/grails-app/conf/bigbluebutton.properties
Original file line number Diff line number Diff line change
Expand Up @@ -419,3 +419,6 @@ endWhenNoModeratorDelayInMinutes=1

# Allow endpoint with current BigBlueButton version
allowRevealOfBBBVersion=false

# Allows the insertDocument to change the current presentation.
allowInsertDocumentChangeCurrent=true
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class ApiController {
HTML5LoadBalancingService html5LoadBalancingService
ResponseBuilder responseBuilder = initResponseBuilder()
ValidationService validationService
Boolean allowInsertDocumentChangeCurrent = grailsApplication.config.getProperty("allowInsertDocumentChangeCurrent")

def initResponseBuilder = {
String protocol = this.getClass().getResource("").getProtocol();
Expand Down Expand Up @@ -1327,7 +1328,11 @@ class ApiController {
requestBody = StringUtils.isEmpty(requestBody) ? null : requestBody;
Boolean isDefaultPresentationCurrent = false;
def listOfPresentation = []
def presentationListHasCurrent = false

// This part of the code is responsible for organize the presentations in a certain order
// It selects the one that has the current=true, and put it in the 0th place.
// Afterwards, the 0th presentation is going to be uploaded first, which spares processing time
if (requestBody == null) {
if (isFromInsertAPI){
log.warn("Insert Document API called without a payload - ignoring")
Expand Down Expand Up @@ -1363,6 +1368,7 @@ class ApiController {
}
}
}
presentationListHasCurrent = hasCurrent;
}

listOfPresentation.eachWithIndex { document, index ->
Expand All @@ -1382,10 +1388,16 @@ class ApiController {
}
// The array has already been processed to let the first be the current. (This way it is
// ensured that only one document is current)
if (index == 0) {
if (index == 0 && isFromInsertAPI) {
if (presentationListHasCurrent) {
isCurrent = true
}
} else if (index == 0 && !isFromInsertAPI){
isCurrent = true
}
isCurrent = isCurrent && !isFromInsertAPI
if (isFromInsertAPI && allowInsertDocumentChangeCurrent != null) {
isCurrent = isCurrent && allowInsertDocumentChangeCurrent
}
// Verifying whether the document is a base64 encoded or a url to download.
if (!StringUtils.isEmpty(document.@url.toString())) {
def fileName;
Expand Down

0 comments on commit 8ee9343

Please sign in to comment.