Show staff reply numbers in threads/logs

cshd
Dragory 2020-07-19 14:24:17 +03:00
parent 3002473905
commit e74363a55c
No known key found for this signature in database
GPG Key ID: 5F387BA66DF8AAC1
2 changed files with 7 additions and 3 deletions

View File

@ -197,7 +197,7 @@ class Thread {
} }
// Save the log entry // Save the log entry
const logContent = formatters.formatStaffReplyLogMessage(moderator, text, { isAnonymous, attachmentLinks }); const logContent = formatters.formatStaffReplyLogMessage(moderator, text, threadMessage.message_number, { isAnonymous, attachmentLinks });
const threadMessage = await this._addThreadMessageToDB({ const threadMessage = await this._addThreadMessageToDB({
message_type: THREAD_MESSAGE_TYPE.TO_USER, message_type: THREAD_MESSAGE_TYPE.TO_USER,
user_id: moderator.id, user_id: moderator.id,

View File

@ -31,6 +31,7 @@ const ThreadMessage = require('./data/ThreadMessage');
* @callback FormatStaffReplyLogMessage * @callback FormatStaffReplyLogMessage
* @param {Eris.Member} moderator * @param {Eris.Member} moderator
* @param {string} text * @param {string} text
* @param {number} messageNumber
* @param {{ * @param {{
* isAnonymous: boolean, * isAnonymous: boolean,
* attachmentLinks: string[], * attachmentLinks: string[],
@ -128,7 +129,6 @@ const defaultFormatters = {
? `(Anonymous) (${modName}) ${mainRole ? mainRole.name : 'Moderator'}` ? `(Anonymous) (${modName}) ${mainRole ? mainRole.name : 'Moderator'}`
: (mainRole ? `(${mainRole.name}) ${modName}` : modName); : (mainRole ? `(${mainRole.name}) ${modName}` : modName);
// TODO: Add \`[${messageNumber}]\` here once !edit and !delete exist
let result = `**${modInfo}:** ${text}`; let result = `**${modInfo}:** ${text}`;
if (config.threadTimestamps) { if (config.threadTimestamps) {
@ -136,10 +136,12 @@ const defaultFormatters = {
result = `[${formattedTimestamp}] ${result}`; result = `[${formattedTimestamp}] ${result}`;
} }
result = `\`[${messageNumber}]\` ${result}`;
return result; return result;
}, },
formatStaffReplyLogMessage(moderator, text, opts = {}) { formatStaffReplyLogMessage(moderator, text, messageNumber, opts = {}) {
const mainRole = utils.getMainRole(moderator); const mainRole = utils.getMainRole(moderator);
const modName = moderator.user.username; const modName = moderator.user.username;
@ -157,6 +159,8 @@ const defaultFormatters = {
} }
} }
result = `[${messageNumber}] ${result}`;
return result; return result;
}, },