diff --git a/src/backend/matrix_client.py b/src/backend/matrix_client.py index be6cecd3..63e16de3 100644 --- a/src/backend/matrix_client.py +++ b/src/backend/matrix_client.py @@ -1860,7 +1860,7 @@ class MatrixClient(nio.AsyncClient): await self.enable_pushrule("global", kind, rule_id, enable) - async def tweak_pushrule( + async def tweak_pushrule_actions( self, kind: Union[nio.PushRuleKind, str], rule_id: str, @@ -1870,7 +1870,7 @@ class MatrixClient(nio.AsyncClient): sound: Optional[str] = None, urgency_hint: Optional[bool] = None, ) -> None: - """Set an existing pushrule's actions. Works for builtin rules.""" + """Edit individual actions for any existing push rule.""" kind = nio.PushRuleKind[kind] if isinstance(kind, str) else kind @@ -1903,8 +1903,8 @@ class MatrixClient(nio.AsyncClient): await self.set_pushrule_actions("global", kind, rule_id, actions) - async def mass_tweak_pushrules(self, *tweaks_kwargs) -> None: - coros = [self.tweak_pushrule(**kwargs) for kwargs in tweaks_kwargs] + async def mass_tweak_pushrules_actions(self, *tweaks_kwargs) -> None: + coros = [self.tweak_pushrule_actions(**kws) for kws in tweaks_kwargs] await asyncio.gather(*coros) diff --git a/src/gui/Pages/AccountSettings/NotificationRuleButton.qml b/src/gui/Pages/AccountSettings/NotificationRuleButton.qml index 363c0d62..c75e723a 100644 --- a/src/gui/Pages/AccountSettings/NotificationRuleButton.qml +++ b/src/gui/Pages/AccountSettings/NotificationRuleButton.qml @@ -26,7 +26,6 @@ HButton { onClicked: { if (requiresOn !== null && ! requiresOn.on) { requiresOn.clicked() - print(on, clicked) if (! on) clicked() return } diff --git a/src/gui/Pages/AccountSettings/Notifications.qml b/src/gui/Pages/AccountSettings/Notifications.qml index aa8c6262..1b42dc7e 100644 --- a/src/gui/Pages/AccountSettings/Notifications.qml +++ b/src/gui/Pages/AccountSettings/Notifications.qml @@ -36,7 +36,7 @@ HListView { saveFutureId = py.callClientCoro( userId, - "mass_tweak_pushrules", + "mass_tweak_pushrules_actions", args, () => { if (! root) return @@ -119,23 +119,17 @@ HListView { width: root.width } - footer: AutoDirectionLayout { - z: 100 - width: root.width - enabled: Object.keys(root.pendingEdits).length !== 0 + onPendingEditsChanged: + utils.isEmptyObject(pendingEdits) ? + autoSaveTimer.stop() : + autoSaveTimer.restart() - ApplyButton { - onClicked: root.save() - loading: root.saveFutureId !== "" + Component.onDestruction: ! utils.isEmptyObject(pendingEdits) && save() - Layout.topMargin: theme.spacing - } - - CancelButton { - onClicked: pendingEdits = {} - - Layout.topMargin: theme.spacing - } + Timer { + id: autoSaveTimer + interval: 10000 + onTriggered: root.save() } FlickShortcuts {