mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-17 14:00:29 +01:00
fix: regression caused by d3b3720915
This commit is contained in:
@@ -18,6 +18,7 @@ module.exports = function (Posts) {
|
|||||||
const content = data.content.toString();
|
const content = data.content.toString();
|
||||||
const timestamp = data.timestamp || Date.now();
|
const timestamp = data.timestamp || Date.now();
|
||||||
const isMain = data.isMain || false;
|
const isMain = data.isMain || false;
|
||||||
|
let hasAttachment = false;
|
||||||
|
|
||||||
if (!uid && parseInt(uid, 10) !== 0) {
|
if (!uid && parseInt(uid, 10) !== 0) {
|
||||||
throw new Error('[[error:invalid-uid]]');
|
throw new Error('[[error:invalid-uid]]');
|
||||||
@@ -46,7 +47,6 @@ module.exports = function (Posts) {
|
|||||||
if (_activitypub.audience) {
|
if (_activitypub.audience) {
|
||||||
postData.audience = _activitypub.audience;
|
postData.audience = _activitypub.audience;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Rewrite emoji references to inline image assets
|
// Rewrite emoji references to inline image assets
|
||||||
if (_activitypub && _activitypub.tag && Array.isArray(_activitypub.tag)) {
|
if (_activitypub && _activitypub.tag && Array.isArray(_activitypub.tag)) {
|
||||||
@@ -65,14 +65,15 @@ module.exports = function (Posts) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hasAttachment = _activitypub && _activitypub.attachment && _activitypub.attachment.length;
|
||||||
|
}
|
||||||
|
|
||||||
({ post: postData } = await plugins.hooks.fire('filter:post.create', { post: postData, data: data }));
|
({ post: postData } = await plugins.hooks.fire('filter:post.create', { post: postData, data: data }));
|
||||||
await db.setObject(`post:${postData.pid}`, postData);
|
await db.setObject(`post:${postData.pid}`, postData);
|
||||||
|
|
||||||
const topicData = await topics.getTopicFields(tid, ['cid', 'pinned']);
|
const topicData = await topics.getTopicFields(tid, ['cid', 'pinned']);
|
||||||
postData.cid = topicData.cid;
|
postData.cid = topicData.cid;
|
||||||
|
|
||||||
const hasAttachment = _activitypub && _activitypub.attachment && _activitypub.attachment.length;
|
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
db.sortedSetAdd('posts:pid', timestamp, postData.pid),
|
db.sortedSetAdd('posts:pid', timestamp, postData.pid),
|
||||||
utils.isNumber(pid) ? db.incrObjectField('global', 'postCount') : null,
|
utils.isNumber(pid) ? db.incrObjectField('global', 'postCount') : null,
|
||||||
|
|||||||
Reference in New Issue
Block a user