send_message(req){
        const date = new Date();
        if (req.body.text.trim() != ""){
            const msg = {
                id: this.parent.room.messages.length,
                sender: req.body.socket_id,
                username: req.session.user.username,
                text: req.body.text,
                attachment: req.body.attachment_idea_id,
                reply_to_msg_id: req.body.reply_to,
                date: {
                    hours: date.getHours(),
                    minutes: date.getMinutes(),
                    day: date.getDate(),
                    month: date.getMonth(),
                    fullyear: date.getFullYear(),
                }
            }
            this.parent.room.messages.push(msg);
            this.io.to(this.parent.room.roomCode).emit("new_message", msg)
            return true;
        }
        return false;
    }
// Add message to room (POST)
Add message to room (POST)
Add message to room ( POST )
send_message(req){
        const date = new Date();
        if (req.body.text.trim() != ""){
            const msg = {
                id: this.parent.room.messages.length,
                sender: req.body.socket_id,
                username: req.session.user.username,
                text: req.body.text,
                attachment: req.body.attachment_idea_id,
                reply_to_msg_id: req.body.reply_to,
                date: {
                    hours: date.getHours(),
                    minutes: date.getMinutes(),
                    day: date.getDate(),
                    month: date.getMonth(),
                    fullyear: date.getFullYear(),
                }
            }
            this.parent.room.messages.push(msg);
            this.io.to(this.parent.room.roomCode).emit("new_message", msg)
            return true;
        }
        return false;
    }
send_message ( req ) { const date = new Date ( ) ; if ( req . body . text . trim ( ) != "" ) { const msg = { id : this . parent . room . messages . length , sender : req . body . socket_id , username : req . session . user . username , text : req . body . text , attachment : req . body . attachment_idea_id , reply_to_msg_id : req . body . reply_to , date : { hours : date . getHours ( ) , minutes : date . getMinutes ( ) , day : date . getDate ( ) , month : date . getMonth ( ) , fullyear : date . getFullYear ( ) , } } this . parent . room . messages . push ( msg ) ; this . io . to ( this . parent . room . roomCode ) . emit ( "new_message" , msg ) return true ; } return false ; }
Add message to room (POST)
Add message to room ( POST )