@@ -47,7 +47,7 @@ var oauth = osmAuth({
4747
4848var _blacklists = [ '.*\.google(apis)?\..*/(vt|kh)[\?/].*([xyz]=.*){3}.*' ] ;
4949var _tileCache = { loaded : { } , inflight : { } , seen : { } } ;
50- var _noteCache = { loaded : { } , inflight : { } , inflightPost : { } , note : { } , rtree : rbush ( ) } ;
50+ var _noteCache = { loaded : { } , inflight : { } , inflightPost : { } , note : { } , closed : { } , rtree : rbush ( ) } ;
5151var _userCache = { toLoad : { } , user : { } } ;
5252var _changeset = { } ;
5353
@@ -385,7 +385,7 @@ export default {
385385 if ( _changeset . inflight ) abortRequest ( _changeset . inflight ) ;
386386
387387 _tileCache = { loaded : { } , inflight : { } , seen : { } } ;
388- _noteCache = { loaded : { } , inflight : { } , inflightPost : { } , note : { } , rtree : rbush ( ) } ;
388+ _noteCache = { loaded : { } , inflight : { } , inflightPost : { } , note : { } , closed : { } , rtree : rbush ( ) } ;
389389 _userCache = { toLoad : { } , user : { } } ;
390390 _changeset = { } ;
391391
@@ -956,6 +956,13 @@ export default {
956956 // we get the updated note back, remove from caches and reparse..
957957 this . removeNote ( note ) ;
958958
959+ // update closed note cache - used to populate `closed:note` changeset tag
960+ if ( action === 'close' ) {
961+ _noteCache . closed [ note . id ] = true ;
962+ } else if ( action === 'reopen' ) {
963+ delete _noteCache . closed [ note . id ] ;
964+ }
965+
959966 var options = { skipSeen : false } ;
960967 return parseXML ( xml , function ( err , results ) {
961968 if ( err ) {
@@ -1118,6 +1125,13 @@ export default {
11181125 _noteCache . note [ note . id ] = note ;
11191126 updateRtree ( encodeNoteRtree ( note ) , true ) ; // true = replace
11201127 return note ;
1128+ } ,
1129+
1130+
1131+ // Get an array of note IDs closed during this session.
1132+ // Used to populate `closed:note` changeset tag
1133+ getClosedIDs : function ( ) {
1134+ return Object . keys ( _noteCache . closed ) . sort ( ) ;
11211135 }
11221136
11231137} ;
0 commit comments