Base message on number of users and additional message on type of room

Before, the message explicitly mentioned the other user and her avatar
was used as the icon only for one to one rooms. Now that will be done
for any type of room if there is only another registered user and no
guests in that room.

In a similar way, the additional message hinting how to invite other
users now is always shown in group and public rooms, no matter how many
users are currently in the room; this is the same as before for public
rooms, although it was changed for consistency for group rooms, as in
that case the message was shown only when there were no other
participants in the room.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
Daniel Calviño Sánchez 2018-12-02 18:11:06 +01:00
Родитель 8fcf7369a6
Коммит e32a910f50
1 изменённых файлов: 32 добавлений и 38 удалений

Просмотреть файл

@ -634,51 +634,45 @@
var url = '';
var participants = this.activeRoom.get('participants');
var numberOfParticipants = Object.keys(participants).length;
switch(this.activeRoom.get('type')) {
case OCA.SpreedMe.app.ROOM_TYPE_ONE_TO_ONE:
var participantId = '',
participantName = '';
if (this.activeRoom.get('type') === OCA.SpreedMe.app.ROOM_TYPE_PUBLIC) {
icon = 'icon-public';
} else {
icon = 'icon-contacts-dark';
}
_.each(participants, function(data, userId) {
if (OC.getCurrentUser().uid !== userId) {
participantId = userId;
participantName = data.name;
}
});
if (numberOfParticipants === 1 && this.activeRoom.get('numGuests') === 0) {
message = t('spreed', 'No other people in this call');
} else if (numberOfParticipants === 2 && this.activeRoom.get('numGuests') === 0) {
var participantId = '',
participantName = '';
icon = { userId: participantId, displayName: participantName};
message = t('spreed', 'Waiting for {participantName} to join the call …', {participantName: participantName});
break;
case OCA.SpreedMe.app.ROOM_TYPE_PUBLIC:
case OCA.SpreedMe.app.ROOM_TYPE_GROUP:
if (this.activeRoom.get('type') === OCA.SpreedMe.app.ROOM_TYPE_PUBLIC) {
icon = 'icon-public';
} else {
icon = 'icon-contacts-dark';
_.each(participants, function(data, userId) {
if (OC.getCurrentUser().uid !== userId) {
participantId = userId;
participantName = data.name;
}
});
message = t('spreed', 'Waiting for others to join the call …');
icon = { userId: participantId, displayName: participantName};
if (OC.getCurrentUser().uid !== null && Object.keys(participants).length === 1) {
message = t('spreed', 'No other people in this call');
if (this.activeRoom.get('participantType') === OCA.SpreedMe.app.OWNER || this.activeRoom.get('participantType') === OCA.SpreedMe.app.MODERATOR) {
messageAdditional = t('spreed', 'You can invite others in the participant tab of the sidebar');
}
}
message = t('spreed', 'Waiting for {participantName} to join the call …', {participantName: participantName});
} else {
message = t('spreed', 'Waiting for others to join the call …');
}
if (this.activeRoom.get('type') === OCA.SpreedMe.app.ROOM_TYPE_PUBLIC) {
messageAdditional = t('spreed', 'Share this link to invite others!');
if (this.activeRoom.get('participantType') === OCA.SpreedMe.app.OWNER || this.activeRoom.get('participantType') === OCA.SpreedMe.app.MODERATOR) {
messageAdditional = t('spreed', 'You can invite others in the participant tab of the sidebar or share this link to invite others!');
}
url = window.location.protocol + '//' + window.location.host + OC.generateUrl('/call/' + this.activeRoom.get('token'));
}
break;
default:
console.log("Unknown room type", this.activeRoom.get('type'));
return;
if (this.activeRoom.get('type') === OCA.SpreedMe.app.ROOM_TYPE_GROUP &&
(this.activeRoom.get('participantType') === OCA.SpreedMe.app.OWNER || this.activeRoom.get('participantType') === OCA.SpreedMe.app.MODERATOR)) {
messageAdditional = t('spreed', 'You can invite others in the participant tab of the sidebar');
} else if (this.activeRoom.get('type') === OCA.SpreedMe.app.ROOM_TYPE_PUBLIC) {
messageAdditional = t('spreed', 'Share this link to invite others!');
if (this.activeRoom.get('participantType') === OCA.SpreedMe.app.OWNER || this.activeRoom.get('participantType') === OCA.SpreedMe.app.MODERATOR) {
messageAdditional = t('spreed', 'You can invite others in the participant tab of the sidebar or share this link to invite others!');
}
url = window.location.protocol + '//' + window.location.host + OC.generateUrl('/call/' + this.activeRoom.get('token'));
}
OCA.SpreedMe.app.setEmptyContentMessage(icon, message, messageAdditional, url);