Any item has an edit page at /:id/edit. You can also visit this page for comments but it will usually not work since the edit form is only meant for posts with titles, subs, boost etc.
However, this isn't properly handled in the backend. Currently, only line 1239 prevents (on accident?) that most comments can be edited since old.sub is null for comments so this will throw an error:
Description
Any item has an edit page at /:id/edit. You can also visit this page for comments but it will usually not work since the edit form is only meant for posts with titles, subs, boost etc.
However, this isn't properly handled in the backend. Currently, only line 1239 prevents (on accident?) that most comments can be edited since
old.sub
is null for comments so this will throw an error:https://github.com/stackernews/stacker.news/blob/3d3dc52cec9262aecf6e24121b640a16d710edf2/api/resolvers/item.js#L1233-L1242
However, freebie comments don't hit this line.
This means that freebie comments can be edited to include a title, sub, boost and forwards.
Steps to Reproduce
Expected behavior
Comment edits are properly validated in backend. Titles, subs, boost and forwards are not allowed for comments.
Screenshots
comment with boost:
comment shows different sub than parent if it's the root:
Additional context
Impact seems low since comments are defined as
"parentId" IS NULL
in queries so you can't do anything too crazy afaict.But this breaks assumptions we might have elsewhere about comments.