Skip to content

Commit

Permalink
Added decode to teams edit and topics.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michaellinaresxk committed Sep 13, 2023
1 parent 38c35f3 commit 318faac
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
10 changes: 6 additions & 4 deletions controllers/teams.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 });
})
Expand Down
3 changes: 3 additions & 0 deletions controllers/topics.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 318faac

Please sign in to comment.