Unable to edit a question's field (description etc.) except for the title.
Picture shown below (editing the description)
Expected behavior: successfully updating the Hihi question with the new description.
Actual behavior:
Error
There is an inconsistency with how the backend checks for changes and how the frontend formats the requests. The requests contains the full details of a question (including the unedited details), but the backend assumes that any field provided in the request are new values to be updated. This causes the backend to think that the "new" title is conflicting with an existing question, throwing the 409 error.
Proposed fix
Quick fix: under question-controller.js line 174, replace the condition with existingQuestion && existingQuestion.id !== id.
But in the long term, this inconsistency between the front and back ends might cause other problems. Either the front-end changes how it formats the field, or the back-end changes how it handles request fields.
Problem
Unable to edit a question's field (description etc.) except for the title. Picture shown below (editing the description)
Expected behavior: successfully updating the
Hihi
question with the new description. Actual behavior:Error
There is an inconsistency with how the backend checks for changes and how the frontend formats the requests. The requests contains the full details of a question (including the unedited details), but the backend assumes that any field provided in the request are new values to be updated. This causes the backend to think that the "new" title is conflicting with an existing question, throwing the 409 error.
Proposed fix
Quick fix: under
question-controller.js
line 174, replace the condition withexistingQuestion && existingQuestion.id !== id
.But in the long term, this inconsistency between the front and back ends might cause other problems. Either the front-end changes how it formats the field, or the back-end changes how it handles request fields.