From 318faac9c920762311bcaa798551452587101b58 Mon Sep 17 00:00:00 2001 From: Michael Linares Date: Wed, 13 Sep 2023 23:12:01 +0200 Subject: [PATCH] Added decode to teams edit and topics. --- controllers/teams.js | 10 ++++++---- controllers/topics.js | 3 +++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/controllers/teams.js b/controllers/teams.js index 9a0945034d..0c813204f9 100644 --- a/controllers/teams.js +++ b/controllers/teams.js @@ -156,6 +156,10 @@ const editTeamHandler = async (req, res, next) => { if (req.params.teamId && !permissions.includes('RENAME_TEAM')) { return next(new Error(res.$t('global.text.403'))); } + + if (team.description) team.description = decode(team.description); + if (team.name) team.name = decode(team.name); + return res.render('teams/edit-team', { action, method, @@ -428,10 +432,8 @@ router.get('/:teamId/json', (req, res, next) => { return permission; }); - if (team.description && team.name) { - team.description = decode(team.description); - team.name = decode(team.name); - } + if (team.description) team.description = decode(team.description); + if (team.name) team.name = decode(team.name); res.json({ team }); }) diff --git a/controllers/topics.js b/controllers/topics.js index 012b50c6d9..a2087b8896 100644 --- a/controllers/topics.js +++ b/controllers/topics.js @@ -47,6 +47,9 @@ const editTopicHandler = (req, res, next) => { const { filesStorage } = await filesStoragesHelper .filesStorageInit(schoolId, lesson._id, 'lessons', false, req); + if (lesson.title) lesson.title = decode(lesson.title); + if (lesson.contents) lesson.contents = decode(lesson.contents); + res.render('topic/edit-topic', { action, method,