Skip to content

Commit 745dce4

Browse files
committed
message text validation only for first message
1 parent b2dc7ac commit 745dce4

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

routes/message.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,7 @@ async (req, res) => {
4949
winston.debug('req.params: ', req.params);
5050
winston.debug('req.params.request_id: ' + req.params.request_id);
5151

52-
// sponz: 4/01/23 disable it
53-
// if (!req.body.text && (!req.body.type || req.body.type=="text") ) {
54-
// return res.status(422).json({ errors: ["text field is required"] });
55-
// }
52+
5653
// const errors = validationResult(req);
5754
// if (!errors.isEmpty()) {
5855
// return res.status(422).json({ errors: errors.array() });
@@ -103,6 +100,12 @@ async (req, res) => {
103100
winston.debug("project_user", project_user);
104101
}
105102

103+
104+
// sponz: 4/01/23 disable it
105+
if (!req.body.text && (!req.body.type || req.body.type=="text") ) {
106+
return res.status(422).json({ errors: ["text field is required"] });
107+
}
108+
106109
if (sender) {
107110

108111
var isObjectId = mongoose.Types.ObjectId.isValid(sender);

0 commit comments

Comments
 (0)