2020-02-07 04:47:28 +08:00
import RedisPubSub from '/imports/startup/server/redis' ;
import { Meteor } from 'meteor/meteor' ;
import { check } from 'meteor/check' ;
export default function sendAnnotationHelper ( annotation , meetingId , requesterUserId ) {
const REDIS _CONFIG = Meteor . settings . private . redis ;
const CHANNEL = REDIS _CONFIG . channels . toAkkaApps ;
const EVENT _NAME = 'SendWhiteboardAnnotationPubMsg' ;
const whiteboardId = annotation . wbId ;
check ( annotation , Object ) ;
check ( whiteboardId , String ) ;
if ( annotation . annotationType === 'text' ) {
check ( annotation , {
id : String ,
status : String ,
annotationType : String ,
annotationInfo : {
x : Number ,
y : Number ,
fontColor : Number ,
calcedFontSize : Number ,
textBoxWidth : Number ,
text : String ,
textBoxHeight : Number ,
id : String ,
whiteboardId : String ,
status : String ,
fontSize : Number ,
dataPoints : String ,
type : String ,
} ,
wbId : String ,
userId : String ,
position : Number ,
} ) ;
2020-10-28 13:36:10 +08:00
} else if ( annotation . annotationType === 'rectangle' || annotation . annotationType === 'triangle' || annotation . annotationType === 'ellipse' || annotation . annotationType === 'line' ) {
// line does not have the 'fill' property but this is necessary as 'fill' is anyway added at ui/components/whiteboard/whiteboard-overlay/shape-draw-listener/component.jsx
2020-12-24 20:12:57 +08:00
// Any other shape excluding pencil and text (e.g., eraser) needs to be added here.
2020-10-28 13:36:10 +08:00
check ( annotation , {
id : String ,
status : String ,
annotationType : String ,
annotationInfo : {
color : Number ,
thickness : Number ,
fill : Boolean ,
points : Array ,
id : String ,
whiteboardId : String ,
status : String ,
type : String ,
dimensions : Match . Maybe ( [ Number ] ) ,
} ,
wbId : String ,
userId : String ,
position : Number ,
} ) ;
2020-02-07 04:47:28 +08:00
} else {
check ( annotation , {
id : String ,
status : String ,
annotationType : String ,
annotationInfo : {
color : Number ,
thickness : Number ,
points : Array ,
id : String ,
whiteboardId : String ,
status : String ,
type : String ,
dimensions : Match . Maybe ( [ Number ] ) ,
} ,
wbId : String ,
userId : String ,
position : Number ,
} ) ;
}
const payload = {
annotation ,
} ;
return RedisPubSub . publishUserMessage ( CHANNEL , EVENT _NAME , meetingId , requesterUserId , payload ) ;
}