Skip to content

Commit

Permalink
Merge pull request #91 from yaal-coop/issue-80-academy-metadata
Browse files Browse the repository at this point in the history
Passage de l'académie des utilisateurs dans les métadonnées BBB
  • Loading branch information
klorydryk committed Mar 29, 2024
2 parents f0fdf47 + 62537b9 commit fd8b048
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions web/b3desk/models/bbb.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,12 @@ def create(self):
params["logoutURL"] = str(param)
if param := self.meeting.duration:
params["duration"] = str(param)

# Pass the academy for statisticts purpose
# https://github.com/numerique-gouv/b3desk/issues/80
if self.meeting.user and self.meeting.user.mail_domain:
params["meta_academy"] = self.meeting.user.mail_domain

bigbluebutton_analytics_callback_url = current_app.config[
"BIGBLUEBUTTON_ANALYTICS_CALLBACK_URL"
]
Expand Down
4 changes: 4 additions & 0 deletions web/b3desk/models/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,10 @@ def hash(self):
def can_create_meetings(self):
return len(self.meetings) < current_app.config["MAX_MEETINGS_PER_USER"]

@property
def mail_domain(self):
return self.email.split("@")[1] if self.email and "@" in self.email else None

def save(self):
db.session.add(self)
db.session.commit()
Expand Down
4 changes: 4 additions & 0 deletions web/tests/meeting/test_meeting.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ def test_create_no_file(client_app, meeting, mocker, bbb_response):
"name": "My Meeting",
"meetingKeepEvents": "true",
"meta_analytics-callback-url": "https://bbb-analytics-staging.osc-fr1.scalingo.io/v1/post_events",
"meta_academy": "domain.tld",
"attendeePW": "Password1",
"moderatorPW": "Password2",
"welcome": "Welcome!",
Expand Down Expand Up @@ -383,6 +384,7 @@ def test_create_with_only_a_default_file(
"name": "My Meeting",
"meetingKeepEvents": "true",
"meta_analytics-callback-url": "https://bbb-analytics-staging.osc-fr1.scalingo.io/v1/post_events",
"meta_academy": "domain.tld",
"attendeePW": "Password1",
"moderatorPW": "Password2",
"welcome": "Welcome!",
Expand Down Expand Up @@ -475,6 +477,7 @@ def test_create_with_files(
"name": "My Meeting",
"meetingKeepEvents": "true",
"meta_analytics-callback-url": "https://bbb-analytics-staging.osc-fr1.scalingo.io/v1/post_events",
"meta_academy": "domain.tld",
"attendeePW": "Password1",
"moderatorPW": "Password2",
"welcome": "Welcome!",
Expand Down Expand Up @@ -562,6 +565,7 @@ def test_create_quick_meeting(client_app, monkeypatch, user, mocker, bbb_respons
"duration": "280",
"meetingKeepEvents": "true",
"meta_analytics-callback-url": "https://bbb-analytics-staging.osc-fr1.scalingo.io/v1/post_events",
"meta_academy": "domain.tld",
"moderatorOnlyMessage": f"Bienvenue aux modérateurs. Pour inviter quelqu'un à ce séminaire, envoyez-lui l'un de ces liens :\n\n Lien Modérateur :\n\nhttp://localhost:5000/meeting/signin/moderateur/{meeting.fake_id}/creator/1/hash/{meeting.get_hash(Role.moderator)}\n\n Lien Participant :\n\nhttp://localhost:5000/meeting/signin/invite/{meeting.fake_id}/creator/1/hash/{meeting.get_hash(Role.attendee)}",
"guestPolicy": "ALWAYS_ACCEPT",
"checksum": mock.ANY,
Expand Down

0 comments on commit fd8b048

Please sign in to comment.