File tree 2 files changed +12
-3
lines changed
2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -535,14 +535,23 @@ CoggleApi.prototype = {
535
535
* }
536
536
*/
537
537
listDiagrams : function listDiagrams ( options , callback ) {
538
+ var self = this ;
539
+ function wrappedCB ( err , diagram_resources ) {
540
+ if ( err )
541
+ return callback ( err ) ;
542
+ var diagrams = diagram_resources . map ( function ( resource ) {
543
+ return new CoggleApiDiagram ( self , resource ) ;
544
+ } ) ;
545
+ return callback ( err , diagrams ) ;
546
+ }
538
547
if ( options . organisation ) {
539
548
if ( typeof options . organisation !== 'string' )
540
549
throw new Error ( "options.organisation must be a string or undefined" ) ;
541
550
if ( ! / ^ [ a - z ] + [ a - z 0 - 9 - ] { 2 , } $ / . test ( options . organisation ) )
542
551
throw new Error ( "invalid organisation name" ) ;
543
- this . get ( '/api/1/organisations/' + options . organisation + '/diagrams' , '' , callback ) ;
552
+ this . get ( '/api/1/organisations/' + options . organisation + '/diagrams' , '' , wrappedCB ) ;
544
553
} else {
545
- this . get ( '/api/1/diagrams' , '' , callback ) ;
554
+ this . get ( '/api/1/diagrams' , '' , wrappedCB ) ;
546
555
}
547
556
} ,
548
557
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ function testListDiagrams(coggle, check_for_coggle){
46
46
47
47
var found_created_diagram = false ;
48
48
for ( var i = 0 ; i < diagrams . length ; i ++ ) {
49
- if ( diagrams [ i ] . id == check_for_coggle . id ) {
49
+ if ( diagrams [ i ] . id == check_for_coggle . id && diagrams [ i ] . title == check_for_coggle . title ) {
50
50
found_created_diagram = true ;
51
51
break ;
52
52
}
You can’t perform that action at this time.
0 commit comments