mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 02:55:58 +01:00 
			
		
		
		
	fix: #8374, revert event delete
This commit is contained in:
		| @@ -2,6 +2,7 @@ | |||||||
| 	"events": "Events", | 	"events": "Events", | ||||||
| 	"no-events": "There are no events", | 	"no-events": "There are no events", | ||||||
| 	"control-panel": "Events Control Panel", | 	"control-panel": "Events Control Panel", | ||||||
|  | 	"delete-events": "Delete Events", | ||||||
| 	"filters": "Filters", | 	"filters": "Filters", | ||||||
| 	"filters-apply": "Apply Filters", | 	"filters-apply": "Apply Filters", | ||||||
| 	"filter-type": "Event Type", | 	"filter-type": "Event Type", | ||||||
|   | |||||||
| @@ -5,6 +5,26 @@ define('admin/advanced/events', function () { | |||||||
| 	var	Events = {}; | 	var	Events = {}; | ||||||
|  |  | ||||||
| 	Events.init = function () { | 	Events.init = function () { | ||||||
|  | 		$('[data-action="clear"]').on('click', function () { | ||||||
|  | 			socket.emit('admin.deleteAllEvents', function (err) { | ||||||
|  | 				if (err) { | ||||||
|  | 					return app.alertError(err.message); | ||||||
|  | 				} | ||||||
|  | 				$('.events-list').empty(); | ||||||
|  | 			}); | ||||||
|  | 		}); | ||||||
|  |  | ||||||
|  | 		$('.delete-event').on('click', function () { | ||||||
|  | 			var parentEl = $(this).parents('[data-eid]'); | ||||||
|  | 			var eid = parentEl.attr('data-eid'); | ||||||
|  | 			socket.emit('admin.deleteEvents', [eid], function (err) { | ||||||
|  | 				if (err) { | ||||||
|  | 					return app.alertError(err.message); | ||||||
|  | 				} | ||||||
|  | 				parentEl.remove(); | ||||||
|  | 			}); | ||||||
|  | 		}); | ||||||
|  |  | ||||||
| 		$('#apply').on('click', Events.refresh); | 		$('#apply').on('click', Events.refresh); | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -77,6 +77,14 @@ SocketAdmin.fireEvent = function (socket, data, callback) { | |||||||
| 	callback(); | 	callback(); | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | SocketAdmin.deleteEvents = function (socket, eids, callback) { | ||||||
|  | 	events.deleteEvents(eids, callback); | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | SocketAdmin.deleteAllEvents = function (socket, data, callback) { | ||||||
|  | 	events.deleteAll(callback); | ||||||
|  | }; | ||||||
|  |  | ||||||
| SocketAdmin.getSearchDict = async function (socket) { | SocketAdmin.getSearchDict = async function (socket) { | ||||||
| 	const settings = await user.getSettings(socket.uid); | 	const settings = await user.getSettings(socket.uid); | ||||||
| 	const lang = settings.userLang || meta.config.defaultLang || 'en-GB'; | 	const lang = settings.userLang || meta.config.defaultLang || 'en-GB'; | ||||||
|   | |||||||
| @@ -21,6 +21,7 @@ | |||||||
| 						<!-- ENDIF events.user.picture --> | 						<!-- ENDIF events.user.picture --> | ||||||
| 					</a> | 					</a> | ||||||
| 					<a href="{config.relative_path}/user/{events.user.userslug}" target="_blank">{events.user.username}</a> | 					<a href="{config.relative_path}/user/{events.user.userslug}" target="_blank">{events.user.username}</a> | ||||||
|  | 					<span class="pull-right delete-event"><i class="fa fa-trash-o"></i></span> | ||||||
| 					<span class="pull-right">{events.timestampISO}</span> | 					<span class="pull-right">{events.timestampISO}</span> | ||||||
| 					<pre class="well">{events.jsonString}</pre> | 					<pre class="well">{events.jsonString}</pre> | ||||||
| 				</div> | 				</div> | ||||||
| @@ -59,5 +60,12 @@ | |||||||
| 				</form> | 				</form> | ||||||
| 			</div> | 			</div> | ||||||
| 		</div> | 		</div> | ||||||
|  | 		<div class="panel panel-default"> | ||||||
|  | 			<div class="panel-body"> | ||||||
|  | 				<button class="btn btn-block btn-danger" data-action="clear"> | ||||||
|  | 					<i class="fa fa-eraser"></i> [[admin/advanced/events:delete-events]] | ||||||
|  | 				</button> | ||||||
|  | 			</div> | ||||||
|  | 		</div> | ||||||
| 	</div> | 	</div> | ||||||
| </div> | </div> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user