Skip to content

Commit

Permalink
try and stop forum timeout
Browse files Browse the repository at this point in the history
the censor being ran 3 times through regex was inherently bad.... but thought i could get away with it.... yea that didn't happen will this fix it? who knows
  • Loading branch information
Varrience authored Dec 22, 2024
1 parent 3e70eeb commit eca7bb9
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions API/Forum/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,8 @@ notifyUserFollowers(title,user,content,link) {
}

async publish(req, res, next) {
req.body = JSON.parse(Profanity.censorText(JSON.stringify(req.body)));
var { title, content, tags, mature, hidden, privateRecipients } = req.body;
title = Profanity.censorText(title);
content = Profanity.censorText(content);
tags = Profanity.censorText(tags);
console.log(title,content);
try {
const uid = res.locals.userToken.id;
Expand Down Expand Up @@ -90,6 +88,7 @@ async publish(req, res, next) {
}

async update(req, res, next) {
req.body = JSON.parse(Profanity.censorText(JSON.stringify(req.body)));
var { title, content, tags, mature, hidden, privateRecipients } = req.body;
console.log(title,content);
try {
Expand All @@ -103,9 +102,9 @@ async update(req, res, next) {
if (post.posterId !== user.id && user.role !== "Admin") return res.status(403).json({
message: "Not Authorized. You do not own this post",
});
post.title = Profanity.censorText(title);
post.content = Profanity.censorText(content);
post.tags = Profanity.censorText(tags);
post.title = title;
post.content = content;
post.tags = tags;
post.mature = mature;
post.hidden = hidden;
post.privateRecipients = privateRecipients;
Expand Down

0 comments on commit eca7bb9

Please sign in to comment.