mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-30 02:39:05 +08:00
added name field to approved quotes. closes #2824
This commit is contained in:
parent
464a237db1
commit
e6fcc2daf2
2 changed files with 5 additions and 2 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue