-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'staging' into add_crisp_chatbox_for_agents
- Loading branch information
Showing
35 changed files
with
277 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
require "ipaddr" | ||
|
||
module Brevo::IpWhitelistConcern | ||
extend ActiveSupport::Concern | ||
|
||
# IP list comes from | ||
# https://help.brevo.com/hc/en-us/articles/15127404548498-Brevo-IP-ranges-List-of-publicly-exposed-services#h_01HENC062K8KJKJE7BJNYMPM77 | ||
IP_WHITELIST_RANGE = "1.179.112.0/20".freeze | ||
|
||
included do | ||
before_action :ensure_ip_comes_from_brevo_ips | ||
end | ||
|
||
private | ||
|
||
def ensure_ip_comes_from_brevo_ips | ||
# In case Brevo decides to use some other IP range without notice | ||
# we need a quick way to skip this check | ||
return if ENV["DISABLE_BREVO_IP_WHITELIST"].present? | ||
|
||
return if IPAddr.new(IP_WHITELIST_RANGE).include?(request.remote_ip) | ||
|
||
Sentry.capture_message("Brevo Webhook received with following non whitelisted IP", { | ||
extra: { | ||
ip: request.remote_ip | ||
} | ||
}) | ||
head :forbidden | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
class MotifCategoryPolicy < ApplicationPolicy | ||
def self.authorized_for_organisation(organisation) | ||
if organisation.rsa_related? | ||
MotifCategory.where(motif_category_type: MotifCategory::RSA_RELATED_TYPES) | ||
else | ||
MotifCategory.where(motif_category_type: organisation.organisation_type) | ||
end | ||
end | ||
|
||
def self.authorized_for_organisation?(motif_category, organisation) | ||
return MotifCategory::RSA_RELATED_TYPES.include?(motif_category.motif_category_type) if organisation.rsa_related? | ||
|
||
organisation.organisation_type == motif_category.motif_category_type | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
<h3 class="pt-3 pb-5">Si vous résidez dans l’une des 29 communes listées ci-dessous, vous êtes concerné par une expérimentation du Conseil départemental des Bouches-du-Rhône visant à faciliter votre prise de rendez-vous RSA.</h3> | ||
<h5>À la suite de votre demande de RSA, un email et/ou un SMS va vous être transmis par le Conseil départemental pour fixer un premier rendez-vous d’orientation. Veuillez cliquer sur le lien contenu dans ce mail/SMS pour choisir un créneau à votre convenance.</h5> | ||
<br/> | ||
<p><u>Communes concernées :</u><mark> Marseille - 2e arrondissement, Marseille - 3e arrondissement, Arles, Aureille, Barbentane, Baux-de-Provence, Boulbon, Cabannes, Chateaurenard, Eygalières, Eyragues, Fontvieille, Graveson, Maillane, Mas-Blanc-des-Alpilles, Maussane-les-Alpilles, Saint-Pierre-de-Mézoargues, Molleges, Mouries, Noves, Orgon, Paradou, Plan-d'Orgon, Rognonas, Saint-Andiol, Saint-Etienne-du-Gres, Saintes-Maries-de-la-Mer, Saint-Martin-de-Crau, Saint-Rémy-de-Provence, Tarascon, Verquieres.</mark></p> | ||
<br/> | ||
<p>Si vous ne résidez pas dans l’une des 29 communes listées ci-dessus, vous n’êtes pas concerné par ces modalités de prise de rendez-vous et serez convié à votre rendez-vous d’orientation par courrier postal avec accusé de réception.</p> | ||
<p>Vous pouvez désormais choisir le jour et l’heure, les plus appropriés à votre emploi du temps, pour rencontrer le conseiller d’orientation qui définira avec vous les démarches et actions à mettre en œuvre pour faciliter votre insertion.</p> | ||
|
||
<p>À la suite de votre demande de RSA, un email et/ou un SMS vous sera transmis par le Conseil départemental pour fixer votre premier rendez-vous d’orientation. Cliquez sur le lien contenu dans ce mail/SMS pour choisir un créneau à votre convenance.</p> | ||
|
||
<p>Simple, rapide, facile le service « RENDEZ-VOUS INSERTION » est disponible sur tous les Pôles d’insertion des Bouches-du- Rhône est accessible en un clic.</p> |
5 changes: 5 additions & 0 deletions
5
db/migrate/20250120125249_change_agent_id_null_constraint_on_parcours_documents.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class ChangeAgentIdNullConstraintOnParcoursDocuments < ActiveRecord::Migration[7.1] | ||
def change | ||
change_column_null :parcours_documents, :agent_id, true | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
spec/features/agent_can_create_category_configuration_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
describe "Agents can edit category configuration", :js do | ||
let!(:agent) { create(:agent) } | ||
let!(:organisation) { create(:organisation, organisation_type: "delegataire_rsa") } | ||
let!(:agent_role) { create(:agent_role, organisation: organisation, agent: agent, access_level: "admin") } | ||
let!(:motif_category) do | ||
create( | ||
:motif_category, | ||
name: "RSA Follow up", | ||
short_name: "rsa_follow_up", | ||
motif_category_type: "rsa_accompagnement" | ||
) | ||
end | ||
|
||
let!(:category_configuration) { create(:category_configuration, organisation:, file_configuration:) } | ||
let(:file_configuration) { create(:file_configuration) } | ||
|
||
before do | ||
stub_rdv_solidarites_activate_motif_category_territories( | ||
organisation.rdv_solidarites_organisation_id, | ||
motif_category.short_name | ||
) | ||
setup_agent_session(agent) | ||
end | ||
|
||
context "category configuration edit" do | ||
it "allows to create category configuration" do | ||
visit new_organisation_category_configuration_path(organisation) | ||
|
||
fill_in "category_configuration_phone_number", with: "3234" | ||
fill_in "category_configuration_email_to_notify_rdv_changes", with: "test@test.com" | ||
fill_in "category_configuration_email_to_notify_no_available_slots", with: "test@test.com" | ||
|
||
select "RSA Follow up", from: "category_configuration[motif_category_id]" | ||
|
||
find("input[name=\"category_configuration[file_configuration_id]\"]").click | ||
|
||
click_button "Enregistrer" | ||
|
||
expect(page).to have_content("3234") | ||
expect(page).to have_content("test@test.com") | ||
|
||
new_category_configuration = CategoryConfiguration.last | ||
expect(new_category_configuration.reload.phone_number).to eq("3234") | ||
expect(new_category_configuration.email_to_notify_rdv_changes).to eq("test@test.com") | ||
expect(new_category_configuration.email_to_notify_no_available_slots).to eq("test@test.com") | ||
end | ||
|
||
context "motif category selection" do | ||
let!(:motif_category2) do | ||
create(:motif_category, name: "Autre", short_name: "autre", motif_category_type: "autre") | ||
end | ||
|
||
it "allows to select authorized motif categories" do | ||
visit new_organisation_category_configuration_path(organisation) | ||
|
||
expect(page).to have_select( | ||
"category_configuration[motif_category_id]", options: ["-", "RSA Follow up", | ||
category_configuration.motif_category.name] | ||
) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.