Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not specifying primitives can overwrite room config #174

Open
Fishbowler opened this issue Feb 7, 2023 · 1 comment
Open

Not specifying primitives can overwrite room config #174

Fishbowler opened this issue Feb 7, 2023 · 1 comment

Comments

@Fishbowler
Copy link
Member

Initial state:

curl -s -k -H "Accept: application/json" -X GET \
  -u "myuser:mypassword" \
  https://myopenfire/plugins/restapi/v1/chatrooms/test1?servicename=mucservice \
  | jq . \
  | grep "canAnyoneDiscoverJID"

"canAnyoneDiscoverJID": true,

Then:

curl -X 'PUT' \
  -u "myuser:mypassword" \
  https://myopenfire/plugins/restapi/v1/chatrooms/test1?servicename=mucservice \
  -H 'accept: */*' \
  -H 'Content-Type: application/json' \
  -d '{"roomName": "test1", "description": "test1 Desc Updated"}'

Alters state so that:

curl -s -k -H "Accept: application/json" -X GET \
  -u "myuser:mypassword" \
  https://myopenfire/plugins/restapi/v1/chatrooms/test1?servicename=mucservice \
  | jq . \
  | grep "canAnyoneDiscoverJID"

"canAnyoneDiscoverJID": false,

Suspected caused by this:

room.setCanAnyoneDiscoverJID(mucRoomEntity.isCanAnyoneDiscoverJID());

Which calls this:

Because that is a primitive boolean, the default is false - so if a client does not send a value, the value defaults to false, and overwrites, regardless of the existing value. If so, move to using Boolean?

@guusdk
Copy link
Member

guusdk commented Feb 7, 2023

If so, move to using Boolean?

Agreed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants