Skip to content

Commit

Permalink
BC-482-character-not-shown-properly (#3291)
Browse files Browse the repository at this point in the history
* Added functionality to display & character instead of &amp on theme creation.

* Added decode to teams edit and topics.
  • Loading branch information
Michaellinaresxk authored Sep 14, 2023
1 parent ac493c1 commit 3b7c4d0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
13 changes: 13 additions & 0 deletions controllers/teams.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const _ = require('lodash');
const express = require('express');
const moment = require('moment');
const { Configuration } = require('@hpi-schul-cloud/commons');
const { decode } = require('html-entities');

const authHelper = require('../helpers/authentication');
const recurringEventsHelper = require('../helpers/recurringEvents');
Expand Down Expand Up @@ -155,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 @@ -427,6 +432,9 @@ router.get('/:teamId/json', (req, res, next) => {
return permission;
});

if (team.description) team.description = decode(team.description);
if (team.name) team.name = decode(team.name);

res.json({ team });
})
.catch((err) => {
Expand Down Expand Up @@ -473,6 +481,11 @@ router.get('/:teamId', async (req, res, next) => {
},
});

if (course.description && course.name) {
course.description = decode(course.description);
course.name = decode(course.name);
}

let instanceUsesRocketChat = Configuration.get('ROCKETCHAT_SERVICE_ENABLED');
if (Configuration.has('ROCKET_CHAT_DEPRECATION_DATE')) {
const deprecationDate = new Date(Configuration.get('ROCKET_CHAT_DEPRECATION_DATE'));
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 3b7c4d0

Please sign in to comment.