Skip to content

Commit 7caf2cb

Browse files
use substring instead of slice for limiting the forum anme
1 parent 8133008 commit 7caf2cb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/services/ChallengeService.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,7 @@ async function createChallenge (currentUser, challenge) {
881881
if (challenge.discussions && challenge.discussions.length > 0) {
882882
for (let i = 0; i < challenge.discussions.length; i += 1) {
883883
challenge.discussions[i].id = uuid()
884-
challenge.discussions[i].name = challenge.discussions[i].name.slice(0, config.FORUM_TITLE_LENGTH_LIMIT - 1)
884+
challenge.discussions[i].name = challenge.discussions[i].name.substring(0, config.FORUM_TITLE_LENGTH_LIMIT)
885885
}
886886
}
887887
if (challenge.phases && challenge.phases.length > 0) {
@@ -1757,7 +1757,7 @@ function sanitizeChallenge (challenge) {
17571757
if (challenge.discussions) {
17581758
sanitized.discussions = _.map(challenge.discussions, discussion => ({
17591759
..._.pick(discussion, ['id', 'provider', 'name', 'type', 'url', 'options']),
1760-
name: _.get(discussion, 'name', '').slice(0, config.FORUM_TITLE_LENGTH_LIMIT - 1)
1760+
name: _.get(discussion, 'name', '').substring(0, config.FORUM_TITLE_LENGTH_LIMIT)
17611761
}))
17621762
}
17631763
if (challenge.terms) {

0 commit comments

Comments
 (0)