Auto-save push rule tab action changes
This commit is contained in:
parent
4306098692
commit
84567f1ffd
|
@ -1860,7 +1860,7 @@ class MatrixClient(nio.AsyncClient):
|
||||||
await self.enable_pushrule("global", kind, rule_id, enable)
|
await self.enable_pushrule("global", kind, rule_id, enable)
|
||||||
|
|
||||||
|
|
||||||
async def tweak_pushrule(
|
async def tweak_pushrule_actions(
|
||||||
self,
|
self,
|
||||||
kind: Union[nio.PushRuleKind, str],
|
kind: Union[nio.PushRuleKind, str],
|
||||||
rule_id: str,
|
rule_id: str,
|
||||||
|
@ -1870,7 +1870,7 @@ class MatrixClient(nio.AsyncClient):
|
||||||
sound: Optional[str] = None,
|
sound: Optional[str] = None,
|
||||||
urgency_hint: Optional[bool] = None,
|
urgency_hint: Optional[bool] = None,
|
||||||
) -> 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
|
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)
|
await self.set_pushrule_actions("global", kind, rule_id, actions)
|
||||||
|
|
||||||
|
|
||||||
async def mass_tweak_pushrules(self, *tweaks_kwargs) -> None:
|
async def mass_tweak_pushrules_actions(self, *tweaks_kwargs) -> None:
|
||||||
coros = [self.tweak_pushrule(**kwargs) for kwargs in tweaks_kwargs]
|
coros = [self.tweak_pushrule_actions(**kws) for kws in tweaks_kwargs]
|
||||||
await asyncio.gather(*coros)
|
await asyncio.gather(*coros)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,6 @@ HButton {
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (requiresOn !== null && ! requiresOn.on) {
|
if (requiresOn !== null && ! requiresOn.on) {
|
||||||
requiresOn.clicked()
|
requiresOn.clicked()
|
||||||
print(on, clicked)
|
|
||||||
if (! on) clicked()
|
if (! on) clicked()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ HListView {
|
||||||
|
|
||||||
saveFutureId = py.callClientCoro(
|
saveFutureId = py.callClientCoro(
|
||||||
userId,
|
userId,
|
||||||
"mass_tweak_pushrules",
|
"mass_tweak_pushrules_actions",
|
||||||
args,
|
args,
|
||||||
() => {
|
() => {
|
||||||
if (! root) return
|
if (! root) return
|
||||||
|
@ -119,23 +119,17 @@ HListView {
|
||||||
width: root.width
|
width: root.width
|
||||||
}
|
}
|
||||||
|
|
||||||
footer: AutoDirectionLayout {
|
onPendingEditsChanged:
|
||||||
z: 100
|
utils.isEmptyObject(pendingEdits) ?
|
||||||
width: root.width
|
autoSaveTimer.stop() :
|
||||||
enabled: Object.keys(root.pendingEdits).length !== 0
|
autoSaveTimer.restart()
|
||||||
|
|
||||||
ApplyButton {
|
Component.onDestruction: ! utils.isEmptyObject(pendingEdits) && save()
|
||||||
onClicked: root.save()
|
|
||||||
loading: root.saveFutureId !== ""
|
|
||||||
|
|
||||||
Layout.topMargin: theme.spacing
|
Timer {
|
||||||
}
|
id: autoSaveTimer
|
||||||
|
interval: 10000
|
||||||
CancelButton {
|
onTriggered: root.save()
|
||||||
onClicked: pendingEdits = {}
|
|
||||||
|
|
||||||
Layout.topMargin: theme.spacing
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FlickShortcuts {
|
FlickShortcuts {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user