Skip to content

Add a callout for rich text editor

Himanshu Kapoor requested to merge 408736-ce-callout into master

What does this MR do and why?

Add a callout for rich text editor. Issue: #408736 (closed)

As per #408736 (comment 1385886835), this MR also does the following:

  • Only have popup available to existing users with Markdown as default.
  • New users do not receive popup but have Rich Text Editor as default.

However, for tests, every user is a new user, and we have thousands of tests relying on the markdown editor being available as default, so I introduced a new feature flag rich_text_editor_as_default, which is enabled by default for everyone, but disabled in tests.

In several tests we do things like fill_in(:issue_description, ...), which does not work with a rich text editor. So for tests, I switched back to plain text editing by turning off the feature flag. Rich text editing has a different way of testing, and we already have several test cases covered in spec/support/shared_examples/features/content_editor_shared_examples.rb. Updating thousands of tests to work with rich text is currently out of scope, and rich text editor has its own separate e2e coverage which would make it redundant.

I tried alternate approaches below, but the above approach was the simplest:

  • Switch to markdown editor manually in each test that tests something with the editor. This quickly lead to me updating hundreds of test files, and became quite a big task. See !125189 (df3dfb42). That still had several pipeline failures, so we're looking at at least 100 updated test files.
  • Moving the preference for editor type from local storage to user settings, but this would require backend knowledge and capacity, which we currently don't have.

Screenshots or screen recordings

image.png

When you switch to rich text for the first time, a template is appended to the current textbox:

Screen Recording 2023-07-10 at 16.39.43.mov

How to set up and validate locally

  1. Enable feature flag :content_editor_on_issues in the rails console (rails c)
  2. Go to any textbox in issues or MRs, or edit an issue/MR. You should see a callout to try the new rich text editor.
  3. If you close the callout, you can reset its state by running rails c again and executing the following command: Users::Callout.find_by(feature_name: "rich_text_editor").delete().

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #408736 (closed)

Edited by Himanshu Kapoor

Merge request reports