diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/MeetingDAO.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/MeetingDAO.scala index f9a6152dd0..6fb5f5468b 100644 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/MeetingDAO.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/MeetingDAO.scala @@ -144,7 +144,7 @@ object MeetingDAO { MeetingWelcomeDAO.insert(meetingProps.meetingProp.intId, meetingProps.welcomeProp) MeetingGroupDAO.insert(meetingProps.meetingProp.intId, meetingProps.groups) MeetingBreakoutDAO.insert(meetingProps.meetingProp.intId, meetingProps.breakoutProps) - TimerDAO.insert(meetingProps.meetingProp.intId) + TimerDAO.insert(meetingProps.meetingProp.intId, clientSettings) LayoutDAO.insert(meetingProps.meetingProp.intId, meetingProps.usersProp.meetingLayout) MeetingClientSettingsDAO.insert(meetingProps.meetingProp.intId, JsonUtils.mapToJson(clientSettings)) } diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/TimerDAO.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/TimerDAO.scala index dd3b5168b0..6f5680cb4d 100644 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/TimerDAO.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/db/TimerDAO.scala @@ -1,5 +1,6 @@ package org.bigbluebutton.core.db +import org.bigbluebutton.ClientSettings.{getConfigPropertyValueByPathAsBooleanOrElse, getConfigPropertyValueByPathAsIntOrElse} import org.bigbluebutton.core.apps.TimerModel import org.bigbluebutton.core.apps.TimerModel.{getAccumulated, getEndedAt, getIsActive, getRunning, getStartedAt, getStopwatch, getTime, getTrack} import slick.jdbc.PostgresProfile.api._ @@ -33,25 +34,31 @@ class TimerDbTableDef(tag: Tag) extends Table[TimerDbModel](tag, None, "timer") } object TimerDAO { - def insert(meetingId: String) = { - DatabaseConnection.db.run( - TableQuery[TimerDbTableDef].insertOrUpdate( - TimerDbModel( - meetingId = meetingId, - stopwatch = true, - running = false, - active = false, - time = 300000, - accumulated = 0, - startedOn = 0, - endedOn = 0, - songTrack = "noTrack", + def insert(meetingId: String, clientSettings: Map[String, Object]) = { + val timerEnabled = getConfigPropertyValueByPathAsBooleanOrElse(clientSettings, "public.timer.enabled", alternativeValue = true) + if(timerEnabled) { + val timerDefaultTimeInMinutes = getConfigPropertyValueByPathAsIntOrElse(clientSettings, "public.timer.time", 5) + val timerDefaultTimeInMilli = timerDefaultTimeInMinutes * 60000 + + DatabaseConnection.db.run( + TableQuery[TimerDbTableDef].insertOrUpdate( + TimerDbModel( + meetingId = meetingId, + stopwatch = true, + running = false, + active = false, + time = timerDefaultTimeInMilli, + accumulated = 0, + startedOn = 0, + endedOn = 0, + songTrack = "noTrack", + ) ) - ) - ).onComplete { + ).onComplete { case Success(rowsAffected) => DatabaseConnection.logger.debug(s"$rowsAffected row(s) inserted on Timer table!") case Failure(e) => DatabaseConnection.logger.debug(s"Error inserting Timer: $e") } + } } def update(meetingId: String, timerModel: TimerModel) = { diff --git a/bigbluebutton-html5/imports/api/meetings/server/modifiers/addMeeting.js b/bigbluebutton-html5/imports/api/meetings/server/modifiers/addMeeting.js index 9b44d3c6bf..c5d5aea59a 100755 --- a/bigbluebutton-html5/imports/api/meetings/server/modifiers/addMeeting.js +++ b/bigbluebutton-html5/imports/api/meetings/server/modifiers/addMeeting.js @@ -228,7 +228,7 @@ export default async function addMeeting(meeting) { if (insertedId) { Logger.info(`Added meeting id=${meetingId}`); // Init Timer collection - createTimer(meetingId); + // createTimer(meetingId); if (newMeeting.meetingProp.disabledFeatures.indexOf('sharedNotes') === -1) { initPads(meetingId); }