Skip to content

Fix rendering failure for the 'Verified' badge

Brian Williams requested to merge bwill/fix-rendering-failure into master

What does this MR do and why?

Describe in detail what your merge request does and why.

This MR fixes two bugs preventing the signature badge from rendering correctly on the last commit widget and also on the "Add previously merged commits" modal.

  1. frontend v-html-safe is stripping off necessary html content from signatureHtml. I've not been able to find a DOMPurify configuration which allows for this HTML to be rendered correctly, so I've reverted it back to v-html. This was introduced by !72872 (merged).
  2. backend The signature_html attribute returned by Projects::MergeRequestsController#context_commits was nil. Presumably, this is because API::Entities::CommitWithLink does not respond to render. So, we now call ApplicationController.renderer.render instead.

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

Component Before After
last_commit Screen_Shot_2022-04-10_at_9.29.34_AM Screen_Shot_2022-04-10_at_1.09.59_PM
commit_item Screen_Shot_2022-04-10_at_2.12.58_PM Screen_Recording_2022-04-10_at_3.01.02_PM

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Create a GPG key and add it to your GitLab account

  2. In the gitlab UI, create a new blank project named gpg-test and copy the remote URI

  3. Create a new project and add a signed commit to it

    mkdir gpg-test
    cd gpg-test
    echo '# This is a test of GPG signed commits' > README.md
    git init
    git add .
    git commit -m 'This commit is signed with gpg' -S
  4. Push the commit to remote

    git remote add origin <remote_uri>
    git push -u origin main
  5. Reload the project page

  6. Click on the rendered Verified badge and check that the GPG key information and user avatar appears

To verify the "Add previously merged commits" modal:

  1. Commit any change and open a merge request for it
  2. Go to the merge request page and click on the "commits" tab
  3. Click on the "Add previously merged commits" button
  4. Click on the rendered Verified badge and check that the GPG key information and user avatar appears

MR acceptance checklist

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

Edited by Brian Williams

Merge request reports