Skip to content

Commit 8edc65d

Browse files
Merge pull request #98 from topcoder-platform/feature/PLAT-2021
Feature/plat 2021- forum was not created for a long challenge title
2 parents 3c1ecc9 + ac3f03e commit 8edc65d

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

config/default.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,5 @@ module.exports = {
5151
TEMPLATES: {
5252
TEMPLATE_FILE_PATH: "./../../config/template.json",
5353
},
54+
FORUM_TITLE_LENGTH_LIMIT: process.env.FORUM_TITLE_LENGTH_LIMIT || 90,
5455
};

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/services/vanilla.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,10 @@ async function createVanillaGroup (challenge) {
208208
const groupNameTemplate = _.template(groupTemplate.group.name)
209209
const groupDescriptionTemplate = challenge.legacy.selfService ? _.template(groupTemplate.group.selfServiceDescription)
210210
: _.template(groupTemplate.group.description)
211+
const shorterGroupName = groupNameTemplate({ challengeDetailsDiscussion }).substring(0,config.FORUM_TITLE_LENGTH_LIMIT);
211212

212213
const { body: group } = await vanillaClient.createGroup({
213-
name: groupNameTemplate({ challenge }),
214+
name: groupNameTemplate({ challengeDetailsDiscussion }).length >= config.FORUM_TITLE_LENGTH_LIMIT ? `${shorterGroupName}...` : groupNameTemplate({ challengeDetailsDiscussion }),
214215
privacy: groupTemplate.group.privacy,
215216
type: groupTemplate.group.type,
216217
description: groupDescriptionTemplate({ challenge }),

0 commit comments

Comments
 (0)