Explorar el Código

fix shadowban block tally on twitter

tags/v1.0.6
Jonathan Cobb hace 4 años
padre
commit
e757367b9c
Se han modificado 2 ficheros con 12 adiciones y 4 borrados
  1. +10
    -2
      bubble-server/src/main/resources/bubble/rule/social/block/JsUserBlockerRuleDriver.js.hbs
  2. +2
    -2
      bubble-server/src/main/resources/bubble/rule/social/block/site/Twitter.js.hbs

+ 10
- 2
bubble-server/src/main/resources/bubble/rule/social/block/JsUserBlockerRuleDriver.js.hbs Ver fichero

@@ -212,6 +212,14 @@ function {{JS_PREFIX}}_mark_evaluated(node) {
return firstEval;
}

function {{JS_PREFIX}}_mark_removed(node) {
const notRemoved = node.className.indexOf('{{JS_PREFIX}}_bub_removed_for_keyword') === -1;
if (notRemoved) {
node.className = node.className += ' {{JS_PREFIX}}_bub_removed_for_keyword';
}
return notRemoved === false;
}

function {{JS_PREFIX}}_includes_block_keyword (element, firstEval) {
const keywords = Object.keys(Object.assign({}, {{JS_PREFIX}}_blocked_keywords, {{JS_PREFIX}}_blocked_list_keywords));
if (keywords.length > 0) {
@@ -222,14 +230,14 @@ function {{JS_PREFIX}}_includes_block_keyword (element, firstEval) {
let cskw = kw.substring(1);
if (html.indexOf(cskw) !== -1) {
// {{PAGE_PREFIX}}_log('>>> includes_block_keyword: blocking based on case-sensitive keyword: ' + cskw);
{{JS_PREFIX}}_tally_keyword_block(cskw);
if ({{JS_PREFIX}}_mark_removed(element)) {{JS_PREFIX}}_tally_keyword_block(cskw);
if (!firstEval) {{JS_PREFIX}}_untally_allow();
return true;
}
} else {
if (html.toLowerCase().indexOf(kw.toLowerCase()) !== -1) {
// {{PAGE_PREFIX}}_log('>>> includes_block_keyword: blocking based on case-insensitive keyword: ' + kw);
{{JS_PREFIX}}_tally_keyword_block(kw);
if ({{JS_PREFIX}}_mark_removed(element)) {{JS_PREFIX}}_tally_keyword_block(kw);
if (!firstEval) {{JS_PREFIX}}_untally_allow();
return true;
}


+ 2
- 2
bubble-server/src/main/resources/bubble/rule/social/block/site/Twitter.js.hbs Ver fichero

@@ -39,9 +39,9 @@ function {{JS_PREFIX}}_apply_blocks(blocked_users) {
}
if (node === null || node.parentNode === null) continue;
const authorBlocked = authorName in blocked_users;
if (authorBlocked || {{JS_PREFIX}}_includes_block_keyword(node)) {
if (authorBlocked || {{JS_PREFIX}}_includes_block_keyword(node, firstEval)) {
if (authorBlocked) {
{{JS_PREFIX}}_tally_author_block(authorName);
if ({{JS_PREFIX}}_mark_removed(node)) {{JS_PREFIX}}_tally_author_block(authorName);
if (!firstEval) {{JS_PREFIX}}_untally_allow();
}
console.log('removing post by author: ' + authorName);


Cargando…
Cancelar
Guardar