Merge branch 'master' into webpack5

This commit is contained in:
Barış Soner Uşaklı
2022-03-02 15:28:50 -05:00
4 changed files with 10 additions and 5 deletions

View File

@@ -132,7 +132,7 @@ define('forum/topic/posts', [
if (!isPreviousPostAdded && data.posts[0].selfPost) {
return ajaxify.go('post/' + data.posts[0].pid);
}
const repliesSelector = $('[component="post"]:not([data-index=0]), [component="topic/event"]');
const repliesSelector = $('[component="topic"]>[component="post"]:not([data-index=0]), [component="topic"]>[component="topic/event"]');
createNewPosts(data, repliesSelector, direction, false, function (html) {
if (html) {
html.addClass('new');

View File

@@ -163,7 +163,7 @@ module.exports = function (Categories) {
if (!topic.scheduled && topic.deleted && !topic.isOwner) {
topic.title = '[[topic:topic_is_deleted]]';
if (topic.hasOwnProperty('titleRaw')) {
topics.titleRaw = '[[topic:topic_is_deleted]]';
topic.titleRaw = '[[topic:topic_is_deleted]]';
}
topic.slug = topic.tid;
topic.teaser = null;

View File

@@ -5,6 +5,7 @@ const user = require('../../user');
const posts = require('../../posts');
const topics = require('../../topics');
const categories = require('../../categories');
const privileges = require('../../privileges');
const pagination = require('../../pagination');
const helpers = require('../helpers');
const accountHelpers = require('./helpers');
@@ -56,7 +57,8 @@ const templateToData = {
return cids.map(c => `cid:${c}:uid:${userData.uid}:pids:votes`);
},
getTopics: async (sets, req, start, stop) => {
const pids = await db.getSortedSetRevRangeByScore(sets, start, stop - start + 1, '+inf', 1);
let pids = await db.getSortedSetRevRangeByScore(sets, start, stop - start + 1, '+inf', 1);
pids = await privileges.posts.filter('topics:read', pids, req.uid);
const postObjs = await posts.getPostSummaryByPids(pids, req.uid, { stripTags: false });
return { posts: postObjs, nextStart: stop + 1 };
},
@@ -74,7 +76,8 @@ const templateToData = {
return cids.map(c => `cid:${c}:uid:${userData.uid}:pids:votes`);
},
getTopics: async (sets, req, start, stop) => {
const pids = await db.getSortedSetRangeByScore(sets, start, stop - start + 1, '-inf', -1);
let pids = await db.getSortedSetRangeByScore(sets, start, stop - start + 1, '-inf', -1);
pids = await privileges.posts.filter('topics:read', pids, req.uid);
const postObjs = await posts.getPostSummaryByPids(pids, req.uid, { stripTags: false });
return { posts: postObjs, nextStart: stop + 1 };
},

View File

@@ -1,5 +1,7 @@
'use strict';
const path = require('path');
const nconf = require('nconf');
const db = require('../../database');
@@ -27,7 +29,7 @@ uploadsController.get = async function (req, res, next) {
userData.uploads = uploadNames.map(uploadName => ({
name: uploadName,
url: nconf.get('upload_url') + uploadName,
url: path.resolve(nconf.get('upload_url'), uploadName),
}));
const pageCount = Math.ceil(itemCount / itemsPerPage);
userData.pagination = pagination.create(page, pageCount, req.query);