nodebb-plugin-onekite-calendar 2.0.69 → 2.0.70
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/lib/discord.js +4 -4
- package/lib/shared.js +1 -0
- package/lib/widgets.js +1 -2
- package/package.json +1 -1
- package/plugin.json +1 -1
- package/public/client.js +8 -2
package/lib/discord.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const https = require('https');
|
|
4
4
|
const { URL } = require('url');
|
|
5
|
-
const { formatFRShort } = require('./shared');
|
|
5
|
+
const { formatFRShort, forumBaseUrl } = require('./shared');
|
|
6
6
|
|
|
7
7
|
function isEnabled(v, defaultValue) {
|
|
8
8
|
if (v === undefined || v === null || v === '') return defaultValue !== false;
|
|
@@ -53,7 +53,7 @@ function postWebhook(webhookUrl, payload) {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
function buildReservationMessage(kind, reservation) {
|
|
56
|
-
const calUrl = '
|
|
56
|
+
const calUrl = forumBaseUrl() + '/calendar';
|
|
57
57
|
const username = reservation && reservation.username ? String(reservation.username) : '';
|
|
58
58
|
const items = (reservation && Array.isArray(reservation.itemNames) && reservation.itemNames.length)
|
|
59
59
|
? reservation.itemNames.map(String)
|
|
@@ -87,7 +87,7 @@ function buildWebhookPayload(kind, reservation) {
|
|
|
87
87
|
? 'Onekite • Paiement'
|
|
88
88
|
: (kind === 'cancelled' ? 'Onekite • Annulation' : 'Onekite • Réservation');
|
|
89
89
|
|
|
90
|
-
const calUrl = '
|
|
90
|
+
const calUrl = forumBaseUrl() + '/calendar';
|
|
91
91
|
const username = reservation && reservation.username ? String(reservation.username) : '';
|
|
92
92
|
const items = (reservation && Array.isArray(reservation.itemNames) && reservation.itemNames.length)
|
|
93
93
|
? reservation.itemNames.map(String)
|
|
@@ -186,7 +186,7 @@ async function notifyReservationCancelled(settings, reservation) {
|
|
|
186
186
|
|
|
187
187
|
function buildSimpleCalendarPayload(kind, label, entity, opts) {
|
|
188
188
|
const options = opts || {};
|
|
189
|
-
const calUrl = options.calUrl || '
|
|
189
|
+
const calUrl = options.calUrl || forumBaseUrl() + '/calendar';
|
|
190
190
|
const webhookUsername = options.webhookUsername || `Onekite • ${label}`;
|
|
191
191
|
|
|
192
192
|
const title = kind === 'deleted' ? '❌ ' + label + ' annulé(e)' : label + ' créé(e)';
|
package/lib/shared.js
CHANGED
package/lib/widgets.js
CHANGED
package/package.json
CHANGED
package/plugin.json
CHANGED
package/public/client.js
CHANGED
|
@@ -1266,8 +1266,14 @@ function toDatetimeLocalValue(date) {
|
|
|
1266
1266
|
}
|
|
1267
1267
|
|
|
1268
1268
|
if (typeof FullCalendar === 'undefined') {
|
|
1269
|
-
|
|
1270
|
-
|
|
1269
|
+
const loaded = await new Promise((resolve) => {
|
|
1270
|
+
const start = Date.now();
|
|
1271
|
+
const iv = setInterval(() => {
|
|
1272
|
+
if (typeof FullCalendar !== 'undefined') { clearInterval(iv); resolve(true); }
|
|
1273
|
+
else if (Date.now() - start > 5000) { clearInterval(iv); resolve(false); }
|
|
1274
|
+
}, 50);
|
|
1275
|
+
});
|
|
1276
|
+
if (!loaded) { showAlert('error', 'FullCalendar non chargé'); return; }
|
|
1271
1277
|
}
|
|
1272
1278
|
|
|
1273
1279
|
const items = await loadItems();
|