Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.13.5 - Mise en prod 30/03/2021 #990

Merged
merged 21 commits into from
Mar 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
3078114
Mise à jour sentry à la dernière version pour passage à Sentry.io (#973)
jdauphant Mar 23, 2021
1962bff
Répare l’erreur d’export des demandes en CSV (#975)
niladic Mar 23, 2021
fde30d9
Bump webpack-cli from 4.3.1 to 4.5.0 (#945)
dependabot[bot] Mar 24, 2021
c7fa725
Update postgresql to 42.2.19 (#955)
scala-steward Mar 24, 2021
787def3
Update sbt-scalafix to 0.9.26 (#960)
scala-steward Mar 24, 2021
7d7adc9
Bump webpack from 5.21.2 to 5.27.2 (#976)
dependabot[bot] Mar 24, 2021
ae6f9cb
Update sbt to 1.4.9 (#969)
scala-steward Mar 24, 2021
3b0c070
Bump typescript from 4.1.3 to 4.2.3 (#968)
dependabot[bot] Mar 24, 2021
beedfb6
Bump actions/setup-node from v2.1.4 to v2.1.5 (#963)
dependabot[bot] Mar 24, 2021
e734042
Update scala-csv to 1.3.7 (#959)
scala-steward Mar 24, 2021
1c1ed74
Bump ts-loader from 8.0.14 to 8.0.18 (#970)
dependabot[bot] Mar 24, 2021
6b83818
Update .scala-steward.conf (#977)
niladic Mar 24, 2021
868385b
Update anorm to 2.6.10 (#965)
scala-steward Mar 24, 2021
10da374
Update vers scala 2.13.5 (#978)
niladic Mar 24, 2021
4ee6890
Update material-design-icons to 4.0.0 (#943)
scala-steward Mar 24, 2021
9027b2f
Ajoute l'organisme Association (#979)
niladic Mar 25, 2021
5c5134e
Ajoute la BAL dans la liste des utilisateurs (#980)
niladic Mar 25, 2021
b85b355
Les noms de groupes peuvent faire jusqu’à 100 caractères (#981)
niladic Mar 25, 2021
61d76c7
Corrige le deprecation warning onFailuresWithBackoff (#982)
niladic Mar 25, 2021
7a72fdb
Update scalatags to 0.9.4 (#983)
scala-steward Mar 25, 2021
4fd8c5b
Ajout d'infos manquantes dans les logs (utilisateur et demande) (#987)
niladic Mar 30, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up Node 10
uses: actions/setup-node@v2.1.4
uses: actions/setup-node@v2.1.5
with:
node-version: '10.x'
- name: Install npm dependencies
Expand Down
2 changes: 1 addition & 1 deletion .scala-steward.conf
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
updates.ignore = [ { groupId = "io.sentry", artifactId = "sentry-logback" } ]
updatePullRequests = "always"
updates.pin = [ { groupId = "com.fasterxml.jackson.core", artifactId = "jackson-databind", version="x.y." } ]
75 changes: 53 additions & 22 deletions app/controllers/ApplicationController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,16 @@ case class ApplicationController @Inject() (
eventService.log(
ApplicationCreated,
s"La demande ${application.id} a été créée",
Some(application)
application = application.some
)
application.invitedUsers.foreach { case (userId, _) =>
eventService.log(
ApplicationCreated,
s"Envoi de la nouvelle demande ${application.id} à l'utilisateur $userId",
application = application.some,
involvesUser = userId.some
)
}
applicationData.linkedMandat.foreach { mandatId =>
mandatService
.linkToApplication(Mandat.Id(mandatId), applicationId)
Expand All @@ -340,7 +348,7 @@ case class ApplicationController @Inject() (
underlyingException = Some(error)
)
case Success(Left(error)) =>
eventService.logError(error, application = Some(application))
eventService.logError(error, application = application.some)
case Success(Right(_)) =>
eventService.log(
ApplicationLinkedToMandat,
Expand Down Expand Up @@ -669,7 +677,7 @@ case class ApplicationController @Inject() (
eventService.log(
AllAsUnauthorized,
s"L'utilisateur n'a pas de droit d'afficher la vue de l'utilisateur $userId",
involvesUser = Some(user)
involvesUser = Some(user.id)
)
Future(
Unauthorized(
Expand All @@ -680,7 +688,7 @@ case class ApplicationController @Inject() (
eventService.log(
AllAsUnauthorized,
s"L'utilisateur n'a pas de droit d'afficher la vue de l'utilisateur admin $userId",
involvesUser = Some(user)
involvesUser = Some(user.id)
)
Future(
Unauthorized(
Expand All @@ -695,7 +703,7 @@ case class ApplicationController @Inject() (
.log(
AllAsShowed,
s"Visualise la vue de l'utilisateur $userId",
involvesUser = Some(user)
involvesUser = Some(user.id)
)
val applications = applicationService.allForUserId(
userId = targetUserId,
Expand Down Expand Up @@ -999,7 +1007,8 @@ case class ApplicationController @Inject() (
case Some(answer) if answer.files.getOrElse(Map.empty).contains(filename) =>
eventService.log(
FileOpened,
s"Le fichier de la réponse $answerId sur la demande $applicationId a été ouvert"
s"Le fichier de la réponse $answerId sur la demande $applicationId a été ouvert",
application = application.some
)
sendFile(
Paths.get(s"$filesPath/ans_$answerId-$filename"),
Expand All @@ -1009,7 +1018,8 @@ case class ApplicationController @Inject() (
case _ =>
eventService.log(
FileNotFound,
s"Le fichier de la réponse $answerId sur la demande $applicationId n'existe pas"
s"Le fichier de la réponse $answerId sur la demande $applicationId n'existe pas",
application = application.some
)
Future(NotFound("Nous n'avons pas trouvé ce fichier"))
}
Expand All @@ -1020,7 +1030,11 @@ case class ApplicationController @Inject() (
) =>
if (application.files.contains(filename)) {
eventService
.log(FileOpened, s"Le fichier de la demande $applicationId a été ouvert")
.log(
FileOpened,
s"Le fichier de la demande $applicationId a été ouvert",
application = application.some
)
sendFile(
Paths.get(s"$filesPath/app_$applicationId-$filename"),
filename,
Expand All @@ -1029,7 +1043,8 @@ case class ApplicationController @Inject() (
} else {
eventService.log(
FileNotFound,
s"Le fichier de la demande $applicationId n'existe pas"
s"Le fichier de la demande $applicationId n'existe pas",
application = application.some
)
Future(NotFound("Nous n'avons pas trouvé ce fichier"))
}
Expand Down Expand Up @@ -1070,7 +1085,7 @@ case class ApplicationController @Inject() (
formWithErrors => {
val error =
s"Erreur dans le formulaire de réponse (${formWithErrors.errors.map(_.message).mkString(", ")})."
eventService.log(AnswerNotCreated, s"$error")
eventService.log(AnswerNotCreated, s"$error", application = application.some)
Future(
Redirect(
routes.ApplicationController.show(applicationId).withFragment("answer-error")
Expand Down Expand Up @@ -1137,7 +1152,7 @@ case class ApplicationController @Inject() (
eventService.log(
AnswerNotCreated,
s"La réponse ${answer.id} n'a pas été créée sur la demande $applicationId : problème BDD",
Some(application)
application.some
)
Future(InternalServerError("Votre réponse n'a pas pu être envoyée"))
}
Expand All @@ -1164,7 +1179,7 @@ case class ApplicationController @Inject() (
formWithErrors => {
val error =
s"Erreur dans le formulaire d’invitation (${formWithErrors.errors.map(_.message).mkString(", ")})."
eventService.log(InviteNotCreated, error)
eventService.log(InviteNotCreated, error, application = application.some)
Future(
Redirect(
routes.ApplicationController.show(applicationId).withFragment("answer-error")
Expand All @@ -1176,7 +1191,7 @@ case class ApplicationController @Inject() (
if (inviteData.invitedUsers.isEmpty && inviteData.invitedGroups.isEmpty) {
val error =
s"Erreur dans le formulaire d’invitation (une personne ou un organisme doit être sélectionné)."
eventService.log(InviteNotCreated, error)
eventService.log(InviteNotCreated, error, application = application.some)
Future(
Redirect(
routes.ApplicationController.show(applicationId).withFragment("answer-error")
Expand Down Expand Up @@ -1218,16 +1233,24 @@ case class ApplicationController @Inject() (
notificationsService.newAnswer(application, answer)
eventService.log(
AgentsAdded,
s"L'ajout d'utilisateur ${answer.id} a été créé sur la demande $applicationId",
Some(application)
s"L'ajout d'utilisateur (réponse ${answer.id}) a été créé sur la demande $applicationId",
application = application.some
)
answer.invitedUsers.foreach { case (userId, _) =>
eventService.log(
AgentsAdded,
s"Utilisateur $userId invité sur la demande $applicationId (réponse ${answer.id})",
application = application.some,
involvesUser = userId.some
)
}
Redirect(routes.ApplicationController.myApplications())
.flashing(success -> "Les utilisateurs ont été invités sur la demande")
} else {
eventService.log(
AgentsNotAdded,
s"L'ajout d'utilisateur ${answer.id} n'a pas été créé sur la demande $applicationId : problème BDD",
Some(application)
application = application.some
)
InternalServerError("Les utilisateurs n'ont pas pu être invités")
}
Expand Down Expand Up @@ -1266,8 +1289,16 @@ case class ApplicationController @Inject() (
eventService.log(
AddExpertCreated,
s"La réponse ${answer.id} a été créée sur la demande $applicationId",
Some(application)
application = application.some
)
answer.invitedUsers.foreach { case (userId, _) =>
eventService.log(
AddExpertCreated,
s"Expert $userId invité sur la demande $applicationId (réponse ${answer.id})",
application = application.some,
involvesUser = userId.some
)
}
Redirect(routes.ApplicationController.myApplications())
.flashing(success -> "Un expert a été invité sur la demande")
} else {
Expand Down Expand Up @@ -1298,25 +1329,24 @@ case class ApplicationController @Inject() (
def reopen(applicationId: UUID): Action[AnyContent] =
loginAction.async { implicit request =>
withApplication(applicationId) { application: Application =>
import eventService._
successful(application.canBeOpenedBy(request.currentUser)).flatMap {
case true =>
applicationService
.reopen(applicationId)
.filter(identity)
.map { _ =>
val message = "La demande a bien été réouverte"
log(ReopenCompleted, message, application.some)
eventService.log(ReopenCompleted, message, application.some)
Redirect(routes.ApplicationController.myApplications()).flashing(success -> message)
}
.recover { _ =>
val message = "La demande n'a pas pu être réouverte"
log(ReopenError, message, application.some)
eventService.log(ReopenError, message, application.some)
InternalServerError(message)
}
case false =>
val message = s"Non autorisé à réouvrir la demande $applicationId"
log(ReopenUnauthorized, message, application.some)
eventService.log(ReopenUnauthorized, message, application.some)
successful(Unauthorized(message))
}
}
Expand All @@ -1330,7 +1360,8 @@ case class ApplicationController @Inject() (
eventService
.log(
TerminateIncompleted,
s"La demande de clôture pour $applicationId est incomplète"
s"La demande de clôture pour $applicationId est incomplète",
application = application.some
)
Future(
BadGateway(
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/CSVImportController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ case class CSVImportController @Inject() (
},
Option.apply
),
"name" -> text(maxLength = 60)
"name" -> text(maxLength = UserGroup.nameMaxLength)
.transform[String](commonStringInputNormalization, commonStringInputNormalization),
"description" -> optional(text).transform[Option[String]](
_.map(commonStringInputNormalization).filter(_.nonEmpty),
Expand Down Expand Up @@ -433,7 +433,7 @@ case class CSVImportController @Inject() (
eventService.log(
UserCreated,
s"Utilisateur ajouté ${user.toLogString}",
involvesUser = Some(user)
involvesUser = Some(user.id)
)
}
eventService
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/GroupController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ case class GroupController @Inject() (
Form(
mapping(
"id" -> ignored(UUID.randomUUID()),
"name" -> text(maxLength = 60)
"name" -> text(maxLength = UserGroup.nameMaxLength)
.transform[String](commonStringInputNormalization, commonStringInputNormalization),
"description" -> optional(text).transform[Option[String]](
_.map(commonStringInputNormalization).filter(_.nonEmpty),
Expand Down
Loading