Merge pull request #4186 from ritzalam/fix-presentation-late-joiner

- fix issue where late joiners displays the wrong slide
This commit is contained in:
Richard Alam 2017-08-01 17:52:33 -04:00 committed by GitHub
commit fd901bafa9
15 changed files with 45 additions and 41 deletions

View File

@ -56,11 +56,10 @@ class PresentationModel {
})
presentations.get(presId) match {
case Some(pres) => {
case Some(pres) =>
val cp = pres.copy(current = true)
savePresentation(cp)
Some(cp)
}
case None => None
}
}
@ -98,17 +97,14 @@ class PresentationModel {
private def makePageCurrent(pres: Presentation, pageId: String): Option[Presentation] = {
pres.pages.get(pageId) match {
case Some(newCurPage) => {
case Some(newCurPage) =>
val page = newCurPage.copy(current = true)
val newPages = pres.pages + (page.id -> page)
val newPres = pres.copy(pages = newPages)
Some(newPres)
// println("Making page[" + page.id + "] current[" + page.current + "]")
}
case None => {
// println("Could not find page[" + page + "] in presentation [" + pres.id + "]")
case None =>
None
}
}
}

View File

@ -18,7 +18,5 @@ trait NewPresentationMsgHdlr {
val event = NewPresentationEvtMsg(header, body)
val msgEvent = BbbCommonEnvCoreMsg(envelope, event)
outGW.send(msgEvent)
//record(event)
}
}

View File

