[lib.channel-controller] fix dump() to clear list before updating

This commit is contained in:
xdrm-brackets 2018-03-29 01:30:47 +02:00
parent d48d865be6
commit 4e4d80b7bb
2 changed files with 4 additions and 4 deletions

View File

@ -69,7 +69,7 @@ export default class ChannelController{
return false;
/* (2) Clear list () */
this.list.splice();
this.list.splice(0);
/* (3) Apply new channels */
for(let c of channels){
@ -201,11 +201,11 @@ export default class ChannelController{
create(name=null, link=null){
/* (1) Manage invalid @link */
if( typeof link !== 'string' || /^[a-z0-9-]$/i.test(link) )
if( typeof link !== 'string' )
return false;
/* (2) Manage invalid @name */
if( typeof name !== 'string' || !/^[a-z0-9\/_-]{3,}$/i.test(name) )
if( typeof name !== 'string' )
return false;
/* (3) Try to create room in API */

View File

@ -223,7 +223,7 @@ export default class RoomController{
return false;
/* (2) Manage invalid @name */
if( typeof name !== 'string' || !/^[a-z0-9\/_-]{3,}$/i.test(name) )
if( typeof name !== 'string' )
return false;
/* (3) Try to create room in API */