Skip to content

Commit

Permalink
Merge pull request #322 from openstad/devel
Browse files Browse the repository at this point in the history
Devel
  • Loading branch information
LorenzoJokhan authored Nov 9, 2023
2 parents d1832a2 + 6a58b34 commit 86536a9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/models/Idea.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ module.exports = function (db, sequelize, DataTypes) {
validate: {
textLength(value) {
// We need to undo the sanitization before we can check the length
let len = htmlToText.fromString(value).length;
let len = htmlToText.fromString(value || '').length;
let summaryMinLength =
(this.config &&
this.config.ideas &&
Expand All @@ -231,7 +231,7 @@ module.exports = function (db, sequelize, DataTypes) {
},
},
set: function (text) {
text = text ? sanitize.summary(text.trim()) : null;
text = text ? sanitize.summary(text.trim()) : '';
this.setDataValue('summary', text);
},
},
Expand All @@ -241,7 +241,7 @@ module.exports = function (db, sequelize, DataTypes) {
allowNull: !this.publishDate,
validate: {
textLength(value) {
let len = sanitize.summary(value.trim()).length;
let len = sanitize.summary(value || ''.trim()).length;
let descriptionMinLength =
(this.config &&
this.config.ideas &&
Expand All @@ -263,7 +263,7 @@ module.exports = function (db, sequelize, DataTypes) {
},
},
set: function (text) {
text = text ? sanitize.content(text.trim()) : null;
text = text ? sanitize.content(text.trim()) : '';
this.setDataValue('description', text);
},
},
Expand Down Expand Up @@ -318,7 +318,7 @@ module.exports = function (db, sequelize, DataTypes) {
},
allowNull: true,
set: function (text) {
text = text ? sanitize.content(text.trim()) : null;
text = text ? sanitize.content(text.trim()) : '';
this.setDataValue('modBreak', text);
},
},
Expand Down

1 comment on commit 86536a9

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Published new image: openstad/api:master-86536a9

Please sign in to comment.