Ver código fonte

use JsUserBlocker in prod, regular UserBlocker in testing

tags/v0.3.0
Jonathan Cobb 4 anos atrás
pai
commit
c816df627e
2 arquivos alterados com 32 adições e 13 exclusões
  1. +2
    -13
      bubble-server/src/main/resources/models/apps/user_block/hn/bubbleApp_userBlock_hn.json
  2. +30
    -0
      bubble-server/src/test/resources/models/apps/user_block/hn/bubbleApp_userBlock_hn.json

+ 2
- 13
bubble-server/src/main/resources/models/apps/user_block/hn/bubbleApp_userBlock_hn.json Ver arquivo

@@ -10,20 +10,9 @@
"AppRule": [{
"name": "hn_user_blocker",
"template": true,
"driver": "UserBlocker",
"driver": "JsUserBlocker",
"config": {
"blockedCommentCheck": "parseInt(current.get('width')) > parseInt(blocked.get('width'))",
"blockedCommentReplacement": "{{{chunkStartRegex}}}<td>[comment by {{blockedUser}} has been blocked] <a href=\"{{{unblockUrl}}}\">UNBLOCK</a></td></tr>",
"chunkStartRegex": "<tr\\s+class='athing\\s+comtr\\s+'\\s+id='\\d+'>",
"chunkEndRegex": " </table></td></tr>",
"chunkProperties": [
{"name": "userId", "value": "<a\\s+href=\"user\\?id=(.+?)\"\\s+class=\"hnuser\">\\s*(.+?)\\s*</a>"},
{"name": "width", "value": "<td\\s+class='ind'><img\\s+src=\"s.gif\"\\s+height=\"1\"\\s+width=\"(\\d+?)\"></td>"}
],
"commentDecorator": {
"regex": "class=\"age\"\\s*>.+?</span>",
"insert": " <a href=\"{{{blockUrl}}}\"><b>[X]</b></a> "
}
"siteJsTemplate": "bubble/rule/social/block/site/HackerNews.js.hbs"
}
}]
}

+ 30
- 0
bubble-server/src/test/resources/models/apps/user_block/hn/bubbleApp_userBlock_hn.json Ver arquivo

@@ -0,0 +1,30 @@
[{
"name": "UserBlocker",
"children": {
"AppSite": [{
"name": "HackerNews",
"url": "https://news.ycombinator.com",
"description": "A blog and discussion site for technology news, operated by YCombinator",
"template": true
}],
"AppRule": [{
"name": "hn_user_blocker",
"template": true,
"driver": "UserBlocker",
"config": {
"blockedCommentCheck": "parseInt(current.get('width')) > parseInt(blocked.get('width'))",
"blockedCommentReplacement": "{{{chunkStartRegex}}}<td>[comment by {{blockedUser}} has been blocked] <a href=\"{{{unblockUrl}}}\">UNBLOCK</a></td></tr>",
"chunkStartRegex": "<tr\\s+class='athing\\s+comtr\\s+'\\s+id='\\d+'>",
"chunkEndRegex": " </table></td></tr>",
"chunkProperties": [
{"name": "userId", "value": "<a\\s+href=\"user\\?id=(.+?)\"\\s+class=\"hnuser\">\\s*(.+?)\\s*</a>"},
{"name": "width", "value": "<td\\s+class='ind'><img\\s+src=\"s.gif\"\\s+height=\"1\"\\s+width=\"(\\d+?)\"></td>"}
],
"commentDecorator": {
"regex": "class=\"age\"\\s*>.+?</span>",
"insert": " <a href=\"{{{blockUrl}}}\"><b>[X]</b></a> "
}
}
}]
}
}]

Carregando…
Cancelar
Salvar