Bug 1109511: listen for the 'delete' event to update the toolbar icon when a room is deleted. r=Niko

This commit is contained in:
Mike de Boer 2014-12-12 16:39:17 +01:00
Родитель 1186e7affc
Коммит 8635e10457
2 изменённых файлов: 5 добавлений и 3 удалений

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

@ -135,7 +135,7 @@ let LoopRoomsInternal = {
get participantsCount() {
let count = 0;
for (let room of this.rooms.values()) {
if (!("participants" in room)) {
if (room.deleted || !("participants" in room)) {
continue;
}
count += room.participants.length;

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

@ -1073,11 +1073,13 @@ this.MozLoopService = {
// The Loop toolbar button should change icon when the room participant count
// changes from 0 to something.
const onRoomsChange = () => {
MozLoopServiceInternal.notifyStatusChanged();
const onRoomsChange = (e) => {
// Pass the event name as notification reason for better logging.
MozLoopServiceInternal.notifyStatusChanged("room-" + e);
};
LoopRooms.on("add", onRoomsChange);
LoopRooms.on("update", onRoomsChange);
LoopRooms.on("delete", onRoomsChange);
LoopRooms.on("joined", (e, room, participant) => {
// Don't alert if we're in the doNotDisturb mode, or the participant
// is the owner - the content code deals with the rest of the sounds.