From d9ae3306cf0f1e04177d357364a48f39b0c14f61 Mon Sep 17 00:00:00 2001 From: Frisk Date: Sun, 2 Jan 2022 20:56:50 +0100 Subject: [PATCH] Applied fixes to previous commit (thanks Markus!) --- src/discord/redaction.py | 3 +-- src/rcgcdw.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/discord/redaction.py b/src/discord/redaction.py index fd57440..d897d3a 100644 --- a/src/discord/redaction.py +++ b/src/discord/redaction.py @@ -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) diff --git a/src/rcgcdw.py b/src/rcgcdw.py index b95ab41..40ddb4a 100644 --- a/src/rcgcdw.py +++ b/src/rcgcdw.py @@ -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", []):