@@ -83,35 +83,37 @@ module.exports = function (config) {
8383
8484 if ( ssb . del == null ) return
8585
86- blocking . forEach ( feed => {
87- pull (
88- ssb . createUserStream ( { id : feed } ) ,
89- pull . asyncMap ( ( msg , cb ) => {
90- const key = msg . key
91- if ( currentlyDeleting [ key ] === true ) {
92- return cb ( null , null ) // already deleting
93- }
86+ blocking
87+ . filter ( feedId => feedId !== ssb . id )
88+ . forEach ( feed => {
89+ pull (
90+ ssb . createUserStream ( { id : feed } ) ,
91+ pull . asyncMap ( ( msg , cb ) => {
92+ const key = msg . key
93+ if ( currentlyDeleting [ key ] === true ) {
94+ return cb ( null , null ) // already deleting
95+ }
9496
95- currentlyDeleting [ key ] = true
97+ currentlyDeleting [ key ] = true
98+
99+ ssb . del ( key , ( err ) => {
100+ currentlyDeleting [ key ] = false
101+ cb ( err , key )
102+ } )
103+ } ) ,
104+ pull . filter ( ) ,
105+ pull . collect ( ( err , keys ) => {
106+ if ( err ) {
107+ console . error ( keys )
108+ throw err
109+ }
96110
97- ssb . del ( key , ( err ) => {
98- currentlyDeleting [ key ] = false
99- cb ( err , key )
111+ if ( keys . length > 0 ) {
112+ console . log ( `deleted ${ keys . length } messages from blocked authors` )
113+ }
100114 } )
101- } ) ,
102- pull . filter ( ) ,
103- pull . collect ( ( err , keys ) => {
104- if ( err ) {
105- console . error ( keys )
106- throw err
107- }
108-
109- if ( keys . length > 0 ) {
110- console . log ( `deleted ${ keys . length } messages from blocked authors` )
111- }
112- } )
113- )
114- } )
115+ )
116+ } )
115117 } )
116118 } )
117119
0 commit comments