mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-29 10:06:13 +01:00
fix: #9398, crash on post flag
This commit is contained in:
@@ -440,7 +440,7 @@ Flags.create = async function (type, id, uid, reason, timestamp) {
|
||||
await Promise.all(batched);
|
||||
|
||||
if (doHistoryAppend) {
|
||||
Flags.update(flagId, uid, { state: 'open' });
|
||||
await Flags.update(flagId, uid, { state: 'open' });
|
||||
}
|
||||
|
||||
const flagObj = await Flags.get(flagId);
|
||||
@@ -725,7 +725,7 @@ Flags.notify = async function (flagObj, uid) {
|
||||
notifObj = await notifications.create({
|
||||
type: 'new-post-flag',
|
||||
bodyShort: `[[notifications:user_flagged_post_in, ${flagObj.reports[flagObj.reports.length - 1].reporter.username}, ${titleEscaped}]]`,
|
||||
bodyLong: await plugins.hooks.fire('filter:parse.raw', flagObj.description),
|
||||
bodyLong: await plugins.hooks.fire('filter:parse.raw', String(flagObj.description || '')),
|
||||
pid: flagObj.targetId,
|
||||
path: `/flags/${flagObj.flagId}`,
|
||||
nid: `flag:post:${flagObj.targetId}`,
|
||||
@@ -738,7 +738,7 @@ Flags.notify = async function (flagObj, uid) {
|
||||
notifObj = await notifications.create({
|
||||
type: 'new-user-flag',
|
||||
bodyShort: `[[notifications:user_flagged_user, ${flagObj.reports[flagObj.reports.length - 1].reporter.username}, ${flagObj.target.username}]]`,
|
||||
bodyLong: await plugins.hooks.fire('filter:parse.raw', flagObj.description),
|
||||
bodyLong: await plugins.hooks.fire('filter:parse.raw', String(flagObj.description || '')),
|
||||
path: `/flags/${flagObj.flagId}`,
|
||||
nid: `flag:user:${flagObj.targetId}`,
|
||||
from: uid,
|
||||
|
||||
@@ -134,7 +134,7 @@ Groups.get = async function (groupName, options) {
|
||||
if (!groupData) {
|
||||
return null;
|
||||
}
|
||||
const descriptionParsed = await plugins.hooks.fire('filter:parse.raw', groupData.description);
|
||||
const descriptionParsed = await plugins.hooks.fire('filter:parse.raw', String(groupData.description || ''));
|
||||
groupData.descriptionParsed = descriptionParsed;
|
||||
groupData.members = members;
|
||||
groupData.membersNextStart = stop + 1;
|
||||
|
||||
@@ -64,7 +64,7 @@ async function canGet(hook, callerUid, uid) {
|
||||
}
|
||||
|
||||
Messaging.parse = async (message, fromuid, uid, roomId, isNew) => {
|
||||
const parsed = await plugins.hooks.fire('filter:parse.raw', message);
|
||||
const parsed = await plugins.hooks.fire('filter:parse.raw', String(message || ''));
|
||||
let messageData = {
|
||||
message: message,
|
||||
parsed: parsed,
|
||||
|
||||
Reference in New Issue
Block a user