Merge pull request #8006 from vector-im/feature/mna/push-rules-api-order
[Push rules] Call /actions api before /enabled api (PSG-1099)
This commit is contained in:
commit
00c90c19d7
|
@ -0,0 +1 @@
|
||||||
|
[Push rules] Call /actions api before /enabled api
|
|
@ -34,10 +34,16 @@ internal interface UpdatePushRuleActionsTask : Task<UpdatePushRuleActionsTask.Pa
|
||||||
|
|
||||||
internal class DefaultUpdatePushRuleActionsTask @Inject constructor(
|
internal class DefaultUpdatePushRuleActionsTask @Inject constructor(
|
||||||
private val pushRulesApi: PushRulesApi,
|
private val pushRulesApi: PushRulesApi,
|
||||||
private val globalErrorReceiver: GlobalErrorReceiver
|
private val globalErrorReceiver: GlobalErrorReceiver,
|
||||||
) : UpdatePushRuleActionsTask {
|
) : UpdatePushRuleActionsTask {
|
||||||
|
|
||||||
override suspend fun execute(params: UpdatePushRuleActionsTask.Params) {
|
override suspend fun execute(params: UpdatePushRuleActionsTask.Params) {
|
||||||
|
if (params.actions != null) {
|
||||||
|
val body = mapOf("actions" to params.actions.toJson())
|
||||||
|
executeRequest(globalErrorReceiver) {
|
||||||
|
pushRulesApi.updateRuleActions(params.kind.value, params.ruleId, body)
|
||||||
|
}
|
||||||
|
}
|
||||||
executeRequest(globalErrorReceiver) {
|
executeRequest(globalErrorReceiver) {
|
||||||
pushRulesApi.updateEnableRuleStatus(
|
pushRulesApi.updateEnableRuleStatus(
|
||||||
params.kind.value,
|
params.kind.value,
|
||||||
|
@ -45,11 +51,5 @@ internal class DefaultUpdatePushRuleActionsTask @Inject constructor(
|
||||||
EnabledBody(params.enable)
|
EnabledBody(params.enable)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (params.actions != null) {
|
|
||||||
val body = mapOf("actions" to params.actions.toJson())
|
|
||||||
executeRequest(globalErrorReceiver) {
|
|
||||||
pushRulesApi.updateRuleActions(params.kind.value, params.ruleId, body)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue