added name field to approved quotes. closes #2824

This commit is contained in:
Miodec 2022-04-11 15:55:59 +02:00
parent 464a237db1
commit e6fcc2daf2
2 changed files with 5 additions and 2 deletions

View file

@ -40,7 +40,9 @@ export async function approveQuote(
const { uid } = req.ctx.decodedToken;
const { quoteId, editText, editSource } = req.body;
const data = await NewQuotesDao.approve(quoteId, editText, editSource);
const { name } = await UserDAO.getUser(uid);
const data = await NewQuotesDao.approve(quoteId, editText, editSource, name);
Logger.logToDb("system_quote_approved", data, uid);
return new MonkeyResponse(data.message, data.quote);

View file

@ -66,7 +66,7 @@ class NewQuotesDAO {
.toArray();
}
static async approve(quoteId, editQuote, editSource) {
static async approve(quoteId, editQuote, editSource, name) {
if (!git) throw new MonkeyError(500, "Git not available.");
//check mod status
const targetQuote = await db
@ -80,6 +80,7 @@ class NewQuotesDAO {
text: editQuote ? editQuote : targetQuote.text,
source: editSource ? editSource : targetQuote.source,
length: targetQuote.text.length,
name,
};
let message = "";
const fileDir = path.join(