Pass 'null' for unset icon in custom status message

The OCS Status API  expect an valid emoji or 'null' for the status icon
in a custom message:

> field: statusIcon
> type: string/null
> Description: The icon picked by the user (must be an emoji, at most one)

See [1] for more details.

Resolves: #1839
See:
 [1] https://docs.nextcloud.com/server/latest/developer_manual/client_apis/OCS/ocs-status-api.html#set-a-custom-message-user-defined

Signed-off-by: Tim Krüger <t@timkrueger.me>
This commit is contained in:
Tim Krüger 2022-03-02 09:12:01 +01:00
parent 98a2a62cbf
commit 3411728597
No known key found for this signature in database
GPG Key ID: FECE3A7222C52A4E

View File

@ -393,15 +393,15 @@ class SetStatusDialogFragment :
} }
private fun setStatusMessage() { private fun setStatusMessage() {
var inputText = binding.customStatusInput.text.toString()
if (inputText.isEmpty()) { val inputText = binding.customStatusInput.text.toString().ifEmpty { " " }
inputText = " " // The endpoint '/message/custom' expects a valid emoji as string or null
} val statusIcon = binding.emoji.text.toString().ifEmpty { null }
ncApi.setCustomStatusMessage( ncApi.setCustomStatusMessage(
credentials, credentials,
ApiUtils.getUrlForSetCustomStatus(currentUser?.baseUrl), ApiUtils.getUrlForSetCustomStatus(currentUser?.baseUrl),
binding.emoji.text.toString(), statusIcon,
inputText, inputText,
clearAt clearAt
) )