Today, I found a bug on the my website

30 Dec, 2024
My site
Programming
OnlineProject
WebDev
SoftwareDevelopment

The problem is that when a user likes a poem, the age restriction set by the author when adding the poem is removed.

My website is where users can add their poems and share them with the world. The site is in the Tatar language

Here are the technical details: there is an "update" event that triggers when an author edits a poem. During this event, the system deletes the old age restrictions and adds new ones if they were changed. However, there's an issue: the ratings for poems are stored in the same table as the poems. When a user likes or dislikes a poem, the rating field is updated (+1 or -1). The system treats this as an "update" and triggers the event. As a result, the age restrictions for the poem are removed, even though they were not changed.

This post can be discussed and appreciated on my telegram channel