Change the way notifications are triggered

And send the name of the participant in the notification email (only if name is asked before you can join)
master
Daniel Berteaud 11 years ago
parent d56d875a7f
commit b3a613ddc7
  1. 1
      lib/Vroom/I18N/en.pm
  2. 1
      lib/Vroom/I18N/fr.pm
  3. 19
      public/js/vroom.js
  4. 36
      public/vroom.pl
  5. 5
      templates/default/notification.email_html.ep
  6. 4
      templates/default/notification.email_text.ep

@ -94,6 +94,7 @@ our %Lexicon = (
"s_WONT_BE_NOTIFIED_ANYMORE" => "%s won't be notified anymore", "s_WONT_BE_NOTIFIED_ANYMORE" => "%s won't be notified anymore",
"JOIN_NOTIFICATION" => "Someone joined the room", "JOIN_NOTIFICATION" => "Someone joined the room",
"SOMEONE_JOINED_A_ROOM" => "Someone joined a video conference room, and your address is configured to receive this notifications", "SOMEONE_JOINED_A_ROOM" => "Someone joined a video conference room, and your address is configured to receive this notifications",
"PARTICIPANT_NAME" => "The one who just joined your room is named",
"AUTH_SUCCESS" => "You are now authenticated", "AUTH_SUCCESS" => "You are now authenticated",
"NOT_ALLOWED" => "You are not allowed to do this", "NOT_ALLOWED" => "You are not allowed to do this",
"WRONG_PASSWORD" => "Wrong password", "WRONG_PASSWORD" => "Wrong password",

@ -100,6 +100,7 @@ our %Lexicon = (
"s_WONT_BE_NOTIFIED_ANYMORE" => "%s ne recevra plus les notifications pour ce salon", "s_WONT_BE_NOTIFIED_ANYMORE" => "%s ne recevra plus les notifications pour ce salon",
"JOIN_NOTIFICATION" => "Quelqu'un a rejoint votre salon", "JOIN_NOTIFICATION" => "Quelqu'un a rejoint votre salon",
"SOMEONE_JOINED_A_ROOM" => "Quelqu'un a rejoint un salon de vidéo conférence, et votre adresse est configurée pour recevoir ces notifications", "SOMEONE_JOINED_A_ROOM" => "Quelqu'un a rejoint un salon de vidéo conférence, et votre adresse est configurée pour recevoir ces notifications",
"PARTICIPANT_NAME" => "La personne qui a rejoint votre salon se nomme",
"AUTH_SUCCESS" => "Vous êtes maintenant authentifié", "AUTH_SUCCESS" => "Vous êtes maintenant authentifié",
"NOT_ALLOWED" => "Vous n'êtes pas autorisé à faire ceci", "NOT_ALLOWED" => "Vous n'êtes pas autorisé à faire ceci",
"WRONG_PASSWORD" => "Mauvais mot de passe", "WRONG_PASSWORD" => "Mauvais mot de passe",

@ -830,6 +830,25 @@ function initVroom(room) {
}); });
} }
}, 10000); }, 10000);
// Notify the frontend a new participant has joined
$.ajax({
data: {
action: 'join',
room: roomName,
name: (peers.local.hasName) ? peers.local.displayName : ''
},
error: function(data) {
$.notify(locale.ERROR_OCCURED, 'error');
},
success: function(data) {
if (data.status == 'success' && data.msg){
$.notify(data.msg, 'success');
}
else{
$.notify(data.msg, 'error');
}
}
});
}); });
// Handle new video stream added: someone joined the room // Handle new video stream added: someone joined the room

@ -609,19 +609,6 @@ get '/(*room)' => sub {
room => $room room => $room
); );
} }
# Send notifications
foreach my $rcpt ($self->get_notification($room)){
$self->email(
header => [
Subject => encode("MIME-Header", $self->l("JOIN_NOTIFICATION")),
To => $rcpt
],
data => [
template => 'notification',
room => $room,
],
);
}
# Now display the room page # Now display the room page
$self->render('join', $self->render('join',
format => 'html', format => 'html',
@ -879,6 +866,29 @@ post '/action' => sub {
} }
); );
} }
# New participant joined the room
elsif ($action eq 'join'){
my $name = $self->param('name') || '';
# Send notifications
foreach my $rcpt ($self->get_notification($room)){
$self->email(
header => [
Subject => encode("MIME-Header", $self->l("JOIN_NOTIFICATION")),
To => $rcpt
],
data => [
template => 'notification',
room => $room,
name => $name
],
);
}
return $self->render(
json => {
status => 'success'
}
);
}
}; };
# use the templates defined in the config # use the templates defined in the config

@ -5,6 +5,11 @@
<p> <p>
<%=l 'SOMEONE_JOINED_A_ROOM' %> <%=l 'SOMEONE_JOINED_A_ROOM' %>
</p> </p>
<% if ($name && $name ne ''){ %>
<p>
<%=l 'PARTICIPANT_NAME' %>: <%= $name %>
</p>
<% } %>
<p> <p>
<%=l 'WHEN_YOU_ARE_READY' %> <%=l 'WHEN_YOU_ARE_READY' %>
<center> <center>

@ -4,6 +4,10 @@
%> %>
<%==l 'SOMEONE_JOINED_A_ROOM' %> <%==l 'SOMEONE_JOINED_A_ROOM' %>
<% if ($name && $name ne ''){ %>
<%=l 'PARTICIPANT_NAME' %>: <%== $name %>
<% } %>
<%=l 'WHEN_YOU_ARE_READY' %> <%=l 'WHEN_YOU_ARE_READY' %>
<%== $url . $room %> <%== $url . $room %>

Loading…
Cancel
Save