Skip to content

Not specifying primitives can overwrite room config #174

Description

@Fishbowler

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions