mirror of
				https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
				synced 2025-11-04 12:22:47 +00:00 
			
		
		
		
	Implement remove operation for CorpusFileLists
This commit is contained in:
		@@ -225,7 +225,7 @@ class CorpusFileList extends RessourceList {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  patch(patch) {
 | 
					  patch(patch) {
 | 
				
			||||||
    let re;
 | 
					    let id, match, re;
 | 
				
			||||||
    for (let operation of patch) {
 | 
					    for (let operation of patch) {
 | 
				
			||||||
      switch(operation.op) {
 | 
					      switch(operation.op) {
 | 
				
			||||||
        case 'add':
 | 
					        case 'add':
 | 
				
			||||||
@@ -233,6 +233,14 @@ class CorpusFileList extends RessourceList {
 | 
				
			|||||||
          re = new RegExp('^/corpora/' + this.corpus.id + '/files/(\\d+)$');
 | 
					          re = new RegExp('^/corpora/' + this.corpus.id + '/files/(\\d+)$');
 | 
				
			||||||
          if (re.test(operation.path)) {this.add(operation.value);}
 | 
					          if (re.test(operation.path)) {this.add(operation.value);}
 | 
				
			||||||
          break;
 | 
					          break;
 | 
				
			||||||
 | 
					        case 'remove':
 | 
				
			||||||
 | 
					          // See case add ;)
 | 
				
			||||||
 | 
					          re = new RegExp('^/corpora/' + this.corpus.id + '/files/(\\d+)$');
 | 
				
			||||||
 | 
					          if (re.test(operation.path)) {
 | 
				
			||||||
 | 
					            [match, id] = operation.path.match(re);
 | 
				
			||||||
 | 
					            this.remove(id);
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					          break;
 | 
				
			||||||
        default:
 | 
					        default:
 | 
				
			||||||
          break;
 | 
					          break;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user