nodebb-plugin-onekite-calendar 2.0.35 → 2.0.37

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/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 2.0.37
2
+ - Les rappels validateurs et notifications d’expiration ne sont envoyés qu’aux membres du/des groupe(s) "personnes notifiées" (notifyGroups).
3
+
1
4
  # Changelog – calendar-onekite
2
5
 
3
6
  ## 1.3.27
package/lib/scheduler.js CHANGED
@@ -114,6 +114,28 @@ async function getValidatorUids(settings) {
114
114
  return Array.from(out);
115
115
  }
116
116
 
117
+
118
+ async function getNotifyUids(settings) {
119
+ const out = new Set();
120
+ const groupsCsv = normalizeAllowedGroups(settings && settings.notifyGroups);
121
+ for (const g of groupsCsv) {
122
+ try {
123
+ const members = await getMembersByGroupIdentifier(g);
124
+ normalizeUids(members).forEach((u) => out.add(u));
125
+ } catch (e) {}
126
+ }
127
+ return Array.from(out);
128
+ }
129
+
130
+ async function getNotifiedValidatorUids(settings) {
131
+ const [validators, notified] = await Promise.all([
132
+ getValidatorUids(settings),
133
+ getNotifyUids(settings),
134
+ ]);
135
+ const notifiedSet = new Set((notified || []).map((u) => parseInt(u, 10)).filter(Number.isFinite));
136
+ return (validators || []).filter((u) => notifiedSet.has(parseInt(u, 10)));
137
+ }
138
+
117
139
  // Pending holds: short lock after a user creates a request (defaults to 5 minutes)
118
140
  async function expirePending() {
119
141
  const settings = await meta.settings.get('calendar-onekite');
@@ -146,7 +168,7 @@ async function expirePending() {
146
168
  return base ? `${base}/admin/plugins/calendar-onekite` : '/admin/plugins/calendar-onekite';
147
169
  })();
148
170
 
149
- const validatorUids = validatorReminderMins > 0 ? await getValidatorUids(settings) : [];
171
+ const validatorUids = validatorReminderMins > 0 ? await getNotifiedValidatorUids(settings) : [];
150
172
 
151
173
  const ids = await dbLayer.listAllReservationIds(5000);
152
174
  if (!ids || !ids.length) return;
@@ -209,7 +231,7 @@ async function expirePending() {
209
231
 
210
232
  // Validators info email (best-effort)
211
233
  if (firstExpired) {
212
- const validators = await getValidatorUids(settings);
234
+ const validators = await getNotifiedValidatorUids(settings);
213
235
  for (const vuid of validators) {
214
236
  await sendEmail('calendar-onekite_validator_expired', vuid, 'Location matériel - Demande expirée', {
215
237
  rid,
@@ -350,7 +372,7 @@ async function processAwaitingPayment() {
350
372
 
351
373
  // Validators info email (best-effort)
352
374
  if (shouldEmail) {
353
- const validators = await getValidatorUids(settings);
375
+ const validators = await getNotifiedValidatorUids(settings);
354
376
  for (const vuid of validators) {
355
377
  await sendEmail('calendar-onekite_validator_expired', vuid, 'Location matériel - Demande expirée', {
356
378
  rid: r.rid || rid,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-onekite-calendar",
3
- "version": "2.0.35",
3
+ "version": "2.0.37",
4
4
  "description": "FullCalendar-based equipment reservation workflow with admin approval & HelloAsso payment for NodeBB",
5
5
  "main": "library.js",
6
6
  "license": "MIT",
@@ -11,4 +11,4 @@
11
11
  "nbbpm": {
12
12
  "compatibility": "^4.0.0"
13
13
  }
14
- }
14
+ }
package/plugin.json CHANGED
@@ -39,5 +39,5 @@
39
39
  "acpScripts": [
40
40
  "public/admin.js"
41
41
  ],
42
- "version": "2.0.35"
42
+ "version": "2.0.37"
43
43
  }
@@ -16,10 +16,6 @@
16
16
 
17
17
  <!-- IF pickupTime -->
18
18
  <p><strong>Heure de récupération :</strong> {pickupTime}</p>
19
-
20
- <!-- IF pickupAddress -->
21
- <p><strong>Adresse :</strong> {pickupAddress}</p>
22
- <!-- ENDIF pickupAddress -->
23
19
  <!-- ENDIF pickupTime -->
24
20
 
25
21
  <!-- IF pickupAddress -->
@@ -10,14 +10,18 @@
10
10
 
11
11
  <p>{dateRange}</p>
12
12
 
13
+ <!-- IF pickupTime -->
14
+ <p><strong>Heure de récupération :</strong> {pickupTime}</p>
15
+ <!-- ENDIF pickupTime -->
13
16
 
14
17
  <!-- IF pickupAddress -->
15
- <p><strong>Adresse :</strong> {pickupAddress}</p>
18
+ <p><strong>Adresse de récupération :</strong><br>{pickupAddress}</p>
16
19
  <!-- ENDIF pickupAddress -->
17
20
 
18
21
  <!-- IF mapUrl -->
19
22
  <p style="font-size: 12px; color: #666;"><strong>Voir sur la carte :</strong> <a href="{mapUrl}">OpenStreetMap</a></p>
20
23
  <!-- ENDIF mapUrl -->
24
+
21
25
  <!-- IF paymentReceiptUrl -->
22
26
  <p><strong>Reçu :</strong> <a href="{paymentReceiptUrl}">{paymentReceiptUrl}</a></p>
23
27
  <!-- ENDIF paymentReceiptUrl -->