src/cm/media/js/client/c_db.js
changeset 413 2479d33898dd
parent 341 053551f213fb
child 504 b2e0186daa5b
equal deleted inserted replaced
412:3b3d7126fce7 413:2479d33898dd
   450   },
   450   },
   451 
   451 
   452   // warning : tags are case sensitive
   452   // warning : tags are case sensitive
   453   filterByTag : function(tag, cWithTagIds, rWithTagIds) {
   453   filterByTag : function(tag, cWithTagIds, rWithTagIds) {
   454     // cf ", ".join... in client.py 
   454     // cf ", ".join... in client.py 
   455     var re0 = new RegExp("^" + tag + "$", "g"); 
   455     var re0 = new RegExp("^" + tag + "$", ''); 
   456     var re1 = new RegExp("^" + tag + ", ", "g");
   456     var re1 = new RegExp("^" + tag + ", ", '');
   457     var re2 = new RegExp(", " + tag + ", ", "g"); 
   457     var re2 = new RegExp(", " + tag + ", ", ''); 
   458     var re3 = new RegExp(", " + tag + "$", "g"); 
   458     var re3 = new RegExp(", " + tag + "$", ''); 
   459     for (var id in this.allCommentsByDbId) {
   459     for (var id in this.allCommentsByDbId) {
   460       var comment = this.allCommentsByDbId[id] ;
   460       var comment = this.allCommentsByDbId[id] ;
   461       if (tag == "" || re0.exec(comment.tags) || re1.exec(comment.tags) != null || re2.exec(comment.tags) != null || re3.exec(comment.tags) != null) { // search only in the comment (not the comment scope) for now
   461       if ((tag == "") || re0.exec(comment.tags) != null || re1.exec(comment.tags) != null || re2.exec(comment.tags) != null || re3.exec(comment.tags) != null) { // search only in the comment (not the comment scope) for now
   462         if (comment.reply_to_id == null) 
   462         if (comment.reply_to_id == null) 
   463           cWithTagIds.push(comment.id);
   463           cWithTagIds.push(comment.id);
   464         else 
   464         else 
   465           rWithTagIds.push(comment.id) ;
   465           rWithTagIds.push(comment.id) ;
   466       }
   466       }