mirror of
https://github.com/Paris-est-Ludique/intranet.git
synced 2025-06-09 09:04:20 +02:00
Fix notification tiny bug
This commit is contained in:
parent
4273ea1603
commit
cef7c5f7b0
@ -21,7 +21,7 @@ export function AskParticipationDetails(asks: JSX.Element[], id: number): void {
|
|||||||
const [participationDetails] = useUserParticipationDetails()
|
const [participationDetails] = useUserParticipationDetails()
|
||||||
const tshirtSize = get(participationDetails, "tshirtSize", "")
|
const tshirtSize = get(participationDetails, "tshirtSize", "")
|
||||||
const food = get(participationDetails, "food", "")
|
const food = get(participationDetails, "food", "")
|
||||||
const needToShow = !tshirtSize && !food
|
const needToShow = !tshirtSize || !food
|
||||||
|
|
||||||
addAsk(
|
addAsk(
|
||||||
asks,
|
asks,
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { lowerFirst } from "lodash"
|
||||||
import { Request, Response, NextFunction } from "express"
|
import { Request, Response, NextFunction } from "express"
|
||||||
import webpush from "web-push"
|
import webpush from "web-push"
|
||||||
import {
|
import {
|
||||||
@ -107,10 +108,7 @@ async function notifyAboutAnnouncement(): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const audience = volunteerList.filter(
|
const audience = volunteerList.filter(
|
||||||
(v) =>
|
(v) => v.acceptsNotifs === "oui" && (v.active === "oui" || v.active === "peut-etre")
|
||||||
v.acceptsNotifs === "oui" &&
|
|
||||||
!v.discordId &&
|
|
||||||
(v.active === "oui" || v.active === "peut-etre")
|
|
||||||
)
|
)
|
||||||
|
|
||||||
console.error(
|
console.error(
|
||||||
@ -119,10 +117,17 @@ async function notifyAboutAnnouncement(): Promise<void> {
|
|||||||
.join(", ")}`
|
.join(", ")}`
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const announceDescription: string =
|
||||||
|
{
|
||||||
|
gazette: / - /.test(toSend.title)
|
||||||
|
? `la ${lowerFirst(toSend.title.replace(/.* - /, ""))}`
|
||||||
|
: `la gazette ${lowerFirst(toSend.title)}`,
|
||||||
|
"compte rendu": `le compte-rendu du ${lowerFirst(toSend.title)}`,
|
||||||
|
}[toSend.type] || toSend.title
|
||||||
|
|
||||||
audience.forEach((v) => {
|
audience.forEach((v) => {
|
||||||
sendNotifToVolunteer(v, {
|
sendNotifToVolunteer(v, {
|
||||||
message:
|
message: `Clique-moi pour voir ${announceDescription}`,
|
||||||
"Clique-moi pour voir la gazette de février dans la page Annonces !\n\nFini les emails/spam, cette notification est notre nouveau moyen de te prévenir :)",
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user