@ -29,6 +29,11 @@ class PresentationApp2x(
presentations.foreach(presentation => {
liveMeeting.presModel.addPresentation(presentation)
})
liveMeeting.presModel.getCurrentPresentation() match {
case Some(p) => // do nothing
case None => setCurrentPresentation(presentations.head.id)
}
}
def presentationConversionCompleted(presentation: Presentation) {

View File

@ -20,8 +20,6 @@ trait PresentationConversionCompletedPubMsgHdlr {
val event = PresentationConversionCompletedEvtMsg(header, body)
val msgEvent = BbbCommonEnvCoreMsg(envelope, event)
outGW.send(msgEvent)
//record(event)
}
val pages = new collection.mutable.HashMap[String, PageVO]
@ -35,8 +33,6 @@ trait PresentationConversionCompletedPubMsgHdlr {
val pres = new Presentation(msg.body.presentation.id, msg.body.presentation.name, msg.body.presentation.current,
pages.toMap, msg.body.presentation.downloadable)
log.debug("PresentationConversionCompletedPubMsg name={}", pres.name)
presentationConversionCompleted(pres)
broadcastEvent(msg)
}

View File

@ -19,8 +19,6 @@ trait SetCurrentPresentationPubMsgHdlr {
val event = SetCurrentPresentationEvtMsg(header, body)
val msgEvent = BbbCommonEnvCoreMsg(envelope, event)
outGW.send(msgEvent)
//record(event)
}
for {

View File

@ -39,7 +39,7 @@ public class DocumentConversionServiceImp implements DocumentConversionService {
public void processDocument(UploadedPresentation pres) {
SupportedDocumentFilter sdf = new SupportedDocumentFilter(gw);
log.info("Start presentation conversion. meetingId=" + pres.getMeetingId()
+ " presId=" + pres.getId() + " name=" + pres.getName());
+ " presId=" + pres.getId() + " name=" + pres.getName() + " current=" + pres.isCurrent());
if (sdf.isSupported(pres)) {
String fileType = pres.getFileType();

View File

@ -59,9 +59,9 @@ public class PresentationUrlDownloadService {
}
public void processUploadedFile(String meetingId, String presId,
String filename, File presFile) {
String filename, File presFile, Boolean current) {
UploadedPresentation uploadedPres = new UploadedPresentation(meetingId,
presId, filename, presentationBaseURL);
presId, filename, presentationBaseURL, current);
uploadedPres.setUploadedFile(presFile);
processUploadedPresentation(uploadedPres);
}
@ -145,7 +145,7 @@ public class PresentationUrlDownloadService {
processUploadedFile(destinationMeetingId, presId, "default-"
+ presentationSlide.toString() + "." + filenameExt,
newPresentation);
newPresentation, true);
}
public String generatePresentationId(String name) {

View File

@ -31,14 +31,15 @@ public final class UploadedPresentation {
private String conversionStatus;
private final String baseUrl;
private boolean isDownloadable = false;
private boolean current = false;
public UploadedPresentation(String meetingId, String id, String name,
String baseUrl) {
public UploadedPresentation(String meetingId, String id, String name, String baseUrl, Boolean current) {
this.meetingId = meetingId;
this.id = id;
this.name = name;
this.baseUrl = baseUrl;
this.isDownloadable = false;
this.current = current;
}
public File getUploadedFile() {
@ -96,4 +97,12 @@ public final class UploadedPresentation {
public void setDownloadable() {
this.isDownloadable = true;
}
public boolean isCurrent() {
return current;
}
public void setCurrent(Boolean value) {
this.current = value;
}
}

View File

@ -69,7 +69,7 @@ public class SwfSlidesGenerationProgressNotifier {
pres.getId(), pres.getId(),
pres.getName(), "notUsedYet", "notUsedYet",
pres.isDownloadable(), ConversionMessageConstants.CONVERSION_COMPLETED_KEY,
pres.getNumberOfPages(), generateBasePresUrl(pres));
pres.getNumberOfPages(), generateBasePresUrl(pres), pres.isCurrent());
messagingService.sendDocConversionMsg(progress);
}

View File

@ -11,11 +11,12 @@ public class DocPageCompletedProgress implements IDocConversionMsg {
public final String key;
public final Integer numPages;
public final String presBaseUrl;
public final Boolean current;
public DocPageCompletedProgress(String meetingId, String presId, String presInstance,
String filename, String uploaderId, String authzToken,
Boolean downloadable, String key,
Integer numPages, String presBaseUrl) {
Integer numPages, String presBaseUrl, Boolean current) {
this.meetingId = meetingId;
this.presId = presId;
this.presInstance = presInstance;
@ -26,5 +27,6 @@ public class DocPageCompletedProgress implements IDocConversionMsg {
this.key = key;
this.numPages = numPages;
this.presBaseUrl = presBaseUrl;
this.current = current;
}
}

View File

@ -73,7 +73,8 @@ object MsgBuilder {
val header = BbbClientMsgHeader(PresentationConversionCompletedSysPubMsg.NAME, msg.meetingId, msg.authzToken)
val pages = generatePresentationPages(msg.presId, msg.numPages.intValue(), msg.presBaseUrl)
val presentation = PresentationVO(msg.presId, msg.filename, current=true, pages.values.toVector, msg.downloadable)
val presentation = PresentationVO(msg.presId, msg.filename,
current=msg.current.booleanValue(), pages.values.toVector, msg.downloadable.booleanValue())
val body = PresentationConversionCompletedSysPubMsgBody(messageKey = msg.key,
code = msg.key, presentation)
@ -85,7 +86,7 @@ object MsgBuilder {
var pages = new scala.collection.mutable.HashMap[String, PageVO]
for (i <- 1 to numPages) {
val id = presId + "/" + i
val num = i;
val num = i
val current = if (i == 1) true else false
val thumbnail = presBaseUrl + "/thumbnail/" + i
val swfUri = presBaseUrl + "/slide/" + i
@ -93,7 +94,7 @@ object MsgBuilder {
val txtUri = presBaseUrl + "/textfiles/" + i
val svgUri = presBaseUrl + "/svg/" + i
val p = new PageVO(id = id, num = num, thumbUri = thumbnail, swfUri = swfUri,
val p = PageVO(id = id, num = num, thumbUri = thumbnail, swfUri = swfUri,
txtUri = txtUri, svgUri = svgUri,
current = current)
pages += p.id -> p

View File

@ -155,8 +155,6 @@ package org.bigbluebutton.modules.present.services.messaging
private function handlePresentationConversionCompletedEvtMsg(msg:Object):void {
var presVO: PresentationVO = processUploadedPresentation(msg.body.presentation);
LOGGER.debug("Adding presentation name=" + presVO.name);
service.addPresentation(presVO);
var uploadEvent:ConversionCompletedEvent = new ConversionCompletedEvent(presVO.id, presVO.name);
@ -182,7 +180,6 @@ package org.bigbluebutton.modules.present.services.messaging
}
private function handlePresentationPageCountErrorEvtMsg(msg:Object):void {
LOGGER.debug("handlePageCountExceededUpdateMessageCallback " + msg);
dispatcher.dispatchEvent(new ConversionPageCountMaxed(msg.body.maxNumberPages as Number));
}

View File

@ -22,7 +22,6 @@
private var globalDispatch:Dispatcher = new Dispatcher();
private function showPresentation():void {
LOGGER.debug("FileUploadWindow::showPresentation() {0}", [data.id]);
var changePresCommand:ChangePresentationCommand = new ChangePresentationCommand(data.id);
globalDispatch.dispatchEvent(changePresCommand);

View File

@ -1825,7 +1825,8 @@ class ApiController {
requestBody = StringUtils.isEmpty(requestBody) ? null : requestBody;
if (requestBody == null) {
downloadAndProcessDocument(presentationService.defaultUploadedPresentation, conf.getInternalId());
downloadAndProcessDocument(presentationService.defaultUploadedPresentation, conf.getInternalId(),
true /* default presentation */ );
} else {
log.debug "Request body: \n" + requestBody;
def xml = new XmlSlurper().parseText(requestBody);
@ -1836,11 +1837,12 @@ class ApiController {
// need to iterate over presentation files and process them
module.children().each { document ->
if (!StringUtils.isEmpty(document.@url.toString())) {
downloadAndProcessDocument(document.@url.toString(), conf.getInternalId());
downloadAndProcessDocument(document.@url.toString(), conf.getInternalId(), true /* default presentation */);
} else if (!StringUtils.isEmpty(document.@name.toString())) {
def b64 = new Base64()
def decodedBytes = b64.decode(document.text().getBytes())
processDocumentFromRawBytes(decodedBytes, document.@name.toString(), conf.getInternalId());
processDocumentFromRawBytes(decodedBytes, document.@name.toString(),
conf.getInternalId(), true /* default presentation */);
} else {
log.debug("presentation module config found, but it did not contain url or name attributes");
}
@ -1850,7 +1852,7 @@ class ApiController {
}
}
def processDocumentFromRawBytes(bytes, presFilename, meetingId) {
def processDocumentFromRawBytes(bytes, presFilename, meetingId, current) {
def filenameExt = FilenameUtils.getExtension(presFilename);
String presentationDir = presentationService.getPresentationDir()
def presId = Util.generatePresentationId(presFilename)
@ -1864,12 +1866,12 @@ class ApiController {
fos.flush()
fos.close()
processUploadedFile(meetingId, presId, presFilename, pres);
processUploadedFile(meetingId, presId, presFilename, pres, current);
}
}
def downloadAndProcessDocument(address, meetingId) {
def downloadAndProcessDocument(address, meetingId, current) {
log.debug("ApiController#downloadAndProcessDocument(${address}, ${meetingId})");
String presFilename = address.tokenize("/")[-1];
def filenameExt = FilenameUtils.getExtension(presFilename);
@ -1883,7 +1885,7 @@ class ApiController {
if (presDownloadService.savePresentation(meetingId, newFilePath, address)) {
def pres = new File(newFilePath)
processUploadedFile(meetingId, presId, presFilename, pres);
processUploadedFile(meetingId, presId, presFilename, pres, current);
} else {
log.error("Failed to download presentation=[${address}], meeting=[${meetingId}]")
}
@ -1891,9 +1893,9 @@ class ApiController {
}
def processUploadedFile(meetingId, presId, filename, presFile) {
def processUploadedFile(meetingId, presId, filename, presFile, current) {
def presentationBaseUrl = presentationService.presentationBaseUrl
UploadedPresentation uploadedPres = new UploadedPresentation(meetingId, presId, filename, presentationBaseUrl);
UploadedPresentation uploadedPres = new UploadedPresentation(meetingId, presId, filename, presentationBaseUrl, current);
uploadedPres.setUploadedFile(presFile);
presentationService.processUploadedPresentation(uploadedPres);
}

View File

@ -74,7 +74,8 @@ class PresentationController {
}
def presentationBaseUrl = presentationService.presentationBaseUrl
UploadedPresentation uploadedPres = new UploadedPresentation(meetingId, presId, presFilename, presentationBaseUrl);
UploadedPresentation uploadedPres = new UploadedPresentation(meetingId, presId,
presFilename, presentationBaseUrl, false /* default presentation */);
if(isDownloadable) {
log.debug "@Setting file to be downloadable..."