Applied fixes to previous commit (thanks Markus!)

This commit is contained in:
Frisk 2022-01-02 20:56:50 +01:00
parent adb3b42074
commit d9ae3306cf
No known key found for this signature in database
GPG key ID: 213F7C15068AF8AC
2 changed files with 2 additions and 3 deletions

View file

@ -96,7 +96,6 @@ def redact_messages(ids: Union[List[Union[str, int]], set[Union[int, str]]], ent
def find_middle_next(ids: List[str], pageid: int) -> set:
"""To address #235 RcGcDw should now remove diffs in next revs relative to redacted revs to protect information in revs that revert revdeleted information.
This does not fix the problem of leaky diffs in entirety (because we are not doing diff comparisons), however the chances of fixing in most cases is pretty high
:arg ids - list
:arg pageid - int
@ -112,4 +111,4 @@ def find_middle_next(ids: List[str], pageid: int) -> set:
result.add(all_in_page[all_in_page.index(id)+1])
except (KeyError, ValueError):
logger.debug(f"Value {id} not in {all_in_page} or no value after that.")
return result
return result - set(ids)

View file

@ -262,7 +262,7 @@ def rc_processor(change, changed_categories):
logparams = change.get('logparams', {"ids": []})
if settings["appearance"]["mode"] == "embed":
redact_messages(logparams.get("ids", []), 0, logparams.get("new", {}))
if "content" in logparams.get("new", {}): # Also redact revisions in the middle and next ones in case of content (diffs leak)
if "content" in logparams.get("new", {}) and settings.get("appearance", {}).get("embed", {}).get("show_edit_changes", False): # Also redact revisions in the middle and next ones in case of content (diffs leak)
redact_messages(find_middle_next(logparams.get("ids", []), change.get("pageid", -1)), 0, {"content": ""})
else:
for revid in logparams.get("ids", []):