nodebb-plugin-calendar-onekite 11.1.32 → 11.1.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/library.js +15 -0
- package/package.json +1 -1
- package/public/client.js +19 -1
package/library.js
CHANGED
|
@@ -80,6 +80,21 @@ Plugin.init = async function (params) {
|
|
|
80
80
|
router.post(`${base}/purge`, ...adminMws, admin.purgeByYear);
|
|
81
81
|
router.get(`${base}/debug`, ...adminMws, admin.debugHelloAsso);
|
|
82
82
|
});
|
|
83
|
+
|
|
84
|
+
// HelloAsso callback endpoint (observation mode)
|
|
85
|
+
// We intentionally do not require any parameters here. We simply log what we
|
|
86
|
+
// receive and return JSON { ok: true }.
|
|
87
|
+
router.all('/helloasso', (req, res) => {
|
|
88
|
+
// eslint-disable-next-line no-console
|
|
89
|
+
console.log('[HelloAsso CALLBACK]', {
|
|
90
|
+
method: req.method,
|
|
91
|
+
headers: req.headers,
|
|
92
|
+
query: req.query,
|
|
93
|
+
body: req.body,
|
|
94
|
+
});
|
|
95
|
+
res.json({ ok: true });
|
|
96
|
+
});
|
|
97
|
+
|
|
83
98
|
scheduler.start();
|
|
84
99
|
};
|
|
85
100
|
|
package/package.json
CHANGED
package/public/client.js
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
define('forum/calendar-onekite', ['alerts', 'bootbox', 'hooks'], function (alerts, bootbox, hooks) {
|
|
4
4
|
'use strict';
|
|
5
5
|
|
|
6
|
+
// Prevent the reservation dialog from opening twice due to select/dateClick
|
|
7
|
+
// interactions or quick re-renders.
|
|
8
|
+
let isDialogOpen = false;
|
|
9
|
+
|
|
6
10
|
function showAlert(type, msg) {
|
|
7
11
|
try {
|
|
8
12
|
if (alerts && typeof alerts[type] === 'function') {
|
|
@@ -115,13 +119,23 @@ define('forum/calendar-onekite', ['alerts', 'bootbox', 'hooks'], function (alert
|
|
|
115
119
|
}
|
|
116
120
|
},
|
|
117
121
|
select: async function (info) {
|
|
122
|
+
if (isDialogOpen) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
isDialogOpen = true;
|
|
118
126
|
try {
|
|
119
127
|
if (!items || !items.length) {
|
|
120
128
|
showAlert('error', 'Aucun matériel disponible (items HelloAsso non chargés).');
|
|
129
|
+
calendar.unselect();
|
|
130
|
+
isDialogOpen = false;
|
|
121
131
|
return;
|
|
122
132
|
}
|
|
123
133
|
const chosen = await openReservationDialog(info, items);
|
|
124
|
-
if (!chosen || !chosen.itemId)
|
|
134
|
+
if (!chosen || !chosen.itemId) {
|
|
135
|
+
calendar.unselect();
|
|
136
|
+
isDialogOpen = false;
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
125
139
|
// Send date strings (no hours) so reservations are day-based.
|
|
126
140
|
await requestReservation({
|
|
127
141
|
start: info.startStr,
|
|
@@ -131,8 +145,12 @@ define('forum/calendar-onekite', ['alerts', 'bootbox', 'hooks'], function (alert
|
|
|
131
145
|
});
|
|
132
146
|
showAlert('success', 'Demande envoyée (en attente de validation).');
|
|
133
147
|
calendar.refetchEvents();
|
|
148
|
+
calendar.unselect();
|
|
149
|
+
isDialogOpen = false;
|
|
134
150
|
} catch (e) {
|
|
135
151
|
showAlert('error', 'Impossible de créer la demande (droits/groupe ?).');
|
|
152
|
+
calendar.unselect();
|
|
153
|
+
isDialogOpen = false;
|
|
136
154
|
}
|
|
137
155
|
},
|
|
138
156
|
dateClick: async function (info) {
|