diff --git a/lib/boards-api.js b/lib/boards-api.js index bcbea7c..0c9d40c 100644 --- a/lib/boards-api.js +++ b/lib/boards-api.js @@ -274,6 +274,21 @@ BoardsAPI.prototype.delete = function (opts, done) { for (var item in list) { if (list[item].Hash === opts.hash) { url = url + list[item].Name + this.ipfs.files.cat(url, (err, res) => { + // Look for previous versions + if (err || opts.previouses.indexOf(opts.hash) >= 0) return + replyAsObj(res, true, (err, obj) => { + if (!err && obj.previous) { + // Delete if found + this.delete({ + what: opts.what, + hash: obj.previous, + // Check for cyclic depdendency structures + previouses: (opts.previouses || []).concat(opts.hash) + }) + } + }) + }) return this.ipfs.files.rm(url, {}, err => { if (err) return done(err) this.ipfs.files.stat('/', (err, res) => {