element-hq / element-android

A Matrix collaboration client for Android.
https://element.io/
GNU Affero General Public License v3.0
3.36k stars 717 forks source link

Cannot send Custom State event #8224

Open chitrangad opened 1 year ago

chitrangad commented 1 year ago

Steps to reproduce

Hello I'm running into an issue while trying to set the retention. I'm using Element Android ver 1.5.26 I keep getting 'Malformed JSON' when I try to send the m.room.retention event via dev tools

Steps:

  1. Go to the room settings and open Dev Tools-> Send custom event
  2. Type: m.room.retention content: {"max_lifetime": 8640000}.
  3. Send event

Outcome

What did you expect?

State event sent successfully and room state updated

What happened instead?

Receives error "Malformed JSON I've searched around and validated the JSON string format but cannot get it to work. Any help would be greatly appreciated

Your phone model

Pixel 7

Operating system version

Android 12

Application version and app store

1.5.26

Homeserver

Matrix/Synapse homeserver

Will you send logs?

Yes

Are you willing to provide a PR?

Yes

chitrangad commented 1 year ago

Hi - Any update on the issue? Or, if there's an alternative way to send the retention event.

rriemann commented 8 months ago

Why did you choose send custom event and not send state event?

unplugged-maksim commented 8 months ago

From my debugging it happens because at RoomDevToolsViewModel.kt sendEventContent function when content is being converted by jsonAdapter it converts the "max_lifetime" to Double instead of Int or Long and the server side expects Long. Hope will help you

SvenXP commented 4 months ago

Why did you choose send custom event and not send state event?

Its found under Explore Room State -> user-defined event (don't know exact English translation as i have it in German).