FriendsOfFlarum / socialprofile

Add custom social media pages to your user profile
MIT License
13 stars 7 forks source link

[!!!] A bug that can cause users to "suicide". #26

Closed anyshift closed 2 years ago

anyshift commented 3 years ago

Error recurrence: when adding a new profile, if the first one is left blank and the second one is filled with information, the user will disappear instantly after clicking Save. Although the user's information still exists in the database, the user's personal data will no longer be loaded on the forum, and only the discussion once published by the user can be browsed.

https://i.imgur.com/v7aNxDk.png

clarkwinkelmann commented 3 years ago

Thanks for the report! I can confirm the issue.

The issue is a javascript error happening here. button is null and the code crashes

https://github.com/FriendsOfFlarum/socialprofile/blob/bdd79a762d6e63f7e03d2befe1f78298126f99f8/js/src/forum/index.js#L31

The origin of the null value is probably this loop that serializes the data prior to saving. We should probably just create a new object for the save state, and not add any button that doesn't have a title. What's odd is that the value shouldn't be null, it should just be an object whose key values will be Stream objects so I'm not sure how it serializes as null.

https://github.com/FriendsOfFlarum/socialprofile/blob/bdd79a762d6e63f7e03d2befe1f78298126f99f8/js/src/forum/components/SocialButtonsModal.js#L80-L88

anyshift commented 3 years ago

Thank you for your attention. 👍 Hope for early repair.