mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-10 16:05:49 +01:00
feat: merge consecutive share events
This commit is contained in:
@@ -85,12 +85,24 @@ define('forum/topic/threadTools', [
|
||||
|
||||
topicContainer.on('click', '[component="topic/event/delete"]', function () {
|
||||
const eventId = $(this).attr('data-topic-event-id');
|
||||
const eventEl = $(this).parents('[component="topic/event"]');
|
||||
const eventEl = $(this).parents('[data-topic-event-id]');
|
||||
bootbox.confirm('[[topic:delete-event-confirm]]', (ok) => {
|
||||
if (ok) {
|
||||
api.del(`/topics/${tid}/events/${eventId}`, {})
|
||||
.then(function () {
|
||||
const itemsParent = eventEl.parents('[component="topic/event/items"]');
|
||||
eventEl.remove();
|
||||
if (itemsParent.length) {
|
||||
const childrenCount = itemsParent.children().length;
|
||||
const eventParent = itemsParent.parents('[component="topic/event"]');
|
||||
if (!childrenCount) {
|
||||
eventParent.remove();
|
||||
} else {
|
||||
eventParent
|
||||
.find('[data-bs-toggle]')
|
||||
.translateText(`[[topic:announcers-x, ${childrenCount}]]`);
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(alerts.error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user