add check for currentPresenter in pod message handlers
This commit is contained in:
parent
2d72bba4c4
commit
32375f1c66
@ -25,6 +25,15 @@ object PresentationPodsApp {
|
||||
state.presentationPodManager.getPod(podId)
|
||||
}
|
||||
|
||||
def getPresentationPodIfPresenter(state: MeetingState2x, podId: String, userId: String): Option[PresentationPod] = {
|
||||
for {
|
||||
pod <- getPresentationPod(state, podId)
|
||||
if pod.currentPresenter == userId
|
||||
} yield {
|
||||
pod
|
||||
}
|
||||
}
|
||||
|
||||
def getAllPresentationPodsInMeeting(state: MeetingState2x): Vector[PresentationPod] = {
|
||||
state.presentationPodManager.getAllPresentationPodsInMeeting()
|
||||
}
|
||||
|
@ -47,9 +47,8 @@ trait ResizeAndMovePagePubMsgHdlr extends RightsManagementTrait {
|
||||
val heightRatio: Double = msg.body.heightRatio
|
||||
|
||||
val newState = for {
|
||||
pod <- PresentationPodsApp.getPresentationPod(state, podId)
|
||||
(updatedPod, page) <- pod.resizePage(presentationId, pageId,
|
||||
xOffset, yOffset, widthRatio, heightRatio)
|
||||
pod <- PresentationPodsApp.getPresentationPodIfPresenter(state, podId, msg.header.userId)
|
||||
(updatedPod, page) <- pod.resizePage(presentationId, pageId, xOffset, yOffset, widthRatio, heightRatio)
|
||||
} yield {
|
||||
broadcastEvent(msg, podId, page)
|
||||
|
||||
|
@ -42,7 +42,7 @@ trait SetCurrentPagePubMsgHdlr extends RightsManagementTrait {
|
||||
val pageId = msg.body.pageId
|
||||
|
||||
val newState = for {
|
||||
pod <- PresentationPodsApp.getPresentationPod(state, podId)
|
||||
pod <- PresentationPodsApp.getPresentationPodIfPresenter(state, podId, userId)
|
||||
updatedPod <- pod.setCurrentPage(presentationId, pageId)
|
||||
} yield {
|
||||
|
||||
|
@ -34,11 +34,13 @@ trait SetCurrentPresentationPubMsgHdlr extends RightsManagementTrait {
|
||||
|
||||
val podId = msg.body.podId
|
||||
val presId = msg.body.presentationId
|
||||
val userId = msg.header.userId
|
||||
|
||||
val newState = for {
|
||||
updatedPod <- PresentationPodsApp.setCurrentPresentationInPod(state, podId, presId)
|
||||
pod <- PresentationPodsApp.getPresentationPodIfPresenter(state, podId, userId)
|
||||
updatedPod <- pod.setCurrentPresentation(presId)
|
||||
} yield {
|
||||
broadcastSetCurrentPresentationEvent(podId, msg.header.userId, presId)
|
||||
broadcastSetCurrentPresentationEvent(podId, userId, presId)
|
||||
|
||||
val pods = state.presentationPodManager.addPod(updatedPod)
|
||||
state.update(pods)
|
||||
|
Loading…
Reference in New Issue
Block a user