mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-11-03 20:45:58 +01:00 
			
		
		
		
	fix: port the try/catch for notes.assert from develop
This commit is contained in:
		@@ -63,6 +63,7 @@ Notes.assert = async (uid, input, options = { skipChecks: false }) => {
 | 
				
			|||||||
		return null;
 | 
							return null;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						try {
 | 
				
			||||||
		if (!options.skipChecks) {
 | 
							if (!options.skipChecks) {
 | 
				
			||||||
			id = (await activitypub.checkHeader(id)) || id;
 | 
								id = (await activitypub.checkHeader(id)) || id;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -228,6 +229,7 @@ Notes.assert = async (uid, input, options = { skipChecks: false }) => {
 | 
				
			|||||||
				unprocessed.shift();
 | 
									unprocessed.shift();
 | 
				
			||||||
			} catch (e) {
 | 
								} catch (e) {
 | 
				
			||||||
				activitypub.helpers.log(`[activitypub/notes.assert] Could not post topic (${mainPost.pid}): ${e.message}`);
 | 
									activitypub.helpers.log(`[activitypub/notes.assert] Could not post topic (${mainPost.pid}): ${e.message}`);
 | 
				
			||||||
 | 
									await unlock(id);
 | 
				
			||||||
				return null;
 | 
									return null;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -269,6 +271,11 @@ Notes.assert = async (uid, input, options = { skipChecks: false }) => {
 | 
				
			|||||||
		]);
 | 
							]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		return { tid, count };
 | 
							return { tid, count };
 | 
				
			||||||
 | 
						} catch (e) {
 | 
				
			||||||
 | 
							winston.warn(`[activitypub/notes.assert] Could not assert ${id} (${e.message}), releasing lock.`);
 | 
				
			||||||
 | 
							await unlock(id);
 | 
				
			||||||
 | 
							return null;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Notes.assertPrivate = async (object) => {
 | 
					Notes.assertPrivate = async (object) => {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user