thunder icon indicating copy to clipboard operation
thunder copied to clipboard

Error "Could not determine post to comment to" when editing comment from own profile

Open everdred opened this issue 2 years ago • 3 comments

Description
When editing a comment using the pencil icon next to a comment appearing on my profile, I always get the error "Could not determine post to comment to."

How to Reproduce
Steps to reproduce the behavior:

  1. View my own profile.
  2. Tap the pencil icon next to a comment.
  3. Wait for my username and instance to load, just in case.
  4. Modify comment, tap Post button, receive above error.
  5. Go back, tap the comment to view it in context on the post.
  6. Edit comment successfully using the pencil icon appearing there.

Device & App Version:

  • OS: Android 13
  • Version: 0.2.4-2

everdred avatar Sep 14 '23 02:09 everdred

@everdred Thanks for the report!

For the devs, there's some background in #700. Essentially the problem is that we have a UserBloc, not a PostBloc, so the comment editor can't find the parent post. I'm not sure if we can use PostBloc too, or make the comment editor handle either bloc type, or something else.

micahmo avatar Sep 14 '23 02:09 micahmo

So I thought about this, and I think we need to do a refactor on how blocs work in the context of CreateCommentPage.

This is what I'm imagining: We should create a new bloc for this screen for the sole reason that it'll be easier to manage data flow and reduce complexity. Since this is now it's own separate page, rather than a bottom sheet, it makes sense to do the following:

  1. Create a new bloc to handle the state of the CreateCommentPage
  2. Add in the relevant events that should happen within the context of CreateCommentPage. A few events that I can think of are creating comments, and editing comments. Things like delete and reporting comments should go in their respective blocs (post bloc)
  3. For this new bloc, we should be able to pass in the required information for the given context. Some examples: a. The postView should be passed in if we're replying directly to a post b. The commentView should be passed in if we're replying directly to another comment, or if we are editing our own comment c. Any other context that we need in order to fill out the information on the create comment page
  4. Refactor some of the current logic in the CreateCommentPage to work properly with this change. Since we don't have to propagate the error messages up anymore (this was a requirement before since we were using a bottom sheet), it'll hopefully simplify a lot of the logic that we have in place

This is just an initial writeup of my thoughts and can change! @micahmo I can go ahead and work on this to see how feasible it is first, and then when I have a working refactor, you can take a look at it!

hjiangsu avatar Sep 15 '23 23:09 hjiangsu

Sounds like a great plan! 🎉

micahmo avatar Sep 15 '23 23:09 micahmo