mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 19:15:58 +01:00 
			
		
		
		
	Merge branch 'master' into develop
This commit is contained in:
		| @@ -65,7 +65,7 @@ Notes.assert = async (uid, input, options = { skipChecks: false }) => { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	try { | 	try { | ||||||
| 		if (!options.skipChecks) { | 		if (!(options.skipChecks || process.env.hasOwnProperty('CI'))) { | ||||||
| 			id = (await activitypub.checkHeader(id)) || id; | 			id = (await activitypub.checkHeader(id)) || id; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
|   | |||||||
| @@ -11,6 +11,7 @@ module.exports = { | |||||||
| 	method: async function () { | 	method: async function () { | ||||||
| 		const { progress } = this; | 		const { progress } = this; | ||||||
| 		const cids = await db.getSortedSetRange('categories:cid', 0, -1); | 		const cids = await db.getSortedSetRange('categories:cid', 0, -1); | ||||||
|  | 		progress.total = cids.length; | ||||||
| 		for (const cid of cids) { | 		for (const cid of cids) { | ||||||
| 			const uids = await db.getSortedSetRange(`group:cid:${cid}:privileges:moderate:members`, 0, -1); | 			const uids = await db.getSortedSetRange(`group:cid:${cid}:privileges:moderate:members`, 0, -1); | ||||||
| 			for (const uid of uids) { | 			for (const uid of uids) { | ||||||
|   | |||||||
| @@ -1,5 +1,3 @@ | |||||||
| /* eslint-disable no-await-in-loop */ |  | ||||||
|  |  | ||||||
| 'use strict'; | 'use strict'; | ||||||
|  |  | ||||||
| const db = require('../../database'); | const db = require('../../database'); | ||||||
| @@ -13,18 +11,24 @@ module.exports = { | |||||||
| 		const { progress } = this; | 		const { progress } = this; | ||||||
|  |  | ||||||
| 		const topics = require('../../topics'); | 		const topics = require('../../topics'); | ||||||
|  | 		progress.total = await db.sortedSetCard('topics:tid'); | ||||||
| 		await batch.processSortedSet('topics:tid', async (tids) => { | 		await batch.processSortedSet('topics:tid', async (tids) => { | ||||||
| 			for (const tid of tids) { | 			progress.incr(tids.length); | ||||||
| 				progress.incr(); | 			const topicData = await db.getObjectFields( | ||||||
| 				const topicData = await db.getObjectFields(`topic:${tid}`, ['cid', 'pinned', 'postcount']); | 				tids.map(tid => `topic:${tid}`), | ||||||
| 				if (parseInt(topicData.pinned, 10) !== 1) { | 				['tid', 'cid', 'pinned', 'postcount'], | ||||||
|  | 			); | ||||||
|  | 			const bulkAdd = []; | ||||||
|  | 			topicData.forEach((topic) => { | ||||||
|  | 				if (topic && parseInt(topic.pinned, 10) !== 1) { | ||||||
| 					topicData.postcount = parseInt(topicData.postcount, 10) || 0; | 					topicData.postcount = parseInt(topicData.postcount, 10) || 0; | ||||||
| 					await db.sortedSetAdd(`cid:${topicData.cid}:tids:posts`, topicData.postcount, tid); | 					bulkAdd.push([`cid:${topicData.cid}:tids:posts`, topicData.postcount, topicData.tid]); | ||||||
| 				} |  | ||||||
| 				await topics.updateLastPostTimeFromLastPid(tid); |  | ||||||
| 				} | 				} | ||||||
|  | 			}); | ||||||
|  | 			await db.sortedSetAddBulk(bulkAdd); | ||||||
|  | 			await Promise.all(tids.map(tid => topics.updateLastPostTimeFromLastPid(tid))); | ||||||
| 		}, { | 		}, { | ||||||
| 			progress: progress, | 			batch: 500, | ||||||
| 		}); | 		}); | ||||||
| 	}, | 	}, | ||||||
| }; | }; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user