Browse Source

通知换行bug修复

ellisran 6 tháng trước cách đây
mục cha
commit
7a618ad1f4

+ 4 - 0
app/controller/dashboard_controller.js

@@ -153,6 +153,10 @@ module.exports = app => {
                 if (msgInfo && msgInfo.type === 1 && msgInfo.project_id !== ctx.session.sessionProject.id) {
                     throw '非该项目通知无权查看';
                 }
+                if (msgInfo) {
+                    msgInfo.content = JSON.parse(JSON.stringify(msgInfo.content).replace(/\\r\\n/g, '<br>').replace(/\\"/g, '&#34;').replace(/'/g, '&#39;').replace(/\\t/g, '&#9;'));
+                    msgInfo.files = await this.ctx.service.messageAtt.getAtt(msgInfo.id);
+                }
 
                 const total = type === 1 ?
                     await ctx.service.message.count({ project_id: ctx.session.sessionProject.id, type }) :

+ 3 - 0
app/controller/wap_controller.js

@@ -993,6 +993,9 @@ module.exports = app => {
                 if (msgInfo && msgInfo.type === 1 && msgInfo.project_id !== ctx.session.sessionProject.id) {
                     throw '非该项目通知无权查看';
                 }
+                if (msgInfo) {
+                    msgInfo.content = JSON.parse(JSON.stringify(msgInfo.content).replace(/\\r\\n/g, '<br>').replace(/\\"/g, '&#34;').replace(/'/g, '&#39;').replace(/\\t/g, '&#9;'));
+                }
                 const renderData = {
                     msgInfo,
                     moment,