making the add email pusher append parameter configurable by clients, typically we wouldn't want to overwrite other accounts but we can expose the option to clients if they want that behaviour

This commit is contained in:
Adam Brown 2021-09-24 15:39:08 +01:00
parent 3a1cb1c07a
commit 95b4f99970
2 changed files with 9 additions and 3 deletions

View File

@ -71,6 +71,10 @@ interface PushersService {
* @param emailBranding The branding placeholder to include in the email communications. * @param emailBranding The branding placeholder to include in the email communications.
* @param appDisplayName A human readable string that will allow the user to identify what application owns this pusher. * @param appDisplayName A human readable string that will allow the user to identify what application owns this pusher.
* @param deviceDisplayName A human readable string that will allow the user to identify what device owns this pusher. * @param deviceDisplayName A human readable string that will allow the user to identify what device owns this pusher.
* @param append If true, the homeserver should add another pusher with the given pushkey and App ID in addition
* to any others with different user IDs. Otherwise, the homeserver must remove any other pushers
* with the same App ID and pushkey for different users. Typically We always want to append for
* email pushers since we don't want to stop other accounts notifying to the same email address.
* @return A work request uuid. Can be used to listen to the status * @return A work request uuid. Can be used to listen to the status
* (LiveData<WorkInfo> status = workManager.getWorkInfoByIdLiveData(<UUID>)) * (LiveData<WorkInfo> status = workManager.getWorkInfoByIdLiveData(<UUID>))
* @throws [InvalidParameterException] if a parameter is not correct * @throws [InvalidParameterException] if a parameter is not correct
@ -79,7 +83,8 @@ interface PushersService {
lang: String, lang: String,
emailBranding: String, emailBranding: String,
appDisplayName: String, appDisplayName: String,
deviceDisplayName: String): UUID deviceDisplayName: String,
append: Boolean = true): UUID
/** /**
* Directly ask the push gateway to send a push to this device * Directly ask the push gateway to send a push to this device

View File

@ -85,7 +85,8 @@ internal class DefaultPushersService @Inject constructor(
lang: String, lang: String,
emailBranding: String, emailBranding: String,
appDisplayName: String, appDisplayName: String,
deviceDisplayName: String deviceDisplayName: String,
append: Boolean
) = addPusher( ) = addPusher(
JsonPusher( JsonPusher(
pushKey = email, pushKey = email,
@ -96,7 +97,7 @@ internal class DefaultPushersService @Inject constructor(
appDisplayName = appDisplayName, appDisplayName = appDisplayName,
deviceDisplayName = deviceDisplayName, deviceDisplayName = deviceDisplayName,
data = JsonPusherData(brand = emailBranding), data = JsonPusherData(brand = emailBranding),
append = true append = append
) )
) )