Merge pull request #95 from nextcloud/leave-room

Add leave room functionality.
This commit is contained in:
Jan-Christoph Borchardt 2016-11-16 17:17:04 +01:00 коммит произвёл GitHub
Родитель 3daf333153 bade8c945a
Коммит b4b238825b
2 изменённых файлов: 13 добавлений и 2 удалений

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

@ -125,7 +125,18 @@
console.log("share group", this.model.get('id'));
},
leaveGroup: function() {
console.log("leave group", this.model.get('id'));
//If user is in that room, it should leave that room first.
if (this.model.get('active')) {
OCA.SpreedMe.webrtc.leaveRoom();
window.location.replace(window.location.href.slice(0, -window.location.hash.length));
}
this.$el.slideUp();
$.ajax({
url: OC.generateUrl('/apps/spreed/api/room/') + this.model.get('id'),
type: 'DELETE'
});
}
});

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

@ -115,7 +115,7 @@ class Room {
public function removeUser(IUser $user) {
$query = $this->db->getQueryBuilder();
$query->delete('spreedme_room_participants')
->where($query->expr()->eq('id', $query->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT)))
->where($query->expr()->eq('roomId', $query->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT)))
->andWhere($query->expr()->eq('userId', $query->createNamedParameter($user->getUID())));
$query->execute();
}