mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 02:55:58 +01:00 
			
		
		
		
	fix: closes #12618, handle missing selector
catch errors in activitypub api missing await on next()
This commit is contained in:
		| @@ -13,18 +13,12 @@ export function init() { | ||||
| 		template: 'admin/partials/category/selector-dropdown-right', | ||||
| 	}); | ||||
|  | ||||
| 	document.getElementById('site-settings').addEventListener('click', async (e) => { | ||||
| 		const subselector = e.target.closest('[data-action]'); | ||||
| 		if (!subselector) { | ||||
| 			return; | ||||
| 		} | ||||
|  | ||||
| 		const action = subselector.getAttribute('data-action'); | ||||
| 	$('#site-settings').on('click', '[data-action]', function () { | ||||
| 		const action = $(this).attr('data-action'); | ||||
|  | ||||
| 		switch (action) { | ||||
| 			case 'follow': { | ||||
| 				const inputEl = document.getElementById('syncing.add'); | ||||
| 				const actor = inputEl.value; | ||||
| 				const actor = $('#syncing-add').val(); | ||||
|  | ||||
| 				put(`/categories/${ajaxify.data.cid}/follow`, { actor }) | ||||
| 					.then(ajaxify.refresh) | ||||
| @@ -34,7 +28,7 @@ export function init() { | ||||
| 			} | ||||
|  | ||||
| 			case 'unfollow': { | ||||
| 				const actor = subselector.getAttribute('data-actor'); | ||||
| 				const actor = $(this).attr('data-actor'); | ||||
|  | ||||
| 				del(`/categories/${ajaxify.data.cid}/follow`, { actor }) | ||||
| 					.then(ajaxify.refresh) | ||||
|   | ||||
| @@ -42,13 +42,7 @@ Mocks.profile = async (actors) => { | ||||
| 		} = actor; | ||||
| 		preferredUsername = preferredUsername || slugify(name); | ||||
|  | ||||
| 		let hostname; | ||||
| 		try { | ||||
| 			({ hostname } = new URL(actor.id)); | ||||
| 		} catch (err) { | ||||
| 			console.error(err.stack); | ||||
| 			return null; | ||||
| 		} | ||||
| 		const { hostname } = new URL(actor.id); | ||||
|  | ||||
| 		let picture; | ||||
| 		if (icon) { | ||||
|   | ||||
| @@ -29,7 +29,7 @@ function enabledCheck(next) { | ||||
| 			return noop; | ||||
| 		} | ||||
|  | ||||
| 		next(caller, params); | ||||
| 		await next(caller, params); | ||||
| 	}; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -52,9 +52,9 @@ | ||||
| 						{{{ end }}} | ||||
|  | ||||
| 						<div class="mb-3"> | ||||
| 							<label class="form-label" for="syncing.add">[[admin/manage/categories:federation.syncing-add]]</label> | ||||
| 							<label class="form-label" for="syncing-add">[[admin/manage/categories:federation.syncing-add]]</label> | ||||
| 							<div class="input-group"> | ||||
| 								<input id="syncing.add" type="url" class="form-control" /> | ||||
| 								<input id="syncing-add" type="url" class="form-control" /> | ||||
| 								<button data-action="follow" type="button" class="btn btn-primary">[[admin/manage/categories:federation.syncing-follow]]</button> | ||||
| 							</div> | ||||
| 						</div> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user