From c6390238a9ed2b290c6b17113f7fa2631c793af0 Mon Sep 17 00:00:00 2001 From: miruka Date: Sun, 22 Mar 2020 12:04:43 -0400 Subject: [PATCH] Add settings to hide membership and profile events --- TODO.md | 4 ++++ src/backend/nio_callbacks.py | 10 +++++++--- src/backend/user_files.py | 2 ++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/TODO.md b/TODO.md index faffc481..1cc28e77 100644 --- a/TODO.md +++ b/TODO.md @@ -5,6 +5,8 @@ - Redacting messages - Download progress bar for file events, "Save as..." - Make rooms fully manageable within Mirage: settings, permissions, kick, etc + +- See about FlatPak packaging - Add AppImage metadata file - Pillow now bundle image libraries? Update AppImage building script and INSTALL.md @@ -29,6 +31,8 @@ - Drop the `HBox` `buttonModel`/`buttonCallbacks` `HBox` approach, be more declarative +- Look into Kirigami for QML + ## Issues - When zooming in enough, "Mirage " label overflows diff --git a/src/backend/nio_callbacks.py b/src/backend/nio_callbacks.py index 9a31039d..b49312ea 100644 --- a/src/backend/nio_callbacks.py +++ b/src/backend/nio_callbacks.py @@ -213,6 +213,10 @@ class NioCallbacks: # Membership changes if not prev or membership != prev_membership: + if self.client.backend.ui_settings["hideMembershipEvents"]: + self.client.skipped_events[room.room_id] += 1 + return None + reason = f". Reason: {now['reason']}" if now.get("reason") else "" if membership == "join": @@ -272,9 +276,9 @@ class NioCallbacks: account.display_name = now["displayname"] or "" account.avatar_url = now["avatar_url"] or "" - # Hide profile events from the timeline - XXX - self.client.skipped_events[room.room_id] += 1 - return None + if self.client.backend.ui_settings["hideProfileChangeEvents"]: + self.client.skipped_events[room.room_id] += 1 + return None return ( TypeSpecifier.ProfileChange, diff --git a/src/backend/user_files.py b/src/backend/user_files.py index 18449400..b8cef622 100644 --- a/src/backend/user_files.py +++ b/src/backend/user_files.py @@ -211,6 +211,8 @@ class UISettings(JSONDataFile): "clearRoomFilterOnEnter": True, "clearRoomFilterOnEscape": True, "collapseSidePanesUnderWindowWidth": 400, + "hideProfileChangeEvents": True, + "hideMembershipEvents": False, "theme": "Midnight.qpl", "writeAliases": {}, "media": {