Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

user can now delete image in topic separately #9008

Merged
merged 14 commits into from
Oct 3, 2024

Conversation

Israellund
Copy link
Collaborator

Link to Issue

Closes: #8841

Description of Changes

  • User is now able to delete an image from a topic within the edit_topic_modal by clicking the "Remove image" button instead of having to manually delete the markdown.
    NOTE: This solution solves mostly for 1 image. It works for 2, but the user first has to delete the first image if they also want to delete the second image. Please let me know if you'd like for me to change the code to account for multiple images.

"How We Fixed It"

-added logic to look for ![image](<url>) in the markdown and to display an image if present. And when "Remove image" is clicked the topic gets updated without the image markdown text.

Test Plan

  • make yourself an admin
  • go to Topics in sidebar
  • create a topic and add an image. You can also add text if you want
  • to make your life easier, make sure you check "Featured topic and sidebar"
  • after creating the topic go to Topics > Manage Topics and click the pencil icon of the topic you just created
  • confirm that you now see the image in the Edit topic modal
  • click "Remove image" and confirm that the image disappears and that the markdown is gone
  • save the changes and confirm you see the toast that reads "Topic updated"

Deployment Plan

Other Considerations

Copy link
Contributor

@masvelio masvelio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my general thought is that if we give user ability to add description as a rich text (or markdown) editor, then why the description in edit modal is just an inline input? Shouldn't we just put the editor component inside the modal? Your solution is kinda hacky, cause as you said, it works, but only for one image, not two etc. Adding editor to the modal should be straightforward

@Israellund
Copy link
Collaborator Author

Israellund commented Aug 29, 2024

@masvelio Yeah, I'll try putting in an editor and see how that works. I went with this current solution because a Topic has a character limit of 250, so 2 images felt like an unlikely edge case. But you're right.

Copy link
Contributor

@masvelio masvelio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say remove the "delete image button" + fix those styling issues and will be g2g

image

image

Copy link
Contributor

@mzparacha mzparacha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had similar comments as @masvelio and found another issue mentioned above. Otherwise LGTM.

@Israellund
Copy link
Collaborator Author

@masvelio @mzparacha I merged master into this branch and for some reason some of these changes got included in this PR. I only changed files relating to the edit_topic_modal and react_quill_editor

@mzparacha
Copy link
Contributor

@masvelio @mzparacha I merged master into this branch and for some reason some of these changes got included in this PR. I only changed files relating to the edit_topic_modal and react_quill_editor

I had a look and seems like the linter added some minimal changes, no biggie.

Copy link
Contributor

@masvelio masvelio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this ready for review? I am still getting this issue. Basically we want editor to be scrollable inside the modal instead of being overflown. To be clear, those are two images uploaded in the quill editor

image

@mzparacha
Copy link
Contributor

Getting this error when updating a topic description with this info

image image

@Israellund
Copy link
Collaborator Author

Getting this error when updating a topic description with this info

image image

Can you send me the replication steps for this?

@mzparacha
Copy link
Contributor

I followed these steps

  1. Create a new topic with 2 images in the description like this
upload_image_1

some_text

upload_image_2
  1. Update the topic and remove upload_image_2 and save

@Israellund
Copy link
Collaborator Author

@mzparacha I am unable to replicate your bug, I have tried many different ways of adding/updating/saving and they all work perfectly for me.

@mzparacha
Copy link
Contributor

I tried again and still reproducible for me.

Screen.Recording.2024-09-27.at.8.08.12.PM.mov

cc: @Israellund

@Israellund
Copy link
Collaborator Author

@mzparacha I've tried your exact steps multiple times as well as many different iterations and I still can not replicate your error. I think @masvelio and @burtonator should look at this when they get a chance and see if they see the error.

@Israellund
Copy link
Collaborator Author

@mzparacha Figured out why you were seeing the error with the help of @timolegros. Will you both take a look and let me know if it's working for you?

Copy link
Contributor

@mzparacha mzparacha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worked for me, Thanks @Israellund

@Israellund Israellund merged commit b9e476a into master Oct 3, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Request]: The ability to edit the image of a topic outside of the description when a topic is created
5 participants