mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-29 06:28:45 +03:00
Merge pull request #3914 from vector-im/feature/bma/enabled_body
PushRule enabling request is not following the spec
This commit is contained in:
commit
048800684c
6 changed files with 38 additions and 4 deletions
1
changelog.d/3911.bugfix
Normal file
1
changelog.d/3911.bugfix
Normal file
|
@ -0,0 +1 @@
|
|||
PushRule enabling request is not following the spec
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* Copyright 2021 The Matrix.org Foundation C.I.C.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.matrix.android.sdk.internal.session.pushers
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
import com.squareup.moshi.JsonClass
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
internal data class EnabledBody(
|
||||
@Json(name = "enabled")
|
||||
val enabled: Boolean
|
||||
)
|
|
@ -19,7 +19,7 @@ import com.squareup.moshi.Json
|
|||
import com.squareup.moshi.JsonClass
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
internal class GetPushersResponse(
|
||||
internal data class GetPushersResponse(
|
||||
@Json(name = "pushers")
|
||||
val pushers: List<JsonPusher>? = null
|
||||
)
|
||||
|
|
|
@ -41,7 +41,7 @@ internal interface PushRulesApi {
|
|||
@PUT(NetworkConstants.URI_API_PREFIX_PATH_R0 + "pushrules/global/{kind}/{ruleId}/enabled")
|
||||
suspend fun updateEnableRuleStatus(@Path("kind") kind: String,
|
||||
@Path("ruleId") ruleId: String,
|
||||
@Body enable: Boolean?)
|
||||
@Body enabledBody: EnabledBody)
|
||||
|
||||
/**
|
||||
* Update the ruleID action
|
||||
|
|
|
@ -39,7 +39,11 @@ internal class DefaultUpdatePushRuleActionsTask @Inject constructor(
|
|||
|
||||
override suspend fun execute(params: UpdatePushRuleActionsTask.Params) {
|
||||
executeRequest(globalErrorReceiver) {
|
||||
pushRulesApi.updateEnableRuleStatus(params.kind.value, params.ruleId, enable = params.enable)
|
||||
pushRulesApi.updateEnableRuleStatus(
|
||||
params.kind.value,
|
||||
params.ruleId,
|
||||
EnabledBody(params.enable)
|
||||
)
|
||||
}
|
||||
if (params.actions != null) {
|
||||
val body = mapOf("actions" to params.actions.toJson())
|
||||
|
|
|
@ -35,7 +35,11 @@ internal class DefaultUpdatePushRuleEnableStatusTask @Inject constructor(
|
|||
|
||||
override suspend fun execute(params: UpdatePushRuleEnableStatusTask.Params) {
|
||||
return executeRequest(globalErrorReceiver) {
|
||||
pushRulesApi.updateEnableRuleStatus(params.kind.value, params.pushRule.ruleId, params.enabled)
|
||||
pushRulesApi.updateEnableRuleStatus(
|
||||
params.kind.value,
|
||||
params.pushRule.ruleId,
|
||||
EnabledBody(params.enabled)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue