Bug Fix for Busy.org: Comment's json_metadata will not be removed anymore!

View this thread on: d.buzz | hive.blog | peakd.com | ecency.com
·@mkt·
0.000 HBD
Bug Fix for Busy.org: Comment's json_metadata will not be removed anymore!
![busy-bugfix.png](https://ipfs.busy.org/ipfs/QmejoZMVChGbBxRvQ9H9USNYVrNQhoe3j9ha6fHq3KFHKM)

#### Repository
https://github.com/busyorg/busy

#### Pull Request
https://github.com/busyorg/busy/pull/1969

#### What was the issue?
As you can read [here in my bug report](https://busy.org/@mkt/bug-report-busy-org-overwriting-comment-jsonmetadata) there was an issue with comment's metadata on busy.org. If you utilize the `json_metadata` property of a comment, like I do for [the-magic-frog.com](https://the-magic-frog.com), editing this comment on busy.org would override this data with the busy.org defaults, as you can see [here](https://github.com/busyorg/busy/blob/2212c3daba84cec828748136492b60c9bd0f0b70/src/client/comments/commentsActions.js#L100).
There already was a check for `isUpdating` but for some reason it was ignored for the metadata. In contrast, steemit.com simply adds an `app` property, if not present, but doesn't touch existing metadata.

#### Fix
https://github.com/busyorg/busy/blob/master/src/client/comments/commentsActions.js#L102

**Note:**
The delay between my bug report and the actual fix was due to the [jsonParse helper function](https://github.com/busyorg/busy/blob/master/src/client/helpers/formatter.js) that had to be fixed first and I was waiting for [the related PR](https://github.com/busyorg/busy/pull/1981) to be merged.
At first I added an [own helper function](https://github.com/busyorg/busy/pull/1969/commits/a16a6a8fc841999c1ae2d03e350aac74bd3e9245) but this was then not needed anymore and the implementation is indeed more elegant than parsing the json twice.

### And now a question:

Is there ANYONE else other than me who ever used the comment's json_metadata for something? I was really shocked when I noticed this bug. Someone was participating in the @grenouille's story (french version of @the-magic-frog) and his/her submission was actually upvoted the most and should have made it into the story but it didn't... It turned out that he/she edited the comment on busy.org, which removed the necessary metadata for the bot to recognize it as a story submission.
This metadata is set by [the website](https://the-magic-frog.com) and it contains the actual content of the submission, so it is actually only possible to edit a submission on the website anyway but... I thought it was my fault... again. I was happy to realize that I can blame someone else this time! :D

So, if there's some other project using metadata on comments, maybe they appreciate this bug fix too. :)
👍 , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,