wise-old-man / wiseoldman-runelite-plugin

The RuneLite plugin for the Wise Old Man project.
BSD 2-Clause "Simplified" License
3 stars 7 forks source link

Group gets fully replaced when sync is used and group previously failed to load #59

Open StephanBijzitter opened 2 hours ago

StephanBijzitter commented 2 hours ago

image

When everything goes correctly:

However, the code for option 2 relies on the plugin having an up-to-date copy of the group as represented on wom; if this copy is not up-to-date or is missing (due to any kind of connectivity issue), option 2 becomes functionally identical to option 1.

The following code is responsible for this unexpected behaviour: https://github.com/wise-old-man/wiseoldman-runelite-plugin/blob/ec4d95cf087a3fffc236eb4af9d93bd99c0fca3f/src/main/java/net/wiseoldman/ui/SyncButton.java#L137-L140

A simple workaround would be to check the size of groupMembers, if this is 0 then that can mean two things:

StephanBijzitter commented 2 hours ago

Ideally though the endpoint used should be changed to use the POST variant (assuming that adding an existing member with a different rank, will update that member's rank): https://docs.wiseoldman.net/groups-api/group-endpoints#add-members